Merge remote-tracking branch 'origin/client' into write
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Client
|
||||
@@ -28,7 +24,7 @@ namespace Client
|
||||
|
||||
public static bool getJsonIdentifier(byte[] bytes, out string identifier)
|
||||
{
|
||||
if (bytes.Length <= 5)
|
||||
if (bytes.Length <= 6)
|
||||
{
|
||||
throw new ArgumentException("bytes to short");
|
||||
}
|
||||
@@ -36,7 +32,7 @@ namespace Client
|
||||
|
||||
if (messageId == 1)
|
||||
{
|
||||
dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(bytes.Skip(5).ToArray()));
|
||||
dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(bytes.Skip(6).ToArray()));
|
||||
identifier = json.identifier;
|
||||
return true;
|
||||
}
|
||||
@@ -49,7 +45,7 @@ namespace Client
|
||||
|
||||
public static bool isRawData(byte[] bytes)
|
||||
{
|
||||
if (bytes.Length <= 5)
|
||||
if (bytes.Length <= 6)
|
||||
{
|
||||
throw new ArgumentException("bytes to short");
|
||||
}
|
||||
@@ -67,19 +63,19 @@ namespace Client
|
||||
return res;
|
||||
}
|
||||
|
||||
public static byte[] GetRawDataMessage(byte[] payload)
|
||||
public static byte[] GetRawDataMessage(byte[] payload, byte clientId)
|
||||
{
|
||||
return getMessage(payload, 0x02);
|
||||
return getMessage(payload, 0x02, clientId);
|
||||
}
|
||||
|
||||
public static byte[] getJsonMessage(byte[] payload)
|
||||
public static byte[] getJsonMessage(byte[] payload, byte clientId)
|
||||
{
|
||||
return getMessage(payload, 0x01);
|
||||
return getMessage(payload, 0x01, clientId);
|
||||
}
|
||||
|
||||
public static byte[] getJsonMessage(string message)
|
||||
public static byte[] getJsonMessage(string message, byte clientId)
|
||||
{
|
||||
return getJsonMessage(Encoding.ASCII.GetBytes(message));
|
||||
return getJsonMessage(Encoding.ASCII.GetBytes(message), clientId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user