public void Write(NDRWriter writer) { int length = 0; if (Value != null) { length = Value.Length; } // maxCount includes the null terminator uint maxCount = (uint)(length + 1); writer.WriteUInt32(maxCount); // the offset from the first index of the string to the first index of the actual subset being passed uint index = 0; writer.WriteUInt32(index); // actualCount includes the null terminator uint actualCount = (uint)(length + 1); writer.WriteUInt32(actualCount); for (int position = 0; position < length; position++) { writer.WriteUInt16((ushort)Value[position]); } writer.WriteUInt16(0); // null terminator }
public void Write(NDRWriter writer) { string valueToWrite = string.Empty; if (Value != null) { valueToWrite = Value; } if (m_writeNullTerminationCharacter) { valueToWrite += '\0'; } uint maxCount = (uint)valueToWrite.Length; writer.WriteUInt32(maxCount); // the offset from the first index of the string to the first index of the actual subset being passed uint index = 0; writer.WriteUInt32(index); uint actualCount = (uint)valueToWrite.Length; writer.WriteUInt32(actualCount); foreach (char value in valueToWrite) { writer.WriteUInt16(value); } }