Пример #1
0
 public void Pack(BinaryWriter writer)
 {
     log.Debug("Pack");
     writer.Write(SeqID);
     writer.Write((uint)Header);
     writer.Write(Checksum);
     writer.Write(RecId);
     writer.Write(Interval);
     writer.Write(DataLen);
     writer.Write(Iteration);
     if ((Header & PacketHeaderFlags.ServerSwitch) != 0)
     {
         ServerSwitchData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.Referral) != 0)
     {
         ReferralData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.NegativeAck) != 0)
     {
         NegativeAckData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.EmptyAck) != 0)
     {
         EmptyAckData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.PositiveAck) != 0)
     {
         PositiveAckData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.LoginRequest) != 0)
     {
         LoginRequestData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.ServerSwitchRequest) != 0)
     {
         ServerSwitchRequestData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.ConnectRequest) != 0)
     {
         ConnectRequestData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.ConnectResponse) != 0)
     {
         ConnectResponseData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.NetError) != 0)
     {
         NetErrorData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.CloseConnection) != 0)
     {
         CloseConnectionData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.CICMDCommand) != 0)
     {
         CicmdData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.TimeSync) != 0)
     {
         TimeSyncData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.EchoRequest) != 0)
     {
         EchoRequestData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.EchoResponse) != 0)
     {
         EchoResponseData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.Flow) != 0)
     {
         FlowData.Pack(writer);
     }
     if ((Header & PacketHeaderFlags.BlobFragments) != 0)
     {
         foreach (var fragment in Fragments)
         {
             fragment.Pack(writer);
         }
     }
 }