Exemplo n.º 1
0
 // Token: 0x060010CA RID: 4298 RVA: 0x000172DC File Offset: 0x000154DC
 public static ConnectionAddress Deserialize(Stream bytes)
 {
     return(new ConnectionAddress
     {
         Ipv4 = Int32Proxy.Deserialize(bytes),
         Port = UInt16Proxy.Deserialize(bytes)
     });
 }
Exemplo n.º 2
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);
     }
 }
        // Token: 0x060010C2 RID: 4290 RVA: 0x00016D94 File Offset: 0x00014F94
        public static GameActorInfo Deserialize(Stream bytes)
        {
            int           num           = Int32Proxy.Deserialize(bytes);
            GameActorInfo gameActorInfo = new GameActorInfo();

            gameActorInfo.AccessLevel = EnumProxy <MemberAccessLevel> .Deserialize(bytes);

            gameActorInfo.ArmorPointCapacity = ByteProxy.Deserialize(bytes);
            gameActorInfo.ArmorPoints        = ByteProxy.Deserialize(bytes);
            gameActorInfo.Channel            = EnumProxy <ChannelType> .Deserialize(bytes);

            if ((num & 1) != 0)
            {
                gameActorInfo.ClanTag = StringProxy.Deserialize(bytes);
            }
            gameActorInfo.Cmid = Int32Proxy.Deserialize(bytes);
            gameActorInfo.CurrentFiringMode = EnumProxy <FireMode> .Deserialize(bytes);

            gameActorInfo.CurrentWeaponSlot = ByteProxy.Deserialize(bytes);
            gameActorInfo.Deaths            = Int16Proxy.Deserialize(bytes);
            if ((num & 2) != 0)
            {
                gameActorInfo.FunctionalItems = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
            }
            if ((num & 4) != 0)
            {
                gameActorInfo.Gear = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
            }
            gameActorInfo.Health   = Int16Proxy.Deserialize(bytes);
            gameActorInfo.Kills    = Int16Proxy.Deserialize(bytes);
            gameActorInfo.Level    = Int32Proxy.Deserialize(bytes);
            gameActorInfo.Ping     = UInt16Proxy.Deserialize(bytes);
            gameActorInfo.PlayerId = ByteProxy.Deserialize(bytes);
            if ((num & 8) != 0)
            {
                gameActorInfo.PlayerName = StringProxy.Deserialize(bytes);
            }
            gameActorInfo.PlayerState = EnumProxy <PlayerStates> .Deserialize(bytes);

            if ((num & 16) != 0)
            {
                gameActorInfo.QuickItems = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
            }
            gameActorInfo.Rank      = ByteProxy.Deserialize(bytes);
            gameActorInfo.SkinColor = ColorProxy.Deserialize(bytes);
            gameActorInfo.StepSound = EnumProxy <SurfaceType> .Deserialize(bytes);

            gameActorInfo.TeamID = EnumProxy <TeamID> .Deserialize(bytes);

            if ((num & 32) != 0)
            {
                gameActorInfo.Weapons = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
            }
            return(gameActorInfo);
        }
Exemplo n.º 4
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);
     }
 }
Exemplo n.º 5
0
        // Token: 0x060010B6 RID: 4278 RVA: 0x0001612C File Offset: 0x0001432C
        public static GameActorInfoDelta Deserialize(Stream bytes)
        {
            int  num = Int32Proxy.Deserialize(bytes);
            byte id  = ByteProxy.Deserialize(bytes);
            GameActorInfoDelta gameActorInfoDelta = new GameActorInfoDelta();

            gameActorInfoDelta.Id = id;
            if (num != 0)
            {
                if ((num & 1) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.AccessLevel] = EnumProxy <MemberAccessLevel> .Deserialize(bytes);
                }
                if ((num & 2) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.ArmorPointCapacity] = ByteProxy.Deserialize(bytes);
                }
                if ((num & 4) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.ArmorPoints] = ByteProxy.Deserialize(bytes);
                }
                if ((num & 8) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.Channel] = EnumProxy <ChannelType> .Deserialize(bytes);
                }
                if ((num & 16) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.ClanTag] = StringProxy.Deserialize(bytes);
                }
                if ((num & 32) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.Cmid] = Int32Proxy.Deserialize(bytes);
                }
                if ((num & 64) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.CurrentFiringMode] = EnumProxy <FireMode> .Deserialize(bytes);
                }
                if ((num & 128) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.CurrentWeaponSlot] = ByteProxy.Deserialize(bytes);
                }
                if ((num & 256) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.Deaths] = Int16Proxy.Deserialize(bytes);
                }
                if ((num & 512) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.FunctionalItems] = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
                }
                if ((num & 1024) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.Gear] = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
                }
                if ((num & 2048) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.Health] = Int16Proxy.Deserialize(bytes);
                }
                if ((num & 4096) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.Kills] = Int16Proxy.Deserialize(bytes);
                }
                if ((num & 8192) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.Level] = Int32Proxy.Deserialize(bytes);
                }
                if ((num & 16384) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.Ping] = UInt16Proxy.Deserialize(bytes);
                }
                if ((num & 32768) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.PlayerId] = ByteProxy.Deserialize(bytes);
                }
                if ((num & 65536) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.PlayerName] = StringProxy.Deserialize(bytes);
                }
                if ((num & 131072) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.PlayerState] = EnumProxy <PlayerStates> .Deserialize(bytes);
                }
                if ((num & 262144) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.QuickItems] = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
                }
                if ((num & 524288) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.Rank] = ByteProxy.Deserialize(bytes);
                }
                if ((num & 1048576) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.SkinColor] = ColorProxy.Deserialize(bytes);
                }
                if ((num & 2097152) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.StepSound] = EnumProxy <SurfaceType> .Deserialize(bytes);
                }
                if ((num & 4194304) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.TeamID] = EnumProxy <TeamID> .Deserialize(bytes);
                }
                if ((num & 8388608) != 0)
                {
                    gameActorInfoDelta.Changes[GameActorInfoDelta.Keys.Weapons] = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
                }
            }
            return(gameActorInfoDelta);
        }
        // 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);
            }
        }