protected static int SetString(byte[] Data, string Value, int Pos, int StrLength)
{
byte[] ValueData = new byte[Value.Length + 2];
SetUInt16(ValueData, (UInt16)Value.Length, 0); //first set the length of the string
ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte[] temp = new byte[Value.Length];
temp = encoding.GetBytes(Value);
Array.Copy(temp, 0, ValueData, 2, temp.Length);
Array.Copy(ValueData, 0, Data, Pos, ValueData.Length); //terminate the string with zero
return Pos + Value.Length + 2;
}