public int Deserialize(byte[] ropBytes, int startIndex)
{
int index = startIndex;
int length = 0;
this.StringType = ropBytes[index++];
switch (this.StringType)
{
// There is no string represent
case (byte)TestSuites.Common.StringType.None:
// The string is empty
case (byte)TestSuites.Common.StringType.Empty:
break;
// Null-terminated 8-bit character string
case (byte)TestSuites.Common.StringType.CharacterString:
// Null-terminated Reduced Unicode character string
case (byte)TestSuites.Common.StringType.ReducedUnicodeCharacterString:
while (true)
{
// Terminator found
if (ropBytes[index + length] == '\0')
{
++length;
break;
}
else
{
++length;
}
}
this.String = new byte[length];
Array.Copy(ropBytes, index, this.String, 0, length);
index += length;
break;
// Null-terminated Unicode character string
case (byte)TestSuites.Common.StringType.UnicodeCharacterString:
while (true)
{
// Terminator found
if ((ropBytes[index + length] == '\0') &&
(ropBytes[index + length + 1] == '\0'))
{
length += 2;
break;
}
else
{
length += 2;
}
}
this.String = new byte[length];
Array.Copy(ropBytes, index, this.String, 0, length);
index += length;
break;
// Undefined flag
default:
break;
}
return index - startIndex;
}