overhaul provider structure
This commit is contained in:
17
OwnChar.Server/Commands/CmdSave.cs
Normal file
17
OwnChar.Server/Commands/CmdSave.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
OwnChar.Server/Commands/IServerCommand.cs
Normal file
15
OwnChar.Server/Commands/IServerCommand.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
17
OwnChar.Server/Data/ClientServerDataProvider.cs
Normal file
17
OwnChar.Server/Data/ClientServerDataProvider.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Pilz.Plugins.Advanced;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -8,5 +9,11 @@ namespace OwnChar.Server.Data
|
||||
{
|
||||
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
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
12
OwnChar.Server/Network/NetworkHandler.cs
Normal file
12
OwnChar.Server/Network/NetworkHandler.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OwnChar.Server.Network
|
||||
{
|
||||
public class NetworkHandler
|
||||
{
|
||||
}
|
||||
}
|
||||
12
OwnChar.Server/Network/NetworkManager.cs
Normal file
12
OwnChar.Server/Network/NetworkManager.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OwnChar.Server.Network
|
||||
{
|
||||
public class NetworkManager
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,4 @@
|
||||
<PackageReference Include="Pilz.Plugins.Advanced" Version="2.7.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Network\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user