From aa20f9d46621565a8cd26146baba10a408b0fe98 Mon Sep 17 00:00:00 2001 From: Eveldee Date: Sat, 23 Mar 2019 22:17:14 +0100 Subject: [PATCH] Add default Command to CommandSerializable --- .../Communication/Commands/CommandSerializable.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/PlantBox.Shared/Communication/Commands/CommandSerializable.cs b/PlantBox.Shared/Communication/Commands/CommandSerializable.cs index b1b071d..726f980 100644 --- a/PlantBox.Shared/Communication/Commands/CommandSerializable.cs +++ b/PlantBox.Shared/Communication/Commands/CommandSerializable.cs @@ -10,6 +10,11 @@ namespace PlantBox.Shared.Communication.Commands /// public abstract class CommandSerializable where T : new() { + /// + /// Default + /// + public abstract Command Command { get; } + /// /// Serialize all the values in a string , /// should contains everything to deserialize @@ -24,6 +29,15 @@ namespace PlantBox.Shared.Communication.Commands /// initilized accordingly public abstract T Deserialize(string[] arguments); + /// + /// Convert a to a , using + /// + /// A valid id + /// + public CommandPacket ToCommandPacket(ulong id) + { + return new CommandPacket(Command, id, Serialize()); + } /// /// Convert a to a ///