Browse Source

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

master
Starbeamrainbowlabs 4 years ago
parent
commit
2271f52d1e
3 changed files with 29 additions and 1 deletions
  1. +1
    -1
      PixelHub-Server/PixelHub/PixelCommand.cs
  2. +26
    -0
      PixelHub-Server/PixelHub/PixelCommands/ResetCommand.cs
  3. +2
    -0
      PixelHub-Server/PixelHub/PixelHub.csproj

+ 1
- 1
PixelHub-Server/PixelHub/PixelCommand.cs View File

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


+ 26
- 0
PixelHub-Server/PixelHub/PixelCommands/ResetCommand.cs 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()
{
}
}
}

+ 2
- 0
PixelHub-Server/PixelHub/PixelHub.csproj View File

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