Add reset command to test out new abstract PixelCommand class implementation.

This commit is contained in:
Starbeamrainbowlabs 2017-02-26 20:30:51 +00:00
parent ea7d72ab4a
commit 2271f52d1e
3 changed files with 29 additions and 1 deletions

View File

@ -65,7 +65,7 @@ namespace PixelHub
/// <summary> /// <summary>
/// The payload of the message. /// The payload of the message.
/// </summary> /// </summary>
public abstract byte[] Payload { get; } public abstract byte[] Payload { get; protected set; }
public PixelCommand() public PixelCommand()
{ {

View File

@ -0,0 +1,26 @@
using System;
namespace PixelHub.Server.PixelCommands
{
/// <summary>
/// Hard-resets the PixelBot. Useful if something has gone wrong, or to reset it's internal state.
/// Note that this will cause the PixelBot to drop it's connection!
/// </summary>
public class ResetCommand : PixelCommand
{
public override byte[] Payload {
get {
return new byte[0];
}
protected set {
// There's nothing here!
}
}
public ResetCommand()
{
}
}
}

View File

@ -43,9 +43,11 @@
<Compile Include="PixelCommand.cs" /> <Compile Include="PixelCommand.cs" />
<Compile Include="PixelBot.cs" /> <Compile Include="PixelBot.cs" />
<Compile Include="NetTools.cs" /> <Compile Include="NetTools.cs" />
<Compile Include="PixelCommands\ResetCommand.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>
<Folder Include="SBRL.Utilities\" /> <Folder Include="SBRL.Utilities\" />
<Folder Include="PixelCommands\" />
</ItemGroup> </ItemGroup>
</Project> </Project>