public byte[] Serialize()
{
int index = 0;
int bufSize = sizeof(byte) * 8;
if (this.DisplayName != null)
{
bufSize += this.DisplayName.Length;
}
if (this.Comment != null)
{
bufSize += this.Comment.Length;
}
byte[] serializeBuffer = new byte[bufSize];
serializeBuffer[index++] = this.RopId;
serializeBuffer[index++] = this.LogonId;
serializeBuffer[index++] = this.InputHandleIndex;
serializeBuffer[index++] = this.OutputHandleIndex;
serializeBuffer[index++] = this.FolderType;
serializeBuffer[index++] = this.UseUnicodeStrings;
serializeBuffer[index++] = this.OpenExisting;
serializeBuffer[index++] = this.Reserved;
if (this.DisplayName != null)
{
Array.Copy(this.DisplayName, 0, serializeBuffer, index, this.DisplayName.Length);
index += this.DisplayName.Length;
}
if (this.Comment != null)
{
Array.Copy(this.Comment, 0, serializeBuffer, index, this.Comment.Length);
index += this.Comment.Length;
}
return serializeBuffer;
}