Browse Source

[server] Rename PixelCommand to PixelMessage, along with all associated namespaces. Also add HandshakeRequestMessaage class.

master
Starbeamrainbowlabs 4 years ago
parent
commit
007a5beeaf
5 changed files with 39 additions and 10 deletions
  1. +1
    -1
      PixelHub-Server/PixelHub/PixelBot.cs
  2. +4
    -4
      PixelHub-Server/PixelHub/PixelHub.csproj
  3. +2
    -2
      PixelHub-Server/PixelHub/PixelMessage.cs
  4. +29
    -0
      PixelHub-Server/PixelHub/PixelMessages/HandshakeRequestMessage.cs
  5. +3
    -3
      PixelHub-Server/PixelHub/PixelMessages/ResetMessage.cs

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

@ -54,7 +54,7 @@ namespace PixelHub.Server
/// Sends the given command to the remote PixelBot.
/// </summary>
/// <param name="command">The command to send.</param>
public async Task Send(PixelCommand command)
public async Task Send(PixelMessage command)
{
byte[] message = command.AsCompiledCommand();
await client.GetStream().WriteAsync(message, 0, message.Length);


+ 4
- 4
PixelHub-Server/PixelHub/PixelHub.csproj View File

@ -40,15 +40,15 @@
<Compile Include="SBRL.Utilities\ForgetTask.cs" />
<Compile Include="SBRL.Utilities\Utilities.cs" />
<Compile Include="SBRL.Utilities\PrefixedWriter.cs" />
<Compile Include="PixelCommand.cs" />
<Compile Include="PixelBot.cs" />
<Compile Include="NetTools.cs" />
<Compile Include="PixelCommands\ResetCommand.cs" />
<Compile Include="PixelCommands\HandshakeRequestCommand.cs" />
<Compile Include="PixelMessage.cs" />
<Compile Include="PixelMessages\HandshakeRequestMessage.cs" />
<Compile Include="PixelMessages\ResetMessage.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="SBRL.Utilities\" />
<Folder Include="PixelCommands\" />
<Folder Include="PixelMessages\" />
</ItemGroup>
</Project>

PixelHub-Server/PixelHub/PixelCommand.cs → PixelHub-Server/PixelHub/PixelMessage.cs View File


+ 29
- 0
PixelHub-Server/PixelHub/PixelMessages/HandshakeRequestMessage.cs View File

@ -0,0 +1,29 @@
using System;
using System.Text;
namespace PixelHub.Server.PixelMessages
{
public class HandshakeRequestMessage : PixelMessage
{
/// <summary>
/// The type of PixelBot the client thinks it is. Rather like a user-agent string actually.
/// </summary>
public string PixelBotType = string.Empty;
public override byte[] Payload {
get {
return Encoding.UTF8.GetBytes(PixelBotType);
}
protected set {
PixelBotType = Encoding.UTF8.GetString(value);
}
}
public new MessageTypes MessageType { get; private set; } = MessageTypes.HandshakeRequest;
public HandshakeRequestMessage()
{
}
}
}

PixelHub-Server/PixelHub/PixelCommands/ResetCommand.cs → PixelHub-Server/PixelHub/PixelMessages/ResetMessage.cs View File