diff --git a/Autostart/Autostart.csproj b/Autostart/Autostart.csproj index 74611bd..0148611 100644 --- a/Autostart/Autostart.csproj +++ b/Autostart/Autostart.csproj @@ -14,6 +14,7 @@ 4 true wicns.ico + 12 AnyCPU diff --git a/Update/Update.csproj b/Update/Update.csproj index 263ea53..5c5a75b 100644 --- a/Update/Update.csproj +++ b/Update/Update.csproj @@ -14,6 +14,7 @@ 4 true wicns.ico + 12 AnyCPU diff --git a/WXPlugin/PluginCore/IPluginBase.cs b/WXPlugin/PluginCore/IPluginBase.cs new file mode 100644 index 0000000..2c5b89d --- /dev/null +++ b/WXPlugin/PluginCore/IPluginBase.cs @@ -0,0 +1,12 @@ +using System; + +namespace WXPlugin.PluginCore +{ + public interface IPluginBase + { + public String Name { get; set; } + public String Description { get; set; } + public void Initialize(); + public void Execute(); + } +} \ No newline at end of file diff --git a/WXPlugin/WXPlugin.csproj b/WXPlugin/WXPlugin.csproj new file mode 100644 index 0000000..c21743b --- /dev/null +++ b/WXPlugin/WXPlugin.csproj @@ -0,0 +1,55 @@ + + + + + Debug + AnyCPU + {56BFE4E0-0D30-474A-B57B-CF08515FF66E} + Library + Properties + WXPlugin + WXPlugin + v4.8 + 512 + 12 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + diff --git a/WeeXnes.sln b/WeeXnes.sln index 7fe69c6..9de16df 100644 --- a/WeeXnes.sln +++ b/WeeXnes.sln @@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeeXnes_UAC", "WeeXnes_UAC\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update", "Update\Update.csproj", "{133FF515-D605-4856-BA2E-5841BF47EC2F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WXPlugin", "WXPlugin\WXPlugin.csproj", "{56BFE4E0-0D30-474A-B57B-CF08515FF66E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -30,5 +32,9 @@ Global {133FF515-D605-4856-BA2E-5841BF47EC2F}.Debug|Any CPU.Build.0 = Debug|Any CPU {133FF515-D605-4856-BA2E-5841BF47EC2F}.Release|Any CPU.ActiveCfg = Release|Any CPU {133FF515-D605-4856-BA2E-5841BF47EC2F}.Release|Any CPU.Build.0 = Release|Any CPU + {56BFE4E0-0D30-474A-B57B-CF08515FF66E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {56BFE4E0-0D30-474A-B57B-CF08515FF66E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {56BFE4E0-0D30-474A-B57B-CF08515FF66E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {56BFE4E0-0D30-474A-B57B-CF08515FF66E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/WeeXnes/Core/PluginManager.cs b/WeeXnes/Core/PluginManager.cs new file mode 100644 index 0000000..089c9a8 --- /dev/null +++ b/WeeXnes/Core/PluginManager.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using WXPlugin.PluginCore; + +namespace WeeXnes.Core; + +public class PluginManager +{ + private HashSet Directories = new HashSet(); + public HashSet CurrentPlugins { get; set; } = new HashSet(); + public PluginManager(String pluginPath) + { + Directories.Add(pluginPath); + } + + public void LoadPlugins() + { + CurrentPlugins = new HashSet(); + foreach (var dir in Directories) + { + DirectoryInfo dirInfo = new DirectoryInfo(dir); + foreach (var file in dirInfo.GetFiles("*.dll")) + { + Assembly asm = Assembly.LoadFrom(file.FullName); + foreach (Type type in asm.GetTypes()) + { + if (type.IsSubclassOf(typeof(IPluginBase)) || type.GetInterfaces().Contains(typeof(IPluginBase)) && type.IsAbstract == false) + { + IPluginBase newPlugin = type.InvokeMember( + null, + BindingFlags.CreateInstance, + null, + null, + null) + as IPluginBase; + CurrentPlugins.Add(newPlugin); + } + } + } + } + } +} \ No newline at end of file diff --git a/WeeXnes/MainWindow.xaml b/WeeXnes/MainWindow.xaml index 55d1058..7af6e09 100644 --- a/WeeXnes/MainWindow.xaml +++ b/WeeXnes/MainWindow.xaml @@ -103,7 +103,8 @@ Icon="InprivateAccount24" Name="ButtonProfile" PageTag="Profile" - PageType="{x:Type profile:LoginView}"/> + PageType="{x:Type profile:LoginView}" + Visibility="Collapsed"/> 4 true wicns.ico - 10 + 12 AnyCPU @@ -75,6 +75,7 @@ + @@ -200,5 +201,11 @@ + + + {56bfe4e0-0d30-474a-b57b-cf08515ff66e} + WXPlugin + + \ No newline at end of file diff --git a/WeeXnes_UAC/WeeXnes_UAC.csproj b/WeeXnes_UAC/WeeXnes_UAC.csproj index 7fff9b4..b5177f3 100644 --- a/WeeXnes_UAC/WeeXnes_UAC.csproj +++ b/WeeXnes_UAC/WeeXnes_UAC.csproj @@ -13,6 +13,7 @@ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true + 12 AnyCPU