BTW: I dunno if it was already posted here... so if it was ... sorry for the inconvenience :]
Code:
public class StringPacker { public static string GetString(byte[] array, int offset, int count) { string pszWords = ""; for (int x = offset; x < offset + count; x++) { if (x >= array.Length) break; if (array[x] < 128) pszWords += Convert.ToChar(array[x]); else pszWords += Encoding.Unicode.GetString( new byte[2] { array[x], 0 }); } return pszWords; } }
Code:
int iPos = 26; pszSpeaker = StringPacker.GetString(iMsg, iPos, iMsg[25]); iPos = 27 + pszSpeaker.Length; pszHearer = StringPacker.GetString(iMsg, iPos, iMsg[iPos - 1]); iPos = 29 + pszSpeaker.Length + pszHearer.Length; pszWords = StringPacker.GetString(iMsg, iPos, iMsg[iPos - 1]);
Code:
for (int i = 0; i < Args.Length; i++) Buffer[(ushort)(i + Offset)] = (byte)Args[i];