Renamed subprojects and changed namespace names.

This commit is contained in:
2021-04-20 23:55:03 -05:00
parent f5a181d2f2
commit f61bbd3a9e
41 changed files with 52 additions and 52 deletions

View File

@@ -0,0 +1,12 @@
using System;
namespace GameServiceWarden.ClientAPI
{
public enum CommunicableType : uint
{
Disconnect,
Connect,
Service,
UnexpectedCommunication
}
}

View File

@@ -0,0 +1,9 @@
using System;
namespace GameServiceWarden.ClientAPI
{
public interface ICommunicable
{
CommunicableType Type { get; }
}
}

View File

@@ -0,0 +1,13 @@
namespace GameServiceWarden.ClientAPI.Requests
{
public struct ConnectRequest : ICommunicable
{
public string requestedIdentifier;
public string programName;
public string programAuthor;
public string versionNumber;
public string details;
public CommunicableType Type => CommunicableType.Connect;
}
}

View File

@@ -0,0 +1,7 @@
namespace GameServiceWarden.ClientAPI
{
public struct DisconnectRequest
{
public string reason;
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.IO.Pipes;
namespace GameServiceWarden.ClientAPI.Requests
{
public static class RequestHeader
{
public static void Decode(byte[] header, out CommunicableType type, out uint length) {
type = (CommunicableType) BitConverter.ToUInt32(header, 0);
length = BitConverter.ToUInt32(header, sizeof(uint));
}
}
}

View File

@@ -0,0 +1,11 @@
using GameServiceWarden.ClientAPI.Module;
namespace GameServiceWarden.ClientAPI.Requests
{
public struct ServiceRequest : ICommunicable
{
public ServiceManagerAction serviceManagerAction;
public CommunicableType Type => CommunicableType.Service;
}
}

View File

@@ -0,0 +1,14 @@
using System.Security.Cryptography.X509Certificates;
namespace GameServiceWarden.ClientAPI.Responses
{
public struct ConnectResponse : ICommunicable
{
public string identifier;
public bool nameTaken;
public bool invalidName;
public string errorMsg;
public CommunicableType Type => CommunicableType.Connect;
}
}

View File

@@ -0,0 +1,7 @@
namespace GameServiceWarden.ClientAPI
{
public struct DisconnectResponse
{
public string reason;
}
}

View File

@@ -0,0 +1,14 @@
using System;
namespace GameServiceWarden.ClientAPI.Responses
{
public static class ResponseHeader
{
public static byte[] Encode(CommunicableType type, uint length) {
byte[] res = new byte[sizeof(uint) + sizeof(uint)];
BitConverter.GetBytes((uint)type).CopyTo(res, 0);
BitConverter.GetBytes(length).CopyTo(res, sizeof(uint));
return res;
}
}
}

View File

@@ -0,0 +1,11 @@
using GameServiceWarden.ClientAPI.Module;
namespace GameServiceWarden.ClientAPI.Responses
{
public struct ServiceResponse : ICommunicable
{
public ServiceManagerState gameServiceDelta;
public CommunicableType Type => CommunicableType.Service;
}
}

View File

@@ -0,0 +1,10 @@
namespace GameServiceWarden.ClientAPI.Responses
{
public struct UnexpectedRequestResponse : ICommunicable
{
public CommunicableType origin;
public string message;
public CommunicableType Type => CommunicableType.UnexpectedCommunication;
}
}

View File

@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,25 @@
namespace GameServiceWarden.ClientAPI.Module
{
public struct ServiceManagerAction
{
public enum Type
{
Start,
Stop,
CreateService,
DeleteService,
ExecuteCommand,
SetServiceOption,
View
}
public string assemblyName;
public string moduleName;
public string serviceName;
public string option;
public string command;
public string value;
public Type action;
}
}

View File

@@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace GameServiceWarden.ClientAPI.Module
{
public struct ServiceManagerState
{
public bool delta;
public bool subtract;
public ICollection<string> services;
public ICollection<string> running;
public ICollection<string> modules;
public IReadOnlyDictionary<string, byte[]> logs;
public IReadOnlyDictionary<string, IReadOnlyDictionary<string, string>> serviceOptions;
}
}