overhaul provider structure

This commit is contained in:
2024-05-16 10:20:31 +02:00
parent 34bc418b88
commit b13f1ace7e
12 changed files with 61 additions and 68 deletions

View File

@@ -1,13 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\OwnChar\OwnChar\OwnChar.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,7 +0,0 @@
namespace OwnChar.Data.ClientDataProvider
{
public class Plugin
{
}
}

View File

@@ -1,14 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\OwnChar.Server\OwnChar.Server.csproj" />
<ProjectReference Include="..\OwnChar\OwnChar\OwnChar.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,7 +0,0 @@
namespace OwnChar.Server.Data.ServerDataProvider
{
public class Plugin
{
}
}

View File

@@ -5,12 +5,6 @@ VisualStudioVersion = 17.9.34714.143
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OwnChar.Server", "OwnChar.Server\OwnChar.Server.csproj", "{9EEFF2B5-270E-4DB4-8ED8-DEDDCDF0035C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OwnChar.Server", "OwnChar.Server\OwnChar.Server.csproj", "{9EEFF2B5-270E-4DB4-8ED8-DEDDCDF0035C}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OwnChar.Data.ClientDataProvider", "OwnChar.Data.ClientDataProvider\OwnChar.Data.ClientDataProvider.csproj", "{B5F6CB0B-1624-4C98-BB7C-FB762EA07257}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OwnChar.Server.Data.ServerDataProvider", "OwnChar.Server.Data.ServerDataProvider\OwnChar.Server.Data.ServerDataProvider.csproj", "{DE1EFB56-A657-4B90-9E88-721516D3F9A5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DataProvider", "DataProvider", "{5B7E538D-2487-49D5-BFD9-EBD9CD6C07F4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OwnChar", "OwnChar\OwnChar\OwnChar.csproj", "{BAD88A97-650D-493B-BAC3-3510B6F354B6}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OwnChar", "OwnChar\OwnChar\OwnChar.csproj", "{BAD88A97-650D-493B-BAC3-3510B6F354B6}"
EndProject EndProject
Global Global
@@ -23,14 +17,6 @@ Global
{9EEFF2B5-270E-4DB4-8ED8-DEDDCDF0035C}.Debug|Any CPU.Build.0 = Debug|Any CPU {9EEFF2B5-270E-4DB4-8ED8-DEDDCDF0035C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9EEFF2B5-270E-4DB4-8ED8-DEDDCDF0035C}.Release|Any CPU.ActiveCfg = Release|Any CPU {9EEFF2B5-270E-4DB4-8ED8-DEDDCDF0035C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9EEFF2B5-270E-4DB4-8ED8-DEDDCDF0035C}.Release|Any CPU.Build.0 = Release|Any CPU {9EEFF2B5-270E-4DB4-8ED8-DEDDCDF0035C}.Release|Any CPU.Build.0 = Release|Any CPU
{B5F6CB0B-1624-4C98-BB7C-FB762EA07257}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5F6CB0B-1624-4C98-BB7C-FB762EA07257}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5F6CB0B-1624-4C98-BB7C-FB762EA07257}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5F6CB0B-1624-4C98-BB7C-FB762EA07257}.Release|Any CPU.Build.0 = Release|Any CPU
{DE1EFB56-A657-4B90-9E88-721516D3F9A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE1EFB56-A657-4B90-9E88-721516D3F9A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE1EFB56-A657-4B90-9E88-721516D3F9A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE1EFB56-A657-4B90-9E88-721516D3F9A5}.Release|Any CPU.Build.0 = Release|Any CPU
{BAD88A97-650D-493B-BAC3-3510B6F354B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BAD88A97-650D-493B-BAC3-3510B6F354B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BAD88A97-650D-493B-BAC3-3510B6F354B6}.Debug|Any CPU.Build.0 = Debug|Any CPU {BAD88A97-650D-493B-BAC3-3510B6F354B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BAD88A97-650D-493B-BAC3-3510B6F354B6}.Release|Any CPU.ActiveCfg = Release|Any CPU {BAD88A97-650D-493B-BAC3-3510B6F354B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -39,10 +25,6 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B5F6CB0B-1624-4C98-BB7C-FB762EA07257} = {5B7E538D-2487-49D5-BFD9-EBD9CD6C07F4}
{DE1EFB56-A657-4B90-9E88-721516D3F9A5} = {5B7E538D-2487-49D5-BFD9-EBD9CD6C07F4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D0794B9A-6A8C-469B-AADA-B8932F72E62C} SolutionGuid = {D0794B9A-6A8C-469B-AADA-B8932F72E62C}
EndGlobalSection EndGlobalSection

View File

@@ -0,0 +1,17 @@
using Pilz.Plugins.Advanced;
namespace OwnChar.Server.Commands
{
public class CmdSave() : PluginFunction(IServerCommand.FeatureCode, "ownchar.save"), IPluginFeatureProvider<CmdSave>, IServerCommand
{
public static CmdSave Instance { get; } = new();
public string Command => "save";
public string Description => "Saves the current state to disk.";
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
{
return this;
}
}
}

View File

@@ -0,0 +1,15 @@
using Pilz.Plugins.Advanced;
namespace OwnChar.Server.Commands
{
public interface IServerCommand
{
// Shared
public const string FeatureCode = "ownchar.server.command";
public IEnumerable<IServerCommand> Commands => PluginFeatureController.Instance.Features.Get(FeatureCode).Cast<PluginFunction>().Select(f => (IServerCommand)f.Execute()!);
// Interface
public string Command { get; }
public string Description { get; }
}
}

View File

@@ -0,0 +1,17 @@
using Pilz.Plugins.Advanced;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OwnChar.Server.Data
{
public class ClientServerDataProvider() : PluginFunction(IServerDataProvider.FeatureCode, "ownchar.clientserver"), IServerDataProvider
{
protected override object? ExecuteFunction(PluginFunctionParameter? @params)
{
return this;
}
}
}

View File

@@ -1,4 +1,5 @@
using System; using Pilz.Plugins.Advanced;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -8,5 +9,11 @@ namespace OwnChar.Server.Data
{ {
public interface IServerDataProvider public interface IServerDataProvider
{ {
// Shared
public const string FeatureCode = "ownchar.server.dataprovider";
public IEnumerable<IServerDataProvider> DataProviders => PluginFeatureController.Instance.Features.Get(FeatureCode).Cast<PluginFunction>().Select(f => (IServerDataProvider)f.Execute()!);
// Interface
// ...
} }
} }

View File

@@ -4,9 +4,9 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace OwnChar.Data.ClientDataProvider namespace OwnChar.Server.Network
{ {
public class DataProvider : ILocalDataProvider public class NetworkHandler
{ {
} }
} }

View File

@@ -4,9 +4,9 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace OwnChar.Server.Data.ServerDataProvider namespace OwnChar.Server.Network
{ {
public class DataProvider : IServerDataProvider public class NetworkManager
{ {
} }
} }

View File

@@ -12,8 +12,4 @@
<PackageReference Include="Pilz.Plugins.Advanced" Version="2.7.3" /> <PackageReference Include="Pilz.Plugins.Advanced" Version="2.7.3" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Network\" />
</ItemGroup>
</Project> </Project>