/// <summary> /// Encode the struct of Trans2Data into the byte array in SmbData.Trans2_Data /// </summary> protected override void EncodeTrans2Data() { if (this.trans2Parameters.InformationLevel == QueryInformationLevel.SMB_INFO_QUERY_EAS_FROM_LIST) { this.smbData.Trans2_Data = new byte[sizeOfListInBytesLength + CifsMessageUtils.GetSmbQueryEAListSize( this.trans2Data.GetExtendedAttributeList.GEAList)]; using (MemoryStream memoryStream = new MemoryStream(this.smbData.Trans2_Data)) { using (Channel channel = new Channel(null, memoryStream)) { channel.BeginWriteGroup(); channel.Write <uint>(this.trans2Data.GetExtendedAttributeList.SizeOfListInBytes); if (this.trans2Data.GetExtendedAttributeList.GEAList != null) { foreach (SMB_GEA smbQueryEa in this.trans2Data.GetExtendedAttributeList.GEAList) { channel.Write <byte>(smbQueryEa.AttributeNameLengthInBytes); if (smbQueryEa.AttributeName != null) { channel.WriteBytes(smbQueryEa.AttributeName); } } } channel.EndWriteGroup(); } } } else { this.smbData.Trans2_Data = new byte[0]; } }