diff --git a/PlantBox.Shared/Communication/CommandPacket.cs b/PlantBox.Shared/Communication/CommandPacket.cs index 3b9b9fe..37b8187 100644 --- a/PlantBox.Shared/Communication/CommandPacket.cs +++ b/PlantBox.Shared/Communication/CommandPacket.cs @@ -1,4 +1,5 @@ -using System; +using PlantBox.Shared.Communication.Commands; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/PlantBox.Shared/Communication/Commands/CommandSerializable.cs b/PlantBox.Shared/Communication/Commands/CommandSerializable.cs new file mode 100644 index 0000000..b9002e9 --- /dev/null +++ b/PlantBox.Shared/Communication/Commands/CommandSerializable.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace PlantBox.Shared.Communication.Commands +{ + public abstract class CommandSerializable + { + public abstract string[] Serialize(); + public abstract T Deserialize(string[] arguments); + + public CommandPacket ToCommandPacket(Command command, ulong id) + { + return new CommandPacket(command, id, Serialize()); + } + } +}