Skip to content
613 changes: 439 additions & 174 deletions src/OpenPuppet.SDK/IPlugin.cs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/OpenPuppet.SDK/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public static class LogManager
{
public static string RequestPluginLogFile(string pluginName)
{
if(!Directory.Exists(Path.Combine(LogPath!, OpenPuppet.Plugins.PluginsPath.SafePluginName(pluginName)))) {
Directory.CreateDirectory(Path.Combine(LogPath!, OpenPuppet.Plugins.PluginsPath.SafePluginName(pluginName)));
if(!Directory.Exists(Path.Combine(LogPath!, IPlugin.SafePluginName(pluginName)))) {
Directory.CreateDirectory(Path.Combine(LogPath!, IPlugin.SafePluginName(pluginName)));
}

string path = Path.Combine(
LogPath!,
OpenPuppet.Plugins.PluginsPath.SafePluginName(pluginName),
IPlugin.SafePluginName(pluginName),
DateTime.Now.ToString("dd'-'MM'-'yyyy'.txt'")
);

Expand Down
192 changes: 0 additions & 192 deletions src/OpenPuppet.SDK/Plugins/Manager.cs

This file was deleted.

48 changes: 0 additions & 48 deletions src/OpenPuppet.SDK/Plugins/Path.cs

This file was deleted.

18 changes: 18 additions & 0 deletions src/OpenPuppet.SDK/Plugins/PluginMetadata.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenPuppet.SDK
{
public class PluginMetadata
{
public string ID { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string Author { get; set; } = string.Empty;
public string Version { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
}
}
32 changes: 25 additions & 7 deletions src/OpenPuppet.Tests/Plugins/Path.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
using OpenPuppet.Plugins;
using System.Xml.Linq;
using OpenPuppet.SDK;

namespace OpenPuppet.Tests.Plugins
{
public class Path
{
[Fact]
public void TestIPluginPluginPath()
{
Assert.NotNull(IPlugin.PluginPath);
}

[Fact]
public void TestPluginName()
{
Assert.NotEqual(
"a-b-c-d",
PluginsPath.SafePluginName(
IPlugin.SafePluginName(
@"a B
`¦¬!" + '"' + @"@£$%^&*()_+-=[]{};:'@#~,./<>?\| C d"
`¦¬!" + '"' + @"@£$%^&*()_+-=[]{};:'@#~,/<>?\| C d"
)
);
}
Expand All @@ -21,12 +26,25 @@ public void TestPluginName()
public void TestPluginPath()
{
Assert.Equal(
System.IO.Path.Combine(PluginsPath.PluginPath!, PluginsPath.SafePluginName("a-b-c-d")),
PluginsPath.GetPluginPath(
System.IO.Path.Combine(IPlugin.PluginPath!, IPlugin.SafePluginName("a-b-c-d")),
IPlugin.GetPluginPath(
@"a B
`¦¬!" + '"' + @"@£$%^&*()_+-=[]{};:'@#~,./<>?\| C d"
`¦¬!" + '"' + @"@£$%^&*()_+-=[]{};:'@#~,/<>?\| C d"
)
);
}

[Fact]
public void TestInternetSourceToLocalSourceConversion()
{
SDK.Plugin.InternetInstallSource internet = new(
"https://example.com/plugin.zip",
"plugin.zip"
);

SDK.Plugin.LocalInstallSource local = new(internet);

Assert.Equal(internet.Path, local.Path);
}
}
}
Loading
Loading