using System;
using System.Collections.Generic;
using System.Text;
namespace PlantBox.Shared.Communication.Commands
{
///
/// A class serializable to a
///
///
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
///
/// Valid arguments for a
public abstract string[] Serialize();
///
/// Create an instance of the class from a string
///
/// Arguments from the method
/// 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
///
/// Command type
/// A valid id
///
public CommandPacket ToCommandPacket(Command command, ulong id)
{
return new CommandPacket(command, id, Serialize());
}
}
}