public static void Serialize(Stream stream, MemberView instance) { int mask = 0; using (var bytes = new MemoryStream()) { if (instance.MemberItems != null) { ListProxy <int> .Serialize(bytes, instance.MemberItems, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize)); } else { mask |= 1; } if (instance.MemberWallet != null) { MemberWalletViewProxy.Serialize(bytes, instance.MemberWallet); } else { mask |= 2; } if (instance.PublicProfile != null) { PublicProfileViewProxy.Serialize(bytes, instance.PublicProfile); } else { mask |= 4; } Int32Proxy.Serialize(stream, ~mask); bytes.WriteTo(stream); } }
public byte[] GetInventory(byte[] data) { var inputStream = new MemoryStream(data); var steamId = Encoding.UTF8.GetString(Convert.FromBase64String(StringProxy.Deserialize(inputStream))); List <ItemInventoryView> instance = null; if (inventoryData.ContainsKey(steamId) && inventoryData[steamId] != null) { instance = inventoryData[steamId]; } else { instance = new List <ItemInventoryView> { new ItemInventoryView { ItemId = 1, AmountRemaining = -1 }, new ItemInventoryView { ItemId = 12, AmountRemaining = -1 } }; inventoryData[steamId] = instance; UpdateInventoryData(); } var outputStream = new MemoryStream(); ListProxy <ItemInventoryView> .Serialize(outputStream, instance, ItemInventoryViewProxy.Serialize); return(outputStream.ToArray()); }
public static void Serialize(Stream stream, AccountCompletionResultView instance) { int mask = 0; using (var bytes = new MemoryStream()) { if (instance.ItemsAttributed != null) { DictionaryProxy <int, int> .Serialize(bytes, instance.ItemsAttributed, Int32Proxy.Serialize, Int32Proxy.Serialize); } else { mask |= 1; } if (instance.NonDuplicateNames != null) { ListProxy <string> .Serialize(bytes, instance.NonDuplicateNames, StringProxy.Serialize); } else { mask |= 2; } Int32Proxy.Serialize(bytes, instance.Result); Int32Proxy.Serialize(stream, ~mask); bytes.WriteTo(stream); } }
byte[] IApplicationWebServiceContract.GetMaps(byte[] data) { try { using (var bytes = new MemoryStream(data)) { var version = StringProxy.Deserialize(bytes); var definitionType = EnumProxy <DefinitionType> .Deserialize(bytes); var view = OnGetMaps(version, definitionType); using (var outBytes = new MemoryStream()) { ListProxy <MapView> .Serialize(outBytes, view, MapViewProxy.Serialize); return(outBytes.ToArray()); } } } catch (Exception ex) { Log.Error("Unable to handle GetMaps request:"); Log.Error(ex); return(null); } }
public byte[] GetMaps(byte[] data) { var outputStream = new MemoryStream(); ListProxy <MapView> .Serialize(outputStream, mapData, MapViewProxy.Serialize); return(outputStream.ToArray()); }
public static void Serialize(Stream stream, LuckyDrawUnityView instance) { int mask = 0; using (var bytes = new MemoryStream()) { EnumProxy <BundleCategoryType> .Serialize(bytes, instance.Category); if (instance.Description != null) { StringProxy.Serialize(bytes, instance.Description); } else { mask |= 1; } if (instance.IconUrl != null) { StringProxy.Serialize(bytes, instance.IconUrl); } else { mask |= 2; } Int32Proxy.Serialize(bytes, instance.Id); BooleanProxy.Serialize(bytes, instance.IsAvailableInShop); if (instance.LuckyDrawSets != null) { ListProxy <LuckyDrawSetUnityView> .Serialize(bytes, instance.LuckyDrawSets, new ListProxy <LuckyDrawSetUnityView> .Serializer <LuckyDrawSetUnityView>(LuckyDrawSetUnityViewProxy.Serialize)); } else { mask |= 4; } if (instance.Name != null) { StringProxy.Serialize(bytes, instance.Name); } else { mask |= 8; } Int32Proxy.Serialize(bytes, instance.Price); EnumProxy <UberStrikeCurrencyType> .Serialize(bytes, instance.UberStrikeCurrencyType); Int32Proxy.Serialize(stream, ~mask); bytes.WriteTo(stream); } }
public static void Serialize(Stream stream, AuthenticateApplicationView instance) { int mask = 0; using (var bytes = new MemoryStream()) { if (instance.CommServer != null) { PhotonViewProxy.Serialize(bytes, instance.CommServer); } else { mask |= 1; } if (instance.EncryptionInitVector != null) { StringProxy.Serialize(bytes, instance.EncryptionInitVector); } else { mask |= 2; } if (instance.EncryptionPassPhrase != null) { StringProxy.Serialize(bytes, instance.EncryptionPassPhrase); } else { mask |= 4; } if (instance.GameServers != null) { ListProxy <PhotonView> .Serialize(bytes, instance.GameServers, PhotonViewProxy.Serialize); } else { mask |= 8; } BooleanProxy.Serialize(bytes, instance.IsEnabled); BooleanProxy.Serialize(bytes, instance.WarnPlayer); Int32Proxy.Serialize(stream, ~mask); bytes.WriteTo(stream); } }
// Token: 0x0600118C RID: 4492 RVA: 0x0001CA28 File Offset: 0x0001AC28 public static Coroutine GetFacebookFriendsList(List <string> facebookIds, Action <List <PublicProfileView> > callback, Action <Exception> handler) { Coroutine result; using (MemoryStream memoryStream = new MemoryStream()) { ListProxy <string> .Serialize(memoryStream, facebookIds, new ListProxy <string> .Serializer <string>(StringProxy.Serialize)); result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IFacebookWebServiceContract", "FacebookWebService", "GetFacebookFriendsList", memoryStream.ToArray(), delegate(byte[] data) { if (callback != null) { callback(ListProxy <PublicProfileView> .Deserialize(new MemoryStream(data), new ListProxy <PublicProfileView> .Deserializer <PublicProfileView>(PublicProfileViewProxy.Deserialize))); } }, handler)); } return(result); }
// Token: 0x060011FB RID: 4603 RVA: 0x0001E160 File Offset: 0x0001C360 public static Coroutine GetMemberListSessionData(List <string> authTokens, Action <List <MemberSessionDataView> > callback, Action <Exception> handler) { Coroutine result; using (MemoryStream memoryStream = new MemoryStream()) { ListProxy <string> .Serialize(memoryStream, authTokens, new ListProxy <string> .Serializer <string>(StringProxy.Serialize)); result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IUserWebServiceContract", "UserWebService", "GetMemberListSessionData", memoryStream.ToArray(), delegate(byte[] data) { if (callback != null) { callback(ListProxy <MemberSessionDataView> .Deserialize(new MemoryStream(data), new ListProxy <MemberSessionDataView> .Deserializer <MemberSessionDataView>(MemberSessionDataViewProxy.Deserialize))); } }, handler)); } return(result); }
// Token: 0x06001275 RID: 4725 RVA: 0x0001F1AC File Offset: 0x0001D3AC public void SendSetContactList(List <int> cmids) { using (MemoryStream memoryStream = new MemoryStream()) { ListProxy <int> .Serialize(memoryStream, cmids, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize)); Dictionary <byte, object> customOpParameters = new Dictionary <byte, object> { { this.__id, memoryStream.ToArray() } }; if (this.sendOperation != null) { this.sendOperation(24, customOpParameters, true, 0, false); } } }
// Token: 0x06001271 RID: 4721 RVA: 0x0001EFB4 File Offset: 0x0001D1B4 public void SendSpeedhackDetectionNew(List <float> timeDifferences) { using (MemoryStream memoryStream = new MemoryStream()) { ListProxy <float> .Serialize(memoryStream, timeDifferences, new ListProxy <float> .Serializer <float>(SingleProxy.Serialize)); Dictionary <byte, object> customOpParameters = new Dictionary <byte, object> { { this.__id, memoryStream.ToArray() } }; if (this.sendOperation != null) { this.sendOperation(20, customOpParameters, true, 0, false); } } }
// Token: 0x060012C6 RID: 4806 RVA: 0x0002032C File Offset: 0x0001E52C public void SendPowerUpRespawnTimes(List <ushort> respawnTimes) { using (MemoryStream memoryStream = new MemoryStream()) { ListProxy <ushort> .Serialize(memoryStream, respawnTimes, new ListProxy <ushort> .Serializer <ushort>(UInt16Proxy.Serialize)); Dictionary <byte, object> customOpParameters = new Dictionary <byte, object> { { this.__id, memoryStream.ToArray() } }; if (this.sendOperation != null) { this.sendOperation(3, customOpParameters, true, 0, false); } } }
public static void Serialize(Stream stream, UberStrikeItemShopClientView instance) { int mask = 0; using (var bytes = new MemoryStream()) { if (instance.FunctionalItems != null) { ListProxy <UberStrikeItemFunctionalView> .Serialize(bytes, instance.FunctionalItems, UberStrikeItemFunctionalViewProxy.Serialize); } else { mask |= 1; } if (instance.GearItems != null) { ListProxy <UberStrikeItemGearView> .Serialize(bytes, instance.GearItems, UberStrikeItemGearViewProxy.Serialize); } else { mask |= 2; } if (instance.QuickItems != null) { ListProxy <UberStrikeItemQuickView> .Serialize(bytes, instance.QuickItems, UberStrikeItemQuickViewProxy.Serialize); } else { mask |= 4; } if (instance.WeaponItems != null) { ListProxy <UberStrikeItemWeaponView> .Serialize(bytes, instance.WeaponItems, UberStrikeItemWeaponViewProxy.Serialize); } else { mask |= 8; } Int32Proxy.Serialize(stream, ~mask); bytes.WriteTo(stream); } }
// Token: 0x06001269 RID: 4713 RVA: 0x0001EBF0 File Offset: 0x0001CDF0 public void SendChatMessageToClan(List <int> clanMembers, string message) { using (MemoryStream memoryStream = new MemoryStream()) { ListProxy <int> .Serialize(memoryStream, clanMembers, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize)); StringProxy.Serialize(memoryStream, message); Dictionary <byte, object> customOpParameters = new Dictionary <byte, object> { { this.__id, memoryStream.ToArray() } }; if (this.sendOperation != null) { this.sendOperation(12, customOpParameters, true, 0, false); } } }
// Token: 0x06001272 RID: 4722 RVA: 0x0001F034 File Offset: 0x0001D234 public void SendPlayersReported(List <int> cmids, int type, string details, string logs) { using (MemoryStream memoryStream = new MemoryStream()) { ListProxy <int> .Serialize(memoryStream, cmids, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize)); Int32Proxy.Serialize(memoryStream, type); StringProxy.Serialize(memoryStream, details); StringProxy.Serialize(memoryStream, logs); Dictionary <byte, object> customOpParameters = new Dictionary <byte, object> { { this.__id, memoryStream.ToArray() } }; if (this.sendOperation != null) { this.sendOperation(21, customOpParameters, true, 0, false); } } }
// Token: 0x060012CA RID: 4810 RVA: 0x0002051C File Offset: 0x0001E71C public void SendSpawnPositions(TeamID team, List <Vector3> positions, List <byte> rotations) { using (MemoryStream memoryStream = new MemoryStream()) { EnumProxy <TeamID> .Serialize(memoryStream, team); ListProxy <Vector3> .Serialize(memoryStream, positions, new ListProxy <Vector3> .Serializer <Vector3>(Vector3Proxy.Serialize)); ListProxy <byte> .Serialize(memoryStream, rotations, new ListProxy <byte> .Serializer <byte>(ByteProxy.Serialize)); Dictionary <byte, object> customOpParameters = new Dictionary <byte, object> { { this.__id, memoryStream.ToArray() } }; if (this.sendOperation != null) { this.sendOperation(7, customOpParameters, true, 0, false); } } }
public static void Serialize(Stream stream, LuckyDrawSetUnityView instance) { int mask = 0; using (var bytes = new MemoryStream()) { Int32Proxy.Serialize(bytes, instance.CreditsAttributed); BooleanProxy.Serialize(bytes, instance.ExposeItemsToPlayers); Int32Proxy.Serialize(bytes, instance.Id); if (instance.ImageUrl != null) { StringProxy.Serialize(bytes, instance.ImageUrl); } else { mask |= 1; } Int32Proxy.Serialize(bytes, instance.LuckyDrawId); if (instance.LuckyDrawSetItems != null) { ListProxy <BundleItemView> .Serialize(bytes, instance.LuckyDrawSetItems, BundleItemViewProxy.Serialize); } else { mask |= 2; } Int32Proxy.Serialize(bytes, instance.PointsAttributed); Int32Proxy.Serialize(bytes, instance.SetWeight); Int32Proxy.Serialize(stream, ~mask); bytes.WriteTo(stream); } }
byte[] IUserWebServiceContract.GetInventory(byte[] data) { try { using (var bytes = new MemoryStream(data)) { var authToken = StringProxy.Deserialize(bytes); var view = OnGetInventory(authToken); using (var outBytes = new MemoryStream()) { ListProxy <ItemInventoryView> .Serialize(outBytes, view, ItemInventoryViewProxy.Serialize); return(outBytes.ToArray()); } } } catch (Exception ex) { Log.Error("Unable to handle GetInventory request:"); Log.Error(ex); return(null); } }
public static void Serialize(Stream stream, UberStrikeItemQuickView instance) { int mask = 0; using (var bytes = new MemoryStream()) { EnumProxy <QuickItemLogic> .Serialize(bytes, instance.BehaviourType); Int32Proxy.Serialize(bytes, instance.CoolDownTime); if (instance.CustomProperties != null) { DictionaryProxy <string, string> .Serialize(bytes, instance.CustomProperties, StringProxy.Serialize, StringProxy.Serialize); } else { mask |= 1; } if (instance.Description != null) { StringProxy.Serialize(bytes, instance.Description); } else { mask |= 2; } Int32Proxy.Serialize(bytes, instance.ID); BooleanProxy.Serialize(bytes, instance.IsConsumable); EnumProxy <UberStrikeItemClass> .Serialize(bytes, instance.ItemClass); if (instance.ItemProperties != null) { DictionaryProxy <ItemPropertyType, int> .Serialize(bytes, instance.ItemProperties, EnumProxy <ItemPropertyType> .Serialize, Int32Proxy.Serialize); } else { mask |= 4; } Int32Proxy.Serialize(bytes, instance.LevelLock); Int32Proxy.Serialize(bytes, instance.MaxDurationDays); Int32Proxy.Serialize(bytes, instance.MaxOwnableAmount); if (instance.Name != null) { StringProxy.Serialize(bytes, instance.Name); } else { mask |= 8; } if (instance.PrefabName != null) { StringProxy.Serialize(bytes, instance.PrefabName); } else { mask |= 16; } if (instance.Prices != null) { ListProxy <ItemPriceView> .Serialize(bytes, instance.Prices, ItemPriceViewProxy.Serialize); } else { mask |= 32; } EnumProxy <ItemShopHighlightType> .Serialize(bytes, instance.ShopHighlightType); Int32Proxy.Serialize(bytes, instance.UsesPerGame); Int32Proxy.Serialize(bytes, instance.UsesPerLife); Int32Proxy.Serialize(bytes, instance.UsesPerRound); Int32Proxy.Serialize(bytes, instance.WarmUpTime); Int32Proxy.Serialize(stream, ~mask); bytes.WriteTo(stream); } }
public static void Serialize(Stream stream, UberStrikeItemFunctionalView instance) { int mask = 0; using (var bytes = new MemoryStream()) { if (instance.CustomProperties != null) { DictionaryProxy <string, string> .Serialize(bytes, instance.CustomProperties, new DictionaryProxy <string, string> .Serializer <string>(StringProxy.Serialize), new DictionaryProxy <string, string> .Serializer <string>(StringProxy.Serialize)); } else { mask |= 1; } if (instance.Description != null) { StringProxy.Serialize(bytes, instance.Description); } else { mask |= 2; } Int32Proxy.Serialize(bytes, instance.ID); BooleanProxy.Serialize(bytes, instance.IsConsumable); EnumProxy <UberStrikeItemClass> .Serialize(bytes, instance.ItemClass); if (instance.ItemProperties != null) { DictionaryProxy <ItemPropertyType, int> .Serialize(bytes, instance.ItemProperties, EnumProxy <ItemPropertyType> .Serialize, Int32Proxy.Serialize); } else { mask |= 4; } Int32Proxy.Serialize(bytes, instance.LevelLock); Int32Proxy.Serialize(bytes, instance.MaxDurationDays); if (instance.Name != null) { StringProxy.Serialize(bytes, instance.Name); } else { mask |= 8; } if (instance.PrefabName != null) { StringProxy.Serialize(bytes, instance.PrefabName); } else { mask |= 16; } if (instance.Prices != null) { ListProxy <ItemPriceView> .Serialize(bytes, instance.Prices, ItemPriceViewProxy.Serialize); } else { mask |= 32; } EnumProxy <ItemShopHighlightType> .Serialize(bytes, instance.ShopHighlightType); Int32Proxy.Serialize(stream, ~mask); bytes.WriteTo(stream); } }
public static void Serialize(Stream stream, GameActorInfoDeltaView 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[GameActorInfoDeltaView.Keys.AccessLevel])); } if ((instance.DeltaMask & 2) != 0) { ByteProxy.Serialize(stream, (byte)instance.Changes[GameActorInfoDeltaView.Keys.ArmorPointCapacity]); } if ((instance.DeltaMask & 4) != 0) { ByteProxy.Serialize(stream, (byte)instance.Changes[GameActorInfoDeltaView.Keys.ArmorPoints]); } if ((instance.DeltaMask & 8) != 0) { EnumProxy <ChannelType> .Serialize(stream, (ChannelType)((int)instance.Changes[GameActorInfoDeltaView.Keys.Channel])); } if ((instance.DeltaMask & 16) != 0) { StringProxy.Serialize(stream, (string)instance.Changes[GameActorInfoDeltaView.Keys.ClanTag]); } if ((instance.DeltaMask & 32) != 0) { Int32Proxy.Serialize(stream, (int)instance.Changes[GameActorInfoDeltaView.Keys.Cmid]); } if ((instance.DeltaMask & 64) != 0) { EnumProxy <FireMode> .Serialize(stream, (FireMode)((int)instance.Changes[GameActorInfoDeltaView.Keys.CurrentFiringMode])); } if ((instance.DeltaMask & 128) != 0) { ByteProxy.Serialize(stream, (byte)instance.Changes[GameActorInfoDeltaView.Keys.CurrentWeaponSlot]); } if ((instance.DeltaMask & 256) != 0) { Int16Proxy.Serialize(stream, (short)instance.Changes[GameActorInfoDeltaView.Keys.Deaths]); } if ((instance.DeltaMask & 512) != 0) { ListProxy <int> .Serialize(stream, (List <int>) instance.Changes[GameActorInfoDeltaView.Keys.FunctionalItems], Int32Proxy.Serialize); } if ((instance.DeltaMask & 1024) != 0) { ListProxy <int> .Serialize(stream, (List <int>) instance.Changes[GameActorInfoDeltaView.Keys.Gear], Int32Proxy.Serialize); } if ((instance.DeltaMask & 2048) != 0) { Int16Proxy.Serialize(stream, (short)instance.Changes[GameActorInfoDeltaView.Keys.Health]); } if ((instance.DeltaMask & 4096) != 0) { Int16Proxy.Serialize(stream, (short)instance.Changes[GameActorInfoDeltaView.Keys.Kills]); } if ((instance.DeltaMask & 8192) != 0) { Int32Proxy.Serialize(stream, (int)instance.Changes[GameActorInfoDeltaView.Keys.Level]); } if ((instance.DeltaMask & 16384) != 0) { UInt16Proxy.Serialize(stream, (ushort)instance.Changes[GameActorInfoDeltaView.Keys.Ping]); } if ((instance.DeltaMask & 32768) != 0) { ByteProxy.Serialize(stream, (byte)instance.Changes[GameActorInfoDeltaView.Keys.PlayerId]); } if ((instance.DeltaMask & 65536) != 0) { StringProxy.Serialize(stream, (string)instance.Changes[GameActorInfoDeltaView.Keys.PlayerName]); } if ((instance.DeltaMask & 131072) != 0) { EnumProxy <PlayerStates> .Serialize(stream, (PlayerStates)((byte)instance.Changes[GameActorInfoDeltaView.Keys.PlayerState])); } if ((instance.DeltaMask & 262144) != 0) { ListProxy <int> .Serialize(stream, (List <int>) instance.Changes[GameActorInfoDeltaView.Keys.QuickItems], Int32Proxy.Serialize); } if ((instance.DeltaMask & 524288) != 0) { ByteProxy.Serialize(stream, (byte)instance.Changes[GameActorInfoDeltaView.Keys.Rank]); } if ((instance.DeltaMask & 1048576) != 0) { ColorProxy.Serialize(stream, (Color)instance.Changes[GameActorInfoDeltaView.Keys.SkinColor]); } if ((instance.DeltaMask & 2097152) != 0) { EnumProxy <SurfaceType> .Serialize(stream, (SurfaceType)((int)instance.Changes[GameActorInfoDeltaView.Keys.StepSound])); } if ((instance.DeltaMask & 4194304) != 0) { EnumProxy <TeamID> .Serialize(stream, (TeamID)((int)instance.Changes[GameActorInfoDeltaView.Keys.TeamID])); } if ((instance.DeltaMask & 8388608) != 0) { ListProxy <int> .Serialize(stream, (List <int>) instance.Changes[GameActorInfoDeltaView.Keys.Weapons], Int32Proxy.Serialize); } } else { Int32Proxy.Serialize(stream, 0); } }
public static void Serialize(Stream stream, UberStrikeItemWeaponView instance) { int mask = 0; using (var bytes = new MemoryStream()) { Int32Proxy.Serialize(bytes, instance.AccuracySpread); Int32Proxy.Serialize(bytes, instance.CombatRange); Int32Proxy.Serialize(bytes, instance.CriticalStrikeBonus); if (instance.CustomProperties != null) { DictionaryProxy <string, string> .Serialize(bytes, instance.CustomProperties, new DictionaryProxy <string, string> .Serializer <string>(StringProxy.Serialize), new DictionaryProxy <string, string> .Serializer <string>(StringProxy.Serialize)); } else { mask |= 1; } Int32Proxy.Serialize(bytes, instance.DamageKnockback); Int32Proxy.Serialize(bytes, instance.DamagePerProjectile); Int32Proxy.Serialize(bytes, instance.DefaultZoomMultiplier); if (instance.Description != null) { StringProxy.Serialize(bytes, instance.Description); } else { mask |= 2; } BooleanProxy.Serialize(bytes, instance.HasAutomaticFire); Int32Proxy.Serialize(bytes, instance.ID); BooleanProxy.Serialize(bytes, instance.IsConsumable); EnumProxy <UberStrikeItemClass> .Serialize(bytes, instance.ItemClass); if (instance.ItemProperties != null) { DictionaryProxy <ItemPropertyType, int> .Serialize(bytes, instance.ItemProperties, EnumProxy <ItemPropertyType> .Serialize, Int32Proxy.Serialize); } else { mask |= 4; } Int32Proxy.Serialize(bytes, instance.LevelLock); Int32Proxy.Serialize(bytes, instance.MaxAmmo); Int32Proxy.Serialize(bytes, instance.MaxDurationDays); Int32Proxy.Serialize(bytes, instance.MaxZoomMultiplier); Int32Proxy.Serialize(bytes, instance.MinZoomMultiplier); Int32Proxy.Serialize(bytes, instance.MissileBounciness); Int32Proxy.Serialize(bytes, instance.MissileForceImpulse); Int32Proxy.Serialize(bytes, instance.MissileTimeToDetonate); if (instance.Name != null) { StringProxy.Serialize(bytes, instance.Name); } else { mask |= 8; } if (instance.PrefabName != null) { StringProxy.Serialize(bytes, instance.PrefabName); } else { mask |= 16; } if (instance.Prices != null) { ListProxy <ItemPriceView> .Serialize(bytes, instance.Prices, ItemPriceViewProxy.Serialize); } else { mask |= 32; } Int32Proxy.Serialize(bytes, instance.ProjectileSpeed); Int32Proxy.Serialize(bytes, instance.ProjectilesPerShot); Int32Proxy.Serialize(bytes, instance.RateOfFire); Int32Proxy.Serialize(bytes, instance.RecoilKickback); Int32Proxy.Serialize(bytes, instance.RecoilMovement); Int32Proxy.Serialize(bytes, instance.SecondaryActionReticle); EnumProxy <ItemShopHighlightType> .Serialize(bytes, instance.ShopHighlightType); Int32Proxy.Serialize(bytes, instance.SplashRadius); Int32Proxy.Serialize(bytes, instance.StartAmmo); Int32Proxy.Serialize(bytes, instance.Tier); Int32Proxy.Serialize(bytes, instance.WeaponSecondaryAction); Int32Proxy.Serialize(stream, ~mask); bytes.WriteTo(stream); } }
public static void Serialize(Stream stream, GameActorInfoView instance) { int mask = 0; using (var bytes = new MemoryStream()) { EnumProxy <MemberAccessLevel> .Serialize(bytes, instance.AccessLevel); ByteProxy.Serialize(bytes, instance.ArmorPointCapacity); ByteProxy.Serialize(bytes, instance.ArmorPoints); EnumProxy <ChannelType> .Serialize(bytes, instance.Channel); if (instance.ClanTag != null) { StringProxy.Serialize(bytes, instance.ClanTag); } else { mask |= 1; } Int32Proxy.Serialize(bytes, instance.Cmid); EnumProxy <FireMode> .Serialize(bytes, instance.CurrentFiringMode); ByteProxy.Serialize(bytes, instance.CurrentWeaponSlot); Int16Proxy.Serialize(bytes, instance.Deaths); if (instance.FunctionalItems != null) { ListProxy <int> .Serialize(bytes, instance.FunctionalItems, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize)); } else { mask |= 2; } if (instance.Gear != null) { ListProxy <int> .Serialize(bytes, instance.Gear, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize)); } else { mask |= 4; } Int16Proxy.Serialize(bytes, instance.Health); Int16Proxy.Serialize(bytes, instance.Kills); Int32Proxy.Serialize(bytes, instance.Level); UInt16Proxy.Serialize(bytes, instance.Ping); ByteProxy.Serialize(bytes, instance.PlayerId); if (instance.PlayerName != null) { StringProxy.Serialize(bytes, instance.PlayerName); } else { mask |= 8; } EnumProxy <PlayerStates> .Serialize(bytes, instance.PlayerState); if (instance.QuickItems != null) { ListProxy <int> .Serialize(bytes, instance.QuickItems, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize)); } else { mask |= 16; } ByteProxy.Serialize(bytes, instance.Rank); ColorProxy.Serialize(bytes, instance.SkinColor); EnumProxy <SurfaceType> .Serialize(bytes, instance.StepSound); EnumProxy <TeamID> .Serialize(bytes, instance.TeamID); if (instance.Weapons != null) { ListProxy <int> .Serialize(bytes, instance.Weapons, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize)); } else { mask |= 32; } Int32Proxy.Serialize(stream, ~mask); bytes.WriteTo(stream); } }