示例#1
0
 public static void Serialize(Stream stream, AddNotification instance)
 {
     if (instance.HasSelf)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.Self.GetSerializedSize());
         bnet.protocol.channel.Member.Serialize(stream, instance.Self);
     }
     if (instance.Member.get_Count() > 0)
     {
         using (List <Member> .Enumerator enumerator = instance.Member.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Member current = enumerator.get_Current();
                 stream.WriteByte(18);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.channel.Member.Serialize(stream, current);
             }
         }
     }
     if (instance.ChannelState == null)
     {
         throw new ArgumentNullException("ChannelState", "Required by proto specification.");
     }
     stream.WriteByte(26);
     ProtocolParser.WriteUInt32(stream, instance.ChannelState.GetSerializedSize());
     ChannelState.Serialize(stream, instance.ChannelState);
 }
示例#2
0
 public static void Serialize(Stream stream, AddNotification instance)
 {
     if (instance.HasSelf)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.Self.GetSerializedSize());
         bnet.protocol.channel.Member.Serialize(stream, instance.Self);
     }
     if (instance.Member.Count > 0)
     {
         foreach (Member member in instance.Member)
         {
             stream.WriteByte(18);
             ProtocolParser.WriteUInt32(stream, member.GetSerializedSize());
             bnet.protocol.channel.Member.Serialize(stream, member);
         }
     }
     if (instance.ChannelState == null)
     {
         throw new ArgumentNullException("ChannelState", "Required by proto specification.");
     }
     stream.WriteByte(26);
     ProtocolParser.WriteUInt32(stream, instance.ChannelState.GetSerializedSize());
     ChannelState.Serialize(stream, instance.ChannelState);
 }
示例#3
0
 public static void Serialize(Stream stream, UpdateChannelStateNotification instance)
 {
     if (instance.HasAgentId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
         EntityId.Serialize(stream, instance.AgentId);
     }
     if (instance.StateChange == null)
     {
         throw new ArgumentNullException("StateChange", "Required by proto specification.");
     }
     stream.WriteByte(18);
     ProtocolParser.WriteUInt32(stream, instance.StateChange.GetSerializedSize());
     ChannelState.Serialize(stream, instance.StateChange);
 }
 public static void Serialize(Stream stream, CreateChannelRequest instance)
 {
     if (instance.HasAgentIdentity)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentIdentity.GetSerializedSize());
         Identity.Serialize(stream, instance.AgentIdentity);
     }
     if (instance.HasMemberState)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.MemberState.GetSerializedSize());
         MemberState.Serialize(stream, instance.MemberState);
     }
     if (instance.HasChannelState)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteUInt32(stream, instance.ChannelState.GetSerializedSize());
         ChannelState.Serialize(stream, instance.ChannelState);
     }
     if (instance.HasChannelId)
     {
         stream.WriteByte(34);
         ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize());
         EntityId.Serialize(stream, instance.ChannelId);
     }
     if (instance.HasObjectId)
     {
         stream.WriteByte(40);
         ProtocolParser.WriteUInt64(stream, instance.ObjectId);
     }
     if (instance.HasLocalAgent)
     {
         stream.WriteByte(50);
         ProtocolParser.WriteUInt32(stream, instance.LocalAgent.GetSerializedSize());
         EntityId.Serialize(stream, instance.LocalAgent);
     }
     if (instance.HasLocalMemberState)
     {
         stream.WriteByte(58);
         ProtocolParser.WriteUInt32(stream, instance.LocalMemberState.GetSerializedSize());
         MemberState.Serialize(stream, instance.LocalMemberState);
     }
 }
示例#5
0
 public static void Serialize(Stream stream, ChannelDescription instance)
 {
     if (instance.ChannelId == null)
     {
         throw new ArgumentNullException("ChannelId", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize());
     EntityId.Serialize(stream, instance.ChannelId);
     if (instance.HasCurrentMembers)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteUInt32(stream, instance.CurrentMembers);
     }
     if (instance.HasState)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteUInt32(stream, instance.State.GetSerializedSize());
         ChannelState.Serialize(stream, instance.State);
     }
 }
示例#6
0
 public void Serialize(Stream stream)
 {
     ChannelState.Serialize(stream, this);
 }