Esempio n. 1
0
 // Token: 0x060010C9 RID: 4297 RVA: 0x00017288 File Offset: 0x00015488
 public static void Serialize(Stream stream, ConnectionAddress instance)
 {
     using (MemoryStream memoryStream = new MemoryStream())
     {
         Int32Proxy.Serialize(memoryStream, instance.Ipv4);
         UInt16Proxy.Serialize(memoryStream, instance.Port);
         memoryStream.WriteTo(stream);
     }
 }
Esempio n. 2
0
 // Token: 0x060010B5 RID: 4277 RVA: 0x00015D0C File Offset: 0x00013F0C
 public static void Serialize(Stream stream, GameActorInfoDelta instance)
 {
     if (instance != null)
     {
         Int32Proxy.Serialize(stream, instance.DeltaMask);
         ByteProxy.Serialize(stream, instance.Id);
         if ((instance.DeltaMask & 1) != 0)
         {
             EnumProxy <MemberAccessLevel> .Serialize(stream, (MemberAccessLevel)((int)instance.Changes[GameActorInfoDelta.Keys.AccessLevel]));
         }
         if ((instance.DeltaMask & 2) != 0)
         {
             ByteProxy.Serialize(stream, (byte)instance.Changes[GameActorInfoDelta.Keys.ArmorPointCapacity]);
         }
         if ((instance.DeltaMask & 4) != 0)
         {
             ByteProxy.Serialize(stream, (byte)instance.Changes[GameActorInfoDelta.Keys.ArmorPoints]);
         }
         if ((instance.DeltaMask & 8) != 0)
         {
             EnumProxy <ChannelType> .Serialize(stream, (ChannelType)((int)instance.Changes[GameActorInfoDelta.Keys.Channel]));
         }
         if ((instance.DeltaMask & 16) != 0)
         {
             StringProxy.Serialize(stream, (string)instance.Changes[GameActorInfoDelta.Keys.ClanTag]);
         }
         if ((instance.DeltaMask & 32) != 0)
         {
             Int32Proxy.Serialize(stream, (int)instance.Changes[GameActorInfoDelta.Keys.Cmid]);
         }
         if ((instance.DeltaMask & 64) != 0)
         {
             EnumProxy <FireMode> .Serialize(stream, (FireMode)((int)instance.Changes[GameActorInfoDelta.Keys.CurrentFiringMode]));
         }
         if ((instance.DeltaMask & 128) != 0)
         {
             ByteProxy.Serialize(stream, (byte)instance.Changes[GameActorInfoDelta.Keys.CurrentWeaponSlot]);
         }
         if ((instance.DeltaMask & 256) != 0)
         {
             Int16Proxy.Serialize(stream, (short)instance.Changes[GameActorInfoDelta.Keys.Deaths]);
         }
         if ((instance.DeltaMask & 512) != 0)
         {
             ListProxy <int> .Serialize(stream, (List <int>) instance.Changes[GameActorInfoDelta.Keys.FunctionalItems], new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize));
         }
         if ((instance.DeltaMask & 1024) != 0)
         {
             ListProxy <int> .Serialize(stream, (List <int>) instance.Changes[GameActorInfoDelta.Keys.Gear], new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize));
         }
         if ((instance.DeltaMask & 2048) != 0)
         {
             Int16Proxy.Serialize(stream, (short)instance.Changes[GameActorInfoDelta.Keys.Health]);
         }
         if ((instance.DeltaMask & 4096) != 0)
         {
             Int16Proxy.Serialize(stream, (short)instance.Changes[GameActorInfoDelta.Keys.Kills]);
         }
         if ((instance.DeltaMask & 8192) != 0)
         {
             Int32Proxy.Serialize(stream, (int)instance.Changes[GameActorInfoDelta.Keys.Level]);
         }
         if ((instance.DeltaMask & 16384) != 0)
         {
             UInt16Proxy.Serialize(stream, (ushort)instance.Changes[GameActorInfoDelta.Keys.Ping]);
         }
         if ((instance.DeltaMask & 32768) != 0)
         {
             ByteProxy.Serialize(stream, (byte)instance.Changes[GameActorInfoDelta.Keys.PlayerId]);
         }
         if ((instance.DeltaMask & 65536) != 0)
         {
             StringProxy.Serialize(stream, (string)instance.Changes[GameActorInfoDelta.Keys.PlayerName]);
         }
         if ((instance.DeltaMask & 131072) != 0)
         {
             EnumProxy <PlayerStates> .Serialize(stream, (PlayerStates)((byte)instance.Changes[GameActorInfoDelta.Keys.PlayerState]));
         }
         if ((instance.DeltaMask & 262144) != 0)
         {
             ListProxy <int> .Serialize(stream, (List <int>) instance.Changes[GameActorInfoDelta.Keys.QuickItems], new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize));
         }
         if ((instance.DeltaMask & 524288) != 0)
         {
             ByteProxy.Serialize(stream, (byte)instance.Changes[GameActorInfoDelta.Keys.Rank]);
         }
         if ((instance.DeltaMask & 1048576) != 0)
         {
             ColorProxy.Serialize(stream, (Color)instance.Changes[GameActorInfoDelta.Keys.SkinColor]);
         }
         if ((instance.DeltaMask & 2097152) != 0)
         {
             EnumProxy <SurfaceType> .Serialize(stream, (SurfaceType)((int)instance.Changes[GameActorInfoDelta.Keys.StepSound]));
         }
         if ((instance.DeltaMask & 4194304) != 0)
         {
             EnumProxy <TeamID> .Serialize(stream, (TeamID)((int)instance.Changes[GameActorInfoDelta.Keys.TeamID]));
         }
         if ((instance.DeltaMask & 8388608) != 0)
         {
             ListProxy <int> .Serialize(stream, (List <int>) instance.Changes[GameActorInfoDelta.Keys.Weapons], new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize));
         }
     }
     else
     {
         Int32Proxy.Serialize(stream, 0);
     }
 }
        // Token: 0x060010C1 RID: 4289 RVA: 0x00016B78 File Offset: 0x00014D78
        public static void Serialize(Stream stream, GameActorInfo instance)
        {
            int num = 0;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                EnumProxy <MemberAccessLevel> .Serialize(memoryStream, instance.AccessLevel);

                ByteProxy.Serialize(memoryStream, instance.ArmorPointCapacity);
                ByteProxy.Serialize(memoryStream, instance.ArmorPoints);
                EnumProxy <ChannelType> .Serialize(memoryStream, instance.Channel);

                if (instance.ClanTag != null)
                {
                    StringProxy.Serialize(memoryStream, instance.ClanTag);
                }
                else
                {
                    num |= 1;
                }
                Int32Proxy.Serialize(memoryStream, instance.Cmid);
                EnumProxy <FireMode> .Serialize(memoryStream, instance.CurrentFiringMode);

                ByteProxy.Serialize(memoryStream, instance.CurrentWeaponSlot);
                Int16Proxy.Serialize(memoryStream, instance.Deaths);
                if (instance.FunctionalItems != null)
                {
                    ListProxy <int> .Serialize(memoryStream, instance.FunctionalItems, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize));
                }
                else
                {
                    num |= 2;
                }
                if (instance.Gear != null)
                {
                    ListProxy <int> .Serialize(memoryStream, instance.Gear, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize));
                }
                else
                {
                    num |= 4;
                }
                Int16Proxy.Serialize(memoryStream, instance.Health);
                Int16Proxy.Serialize(memoryStream, instance.Kills);
                Int32Proxy.Serialize(memoryStream, instance.Level);
                UInt16Proxy.Serialize(memoryStream, instance.Ping);
                ByteProxy.Serialize(memoryStream, instance.PlayerId);
                if (instance.PlayerName != null)
                {
                    StringProxy.Serialize(memoryStream, instance.PlayerName);
                }
                else
                {
                    num |= 8;
                }
                EnumProxy <PlayerStates> .Serialize(memoryStream, instance.PlayerState);

                if (instance.QuickItems != null)
                {
                    ListProxy <int> .Serialize(memoryStream, instance.QuickItems, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize));
                }
                else
                {
                    num |= 16;
                }
                ByteProxy.Serialize(memoryStream, instance.Rank);
                ColorProxy.Serialize(memoryStream, instance.SkinColor);
                EnumProxy <SurfaceType> .Serialize(memoryStream, instance.StepSound);

                EnumProxy <TeamID> .Serialize(memoryStream, instance.TeamID);

                if (instance.Weapons != null)
                {
                    ListProxy <int> .Serialize(memoryStream, instance.Weapons, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize));
                }
                else
                {
                    num |= 32;
                }
                Int32Proxy.Serialize(stream, ~num);
                memoryStream.WriteTo(stream);
            }
        }