removed clientId
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Client
|
||||
/// <returns>if it sucseeded</returns>
|
||||
public static bool getJsonIdentifier(byte[] bytes, out string identifier)
|
||||
{
|
||||
if (bytes.Length <= 6)
|
||||
if (bytes.Length <= 5)
|
||||
{
|
||||
throw new ArgumentException("bytes to short");
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace Client
|
||||
|
||||
if (messageId == 1)
|
||||
{
|
||||
dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(bytes.Skip(6).ToArray()));
|
||||
dynamic json = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(bytes.Skip(5).ToArray()));
|
||||
identifier = json.identifier;
|
||||
return true;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ namespace Client
|
||||
/// <returns>if message contains raw data</returns>
|
||||
public static bool isRawData(byte[] bytes)
|
||||
{
|
||||
if (bytes.Length <= 6)
|
||||
if (bytes.Length <= 5)
|
||||
{
|
||||
throw new ArgumentException("bytes to short");
|
||||
}
|
||||
@@ -76,14 +76,13 @@ namespace Client
|
||||
/// <param name="messageId"></param>
|
||||
/// <param name="clientId"></param>
|
||||
/// <returns>the message ready for sending</returns>
|
||||
private static byte[] getMessage(byte[] payload, byte messageId, byte clientId)
|
||||
private static byte[] getMessage(byte[] payload, byte messageId)
|
||||
{
|
||||
byte[] res = new byte[payload.Length + 6];
|
||||
byte[] res = new byte[payload.Length + 5];
|
||||
|
||||
Array.Copy(BitConverter.GetBytes(payload.Length + 6), 0, res, 0, 4);
|
||||
Array.Copy(BitConverter.GetBytes(payload.Length + 5), 0, res, 0, 4);
|
||||
res[4] = messageId;
|
||||
res[5] = clientId;
|
||||
Array.Copy(payload, 0, res, 6, payload.Length);
|
||||
Array.Copy(payload, 0, res, 5, payload.Length);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -94,9 +93,9 @@ namespace Client
|
||||
/// <param name="payload"></param>
|
||||
/// <param name="clientId"></param>
|
||||
/// <returns>the message ready for sending</returns>
|
||||
public static byte[] GetRawDataMessage(byte[] payload, byte clientId)
|
||||
public static byte[] GetRawDataMessage(byte[] payload)
|
||||
{
|
||||
return getMessage(payload, 0x02, clientId);
|
||||
return getMessage(payload, 0x02);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -105,9 +104,9 @@ namespace Client
|
||||
/// <param name="payload"></param>
|
||||
/// <param name="clientId"></param>
|
||||
/// <returns>the message ready for sending</returns>
|
||||
public static byte[] getJsonMessage(byte[] payload, byte clientId)
|
||||
public static byte[] getJsonMessage(byte[] payload)
|
||||
{
|
||||
return getMessage(payload, 0x01, clientId);
|
||||
return getMessage(payload, 0x01);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -116,9 +115,9 @@ namespace Client
|
||||
/// <param name="message"></param>
|
||||
/// <param name="clientId"></param>
|
||||
/// <returns>the message ready for sending</returns>
|
||||
public static byte[] getJsonMessage(string message, byte clientId)
|
||||
public static byte[] getJsonMessage(string message)
|
||||
{
|
||||
return getJsonMessage(Encoding.ASCII.GetBytes(message), clientId);
|
||||
return getJsonMessage(Encoding.ASCII.GetBytes(message));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user