plugins loading now
This commit is contained in:
parent
b832aafa7c
commit
6e60333fdf
8 changed files with 142 additions and 0 deletions
21
ExamplePlugin/ExamplePlugin.cs
Normal file
21
ExamplePlugin/ExamplePlugin.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using WXPlugin.PluginCore;
|
||||
|
||||
namespace ExamplePlugin
|
||||
{
|
||||
public class ExamplePlugin : IPluginBase
|
||||
{
|
||||
public String Name { get; set; } = "Example Plugin";
|
||||
public String Description { get; set; } = "This is an example plugin.";
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
60
ExamplePlugin/ExamplePlugin.csproj
Normal file
60
ExamplePlugin/ExamplePlugin.csproj
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
|
||||
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ExamplePlugin</RootNamespace>
|
||||
<AssemblyName>ExamplePlugin</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System"/>
|
||||
<Reference Include="System.Core"/>
|
||||
<Reference Include="System.Data"/>
|
||||
<Reference Include="System.Xml"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ExamplePlugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WXPlugin\WXPlugin.csproj">
|
||||
<Project>{56bfe4e0-0d30-474a-b57b-cf08515ff66e}</Project>
|
||||
<Name>WXPlugin</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
|
||||
</Project>
|
|
@ -10,6 +10,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update", "Update\Update.csp
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WXPlugin", "WXPlugin\WXPlugin.csproj", "{56BFE4E0-0D30-474A-B57B-CF08515FF66E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExamplePlugin", "ExamplePlugin\ExamplePlugin.csproj", "{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -36,5 +38,9 @@ Global
|
|||
{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
|
||||
{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{910F0FC8-B73D-449F-ADD7-C6CA147D9F05}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -51,6 +51,18 @@ namespace WeeXnes
|
|||
LoadSettings();
|
||||
SaveSettingsHandler.SetupSaveEvents();
|
||||
LoadFiles();
|
||||
LoadPluginManager();
|
||||
|
||||
}
|
||||
|
||||
private void LoadPluginManager()
|
||||
{
|
||||
string pluginsPath = Path.Combine(Environment.CurrentDirectory, "plugins");
|
||||
if (!Directory.Exists(pluginsPath))
|
||||
Directory.CreateDirectory(pluginsPath);
|
||||
PluginManager manager = new PluginManager(pluginsPath);
|
||||
manager.LoadPlugins();
|
||||
|
||||
}
|
||||
|
||||
private void CheckUpdatedFiles()
|
||||
|
|
|
@ -13,11 +13,15 @@ public class PluginManager
|
|||
public HashSet<IPluginBase> CurrentPlugins { get; set; } = new HashSet<IPluginBase>();
|
||||
public PluginManager(String pluginPath)
|
||||
{
|
||||
|
||||
Console.WriteLine("Plugin Manager Initialized");
|
||||
Directories.Add(pluginPath);
|
||||
}
|
||||
|
||||
public void LoadPlugins()
|
||||
{
|
||||
|
||||
Console.WriteLine("Plugin Manager Loading Plugins");
|
||||
CurrentPlugins = new HashSet<IPluginBase>();
|
||||
foreach (var dir in Directories)
|
||||
{
|
||||
|
@ -36,6 +40,7 @@ public class PluginManager
|
|||
null,
|
||||
null)
|
||||
as IPluginBase;
|
||||
Console.WriteLine("Loaded: " + newPlugin.Name);
|
||||
CurrentPlugins.Add(newPlugin);
|
||||
}
|
||||
}
|
||||
|
|
21
WeeXnes/Views/PluginManager/PluginManagerView.xaml
Normal file
21
WeeXnes/Views/PluginManager/PluginManagerView.xaml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<Page x:Class="WeeXnes.Views.PluginManager.PluginManagerView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:WeeXnes.Views.PluginManager"
|
||||
mc:Ignorable="d"
|
||||
Title="PluginManagerView" Height="450" Width="800">
|
||||
<Grid>
|
||||
<ListView ItemsSource="{Binding Plugin}">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
<TextBlock Text="{Binding Description}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</Page>
|
13
WeeXnes/Views/PluginManager/PluginManagerView.xaml.cs
Normal file
13
WeeXnes/Views/PluginManager/PluginManagerView.xaml.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System.Windows.Controls;
|
||||
|
||||
|
||||
namespace WeeXnes.Views.PluginManager;
|
||||
|
||||
public partial class PluginManagerView : Page
|
||||
{
|
||||
public PluginManagerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
}
|
|
@ -111,6 +111,9 @@
|
|||
<Compile Include="Views\PasswordGenerator\SaveToKeyManagerView.xaml.cs">
|
||||
<DependentUpon>SaveToKeyManagerView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\PluginManager\PluginManagerView.xaml.cs">
|
||||
<DependentUpon>PluginManagerView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ProfileView\InboxView.xaml.cs">
|
||||
<DependentUpon>InboxView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -168,6 +171,7 @@
|
|||
<Page Include="Views\PasswordGenerator\PasswordGenView.xaml" />
|
||||
<Page Include="Views\PasswordGenerator\SavePasswordView.xaml" />
|
||||
<Page Include="Views\PasswordGenerator\SaveToKeyManagerView.xaml" />
|
||||
<Page Include="Views\PluginManager\PluginManagerView.xaml" />
|
||||
<Page Include="Views\ProfileView\InboxView.xaml" />
|
||||
<Page Include="Views\ProfileView\LicenseView.xaml" />
|
||||
<Page Include="Views\ProfileView\LoginError.xaml" />
|
||||
|
|
Loading…
Add table
Reference in a new issue