public ChampionStatInfoList(ArrayCollection obj) : base(obj) { if (obj == null) { return; } foreach (var ao in obj) { Add(new ChampionStatInfo(ao as ASObject)); } }
public FellowPlayerInfoList(ArrayCollection obj) : base(obj) { if (obj == null) { return; } foreach (var ao in obj) { Add(new FellowPlayerInfo(ao as ASObject)); } }
public LeagueItemDTOList(ArrayCollection obj) : base(obj) { if (obj == null) { return; } foreach (var ao in obj) { Add(new LeagueItemDTO(ao as ASObject)); } }
public PlayerStatSummaryList(ArrayCollection obj) : base(obj) { if (obj == null) { return; } foreach (var ao in obj) { Add(new PlayerStatSummary(ao as ASObject)); } }
static void Main(string[] args) { ArrayCollection A = new ArrayCollection(10); A.add("A"); A.add("B"); A.add("C"); A.add("D"); A.add("E"); A.add("F"); A.remove("A"); Console.ReadLine(); }
public PlayerStatsSummaryList(ArrayCollection thebase) { Base = thebase; if (Base == null) { return; } foreach (var item in Base) { Add(new PlayerStatsSummary(item as ASObject)); } }
public SlotEntryList(ArrayCollection obj) : base(obj) { if (obj == null) { return; } foreach (var ao in obj) { Add(new SlotEntry(ao as ASObject)); } }
public AggregatedStatList(ArrayCollection obj) : base(obj) { if (obj == null) { return; } foreach (var ao in obj) { Add(new AggregatedStat(ao as ASObject)); } }
public GameItems(ArrayCollection body) { if (body == null) { throw new ArgumentNullException("body"); } Base = body; foreach (var item in body) { Add(Convert.ToInt32(item)); } }
public PlayerChampionSelectionDTOList(ArrayCollection thebase) { Base = thebase; if (Base == null) { return; } foreach (var item in Base) { Add(new PlayerChampionSelectionDTO(item as ASObject)); } }
public override KScriptObject GenerateKScriptObject(KScriptObject parentObject, XmlNode node) { var collection = new ArrayCollection(); if (!string.IsNullOrEmpty(node.InnerXml)) { collection = MultiArrayParser.ParseNode(node, KScript()); } KScript().GetMultidimensionalArrays().AddArray( node.Attributes["id"].Value, new ArrayBase(collection) ); return(parentObject); }
public bool DecodeData() { if (this._decoded) { return(!this.Broken); } this._decoded = true; System.IO.Stream stream = new System.IO.MemoryStream(this._rawData); using (AMFReader aMFReader = new AMFReader(stream)) { try { ASObject aSObject = (ASObject)aMFReader.ReadAMF3Data(); this.Ranked = (bool)aSObject["ranked"]; this.GameType = (aSObject["gameType"] as string); this.GameLength = uint.Parse(aSObject["gameLength"].ToString()); this.GameMode = (aSObject["gameMode"] as string); this.GameId = ulong.Parse(aSObject["gameId"].ToString()); ArrayCollection arrayCollection = aSObject["teamPlayerParticipantStats"] as ArrayCollection; ArrayCollection arrayCollection2 = aSObject["otherTeamPlayerParticipantStats"] as ArrayCollection; int arg_DB_0 = arrayCollection.Count; int arg_E3_0 = arrayCollection2.Count; this.Players = new System.Collections.Generic.List <PlayerStats>(); for (int i = 0; i < arrayCollection.Count; i++) { this.Players.Add(new PlayerStats(arrayCollection[i] as ASObject)); } for (int j = 0; j < arrayCollection2.Count; j++) { this.Players.Add(new PlayerStats(arrayCollection2[j] as ASObject)); } if (aSObject["myTeamInfo"] != null) { ASObject aSObject2 = aSObject["myTeamInfo"] as ASObject; this.BlueTeamInfo = string.Format("[{0}]{1}", aSObject2["tag"], aSObject2["name"]); aSObject2 = (aSObject["otherTeamInfo"] as ASObject); this.PurpleTeamInfo = string.Format("[{0}]{1}", aSObject2["tag"], aSObject2["name"]); } } catch (System.Exception) { this._broken = true; return(false); } } return(true); }
private void parse(string amf, string name) { byte[] bbb = StrToToHexByte(amf); AMFDeserializer ad = new AMFDeserializer(new MemoryStream(bbb)); AMFMessage message = ad.ReadAMFMessage(); string json = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(message); //Write that JSON to txt file File.WriteAllText(@"z:\temp\hotel\" + name + @".json", json); foreach (var body in message.Bodies) { object[] content = body.Content as object[]; RemotingMessage rm = content[0] as RemotingMessage; rm.messageId = Guid.NewGuid().ToString("D"); object[] bodys = rm.body as object[]; ASObject ab = bodys[2] as ASObject; ASObject masterBase = ab["masterBase"] as ASObject; masterBase["dep"] = DateTime.Now; masterBase["arr"] = DateTime.Now; masterBase["rsvMan"] = "马一一"; masterBase["cutoffDate"] = DateTime.Now; ASObject masterGuest = ab["masterGuest"] as ASObject; masterGuest["name"] = "马一一"; masterGuest["name2"] = "Ma Yi Yi"; masterGuest["sex"] = "1"; ArrayCollection rsvSrcList = ab["rsvSrcList"] as ArrayCollection; ASObject rsvObject = rsvSrcList[0] as ASObject; rsvObject["arrDate"] = DateTime.Now; rsvObject["depDate"] = DateTime.Now; rsvObject["rsvArrDate"] = DateTime.Now; rsvObject["rsvDepDate"] = DateTime.Now; rsvObject["negoRate"] = 268; rsvObject["oldRate"] = 268; rsvObject["realRate"] = 268; rsvObject["rackRate"] = 268; } }
public void WriteData(AMFWriter writer, object data) { if (data is IList) { //http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001104.html#270405 //http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001105.html#268711 if (writer.UseLegacyCollection) { writer.WriteByte(AMF3TypeCode.Array); writer.WriteAMF3Array(data as IList); } else { writer.WriteByte(AMF3TypeCode.Object); object value = new ArrayCollection(data as IList); writer.WriteAMF3Object(value); } return; } if (data is IDictionary) { writer.WriteByte(AMF3TypeCode.Object); writer.WriteAMF3Object(data); return; } if (data is Exception) { writer.WriteByte(AMF3TypeCode.Object); writer.WriteAMF3Object(new ExceptionASO(data as Exception)); return; } if (data is IExternalizable) { writer.WriteByte(AMF3TypeCode.Object); writer.WriteAMF3Object(data); return; } writer.WriteByte(AMF3TypeCode.Object); writer.WriteAMF3Object(data); }
static void AddComboBox(DisplayObjectContainer container, string label, int defval, Action <int> action, params string[] values) { AddLabel(container, label); var col = new ArrayCollection(); for (int i = 0; i < values.Length; ++i) { var item = avm.NewObject("label", values[i], "data", i); col.addItem(item); } var cb = new ComboBox(); cb.dataProvider = col; cb.selectedIndex = defval; cb.OnClose += e => { action(cb.selectedIndex); }; container.addChild(cb); }
public RemotingMessageReceivedEventArgs HandleMessage(object sender, RemotingMessageReceivedEventArgs e) { ArrayCollection champions = new ArrayCollection(); foreach (Champions champ in PoroServer._data.Champions) { var champDTO = new ChampionDTO { Owned = true, ChampionID = champ.id, Active = true, BotEnabled = true, RankedPlayEnabled = true }; champDTO.ChampionSkins = new ArrayCollection(); IEnumerable <ChampionSkinDTO> champSkinData = PoroServer._data.ChampionSkins.Where(x => x.championId == champ.id).Select(skins => new ChampionSkinDTO { ChampionID = champ.id, SkinID = skins.id, StillObtainable = true, Owned = true }); foreach (ChampionSkinDTO champion in champSkinData) { champDTO.ChampionSkins.Add(champion); } champions.Add(champDTO); } e.ReturnRequired = true; e.Data = champions; return(e); }
public RemotingMessageReceivedEventArgs HandleMessage(object sender, RemotingMessageReceivedEventArgs e) { ArrayCollection champions = new ArrayCollection(); /*foreach (Champions champ in PoroServer._data.Champions) * { * var champDTO = new ChampionDTO * { * Owned = true, * ChampionID = champ.id, * Active = true, * BotEnabled = true, * RankedPlayEnabled = true * }; * * champDTO.ChampionSkins = new ArrayCollection(); * * IEnumerable<ChampionSkinDTO> champSkinData = PoroServer._data.ChampionSkins.Where(x => x.championId == champ.id).Select(skins => new ChampionSkinDTO * { * ChampionID = champ.id, * SkinID = skins.id, * StillObtainable = true, * Owned = true * }); * * foreach (ChampionSkinDTO champion in champSkinData) * { * champDTO.ChampionSkins.Add(champion); * } * * champions.Add(champDTO); * }*/ e.ReturnRequired = true; e.Data = null; return(e); }
public void WriteData(AMFWriter writer, object data) { if (data is IList) { if (writer.UseLegacyCollection) { writer.WriteByte(9); writer.WriteAMF3Array(data as IList); } else { writer.WriteByte(10); object obj2 = new ArrayCollection(data as IList); writer.WriteAMF3Object(obj2); } } else if (data is IDictionary) { writer.WriteByte(10); writer.WriteAMF3Object(data); } else if (data is Exception) { writer.WriteByte(10); writer.WriteAMF3Object(new ExceptionASO(data as Exception)); } else if (data is IExternalizable) { writer.WriteByte(10); writer.WriteAMF3Object(data); } else { writer.WriteByte(10); writer.WriteAMF3Object(data); } }
public virtual object GetArray(ArrayCollection array) { if (array.Count < 1) { return(array); } if (!(array[0] is ASObject)) { return(array); } var first = GetObject((ASObject)array[0]); if (first == null) { return(null); } var list = (IList)Activator.CreateInstance(typeof(List <>).MakeGenericType(first.GetType())); foreach (var item in array) { if (item is ASObject) { var obj = GetObject((ASObject)item); if (obj == null) { continue; } list.Add(obj); } } return(list); }
private void BuildObjectTree(PacketTreeViewItem parent, object obj, string name, bool expand = false, bool isPath = true) { PacketTreeViewItem tvi = null; if (obj == null) { tvi = new PropertyValueTreeViewItem(parent, name, "null", isPath); } else if (obj is string) { tvi = new PropertyValueTreeViewItem(parent, name, EscapeString(obj as string), isPath); } else if (obj.GetType().IsArray) { object[] arr = obj as object[]; tvi = new PropertyObjectTreeViewItem(parent, name, "Array" + '[' + arr.Length.ToString() + "]", isPath); for (int i = 0; i < arr.Length; i++) { BuildObjectTree(tvi, arr[i], '[' + i.ToString() + ']'); } } else if (obj is ArrayCollection) { ArrayCollection col = obj as ArrayCollection; tvi = new PropertyObjectTreeViewItem(parent, name, "ArrayCollection" + '[' + col.Count.ToString() + "]", isPath); for (int i = 0; i < col.Count; i++) { BuildObjectTree(tvi, col[i], '[' + i.ToString() + ']'); } } else if (obj is ArrayList) { ArrayList col = obj as ArrayList; tvi = new PropertyObjectTreeViewItem(parent, name, "Array" + '[' + col.Count.ToString() + "]", isPath); for (int i = 0; i < col.Count; i++) { BuildObjectTree(tvi, col[i], '[' + i.ToString() + ']'); } } else if (obj is IDictionary <string, object> ) { IDictionary <string, object> dict = obj as IDictionary <string, object>; if (obj is AsObject) { tvi = new PropertyObjectTreeViewItem(parent, name, (obj as AsObject).TypeName, isPath); } else { tvi = new PropertyObjectTreeViewItem(parent, name, RiotSerializationContext.Instance.GetAlias(obj.GetType().GetGenericTypeDefinition().FullName), isPath); } foreach (var kv in dict) { BuildObjectTree(tvi, kv.Value, kv.Key); } } else if (obj is DateTime) { tvi = new PropertyValueTreeViewItem(parent, name, obj.ToString(), isPath); } else if (obj.GetType().Namespace == "System") { tvi = new PropertyValueTreeViewItem(parent, name, obj.ToString(), isPath); } else if (Attribute.IsDefined(obj.GetType(), typeof(SerializableAttribute))) { PropertyInfo[] pis = obj.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public); tvi = new PropertyObjectTreeViewItem(parent, name, RiotSerializationContext.Instance.GetAlias(obj.GetType().FullName), isPath); foreach (var prop in pis) { if (prop.CanRead && prop.GetIndexParameters().Length == 0 && !Attribute.IsDefined(prop, typeof(HiddenAttribute))) { string pname = null; SerializedNameAttribute[] attributes = (SerializedNameAttribute[])prop.GetCustomAttributes(typeof(SerializedNameAttribute), false); if (attributes.Length == 1) { pname = attributes[0].SerializedName; } else if (attributes.Length > 0) { foreach (var a in attributes) { if (a.Canonical) { pname = a.SerializedName; } } if (pname == null) { pname = attributes[0].SerializedName; } } else { pname = prop.Name; } BuildObjectTree(tvi, prop.GetValue(obj), pname); } } } if (tvi != null) { parent.Items.Add(tvi); tvi.IsNodeExpanded = expand; } }
public void WriteData(AMFWriter writer, object data) { if (data is ArrayCollection) { writer.WriteByte(AMF3TypeCode.Object); writer.WriteAMF3Object(data); return; } //TODO: configure somehow Vector support /* * if (CollectionUtils.IsGenericListType(data.GetType())) * { * Type itemType = ReflectionUtils.GetListItemType(data.GetType()); * switch (Type.GetTypeCode(itemType)) * { * case TypeCode.Int32: * writer.WriteByte(AMF3TypeCode.IntVector); * writer.WriteAMF3IntVector(data as IList<int>); * return; * case TypeCode.UInt32: * writer.WriteByte(AMF3TypeCode.UIntVector); * writer.WriteAMF3UIntVector(data as IList<uint>); * return; * case TypeCode.Double: * writer.WriteByte(AMF3TypeCode.NumberVector); * writer.WriteAMF3DoubleVector(data as IList<double>); * return; * case TypeCode.String: * writer.WriteByte(AMF3TypeCode.ObjectVector); * writer.WriteAMF3ObjectVector(data as IList<string>); * return; * case TypeCode.Boolean: * writer.WriteByte(AMF3TypeCode.ObjectVector); * writer.WriteAMF3ObjectVector(data as IList<bool>); * return; * default: * writer.WriteByte(AMF3TypeCode.ObjectVector); * writer.WriteAMF3ObjectVector(data as IList); * return; * } * } */ var list = data as IList; if (list != null) { //http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001104.html#270405 //http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001105.html#268711 if (writer.UseLegacyCollection) { writer.WriteByte(AMF3TypeCode.Array); writer.WriteAMF3Array(list); } else { writer.WriteByte(AMF3TypeCode.Object); object value = new ArrayCollection(list); writer.WriteAMF3Object(value); } return; } #if !(SILVERLIGHT) var listSource = data as IListSource; if (listSource != null) { if (writer.UseLegacyCollection) { writer.WriteByte(AMF3TypeCode.Array); writer.WriteAMF3Array(listSource.GetList()); } else { writer.WriteByte(AMF3TypeCode.Object); object value = new ArrayCollection(listSource.GetList()); writer.WriteAMF3Object(value); } return; } #endif var dictionary = data as IDictionary; if (dictionary != null) { //writer.WriteByte(AMF3TypeCode.Object); //writer.WriteAMF3Object(data); writer.WriteByte(AMF3TypeCode.Array); writer.WriteAMF3AssociativeArray(dictionary); return; } if (data is Exception) { writer.WriteByte(AMF3TypeCode.Object); if (writer.UseLegacyThrowable) { writer.WriteAMF3Object(new ASExceptionObject(data as Exception)); } else { writer.WriteAMF3Object(data); } return; } if (data is IExternalizable) { writer.WriteByte(AMF3TypeCode.Object); writer.WriteAMF3Object(data); return; } if (data is IEnumerable) { var enumerator = (data as IEnumerable).GetEnumerator(); #if !(NET_1_1) var tmp = new List <object>(); #else ArrayList tmp = new ArrayList(); #endif foreach (var element in (data as IEnumerable)) { tmp.Add(element); } if (writer.UseLegacyCollection) { writer.WriteByte(AMF3TypeCode.Array); writer.WriteAMF3Array(tmp); } else { writer.WriteByte(AMF3TypeCode.Object); object value = new ArrayCollection(tmp); writer.WriteAMF3Object(value); } return; } writer.WriteByte(AMF3TypeCode.Object); writer.WriteAMF3Object(data); }
/// <summary> /// Sets the fields of the object and decode/parse into correct fields. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="obj">The obj.</param> /// <param name="result">The result.</param> /// <exception cref="System.NotSupportedException"></exception> public void SetFields <T>(T obj, TypedObject result) { if (result == null) { return; } foreach (var prop in typeof(T).GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { var intern = prop.GetCustomAttributes(typeof(InternalNameAttribute), false).FirstOrDefault() as InternalNameAttribute; if (intern == null) { continue; } object value; var type = prop.PropertyType; if (!result.TryGetValue(intern.Name, out value)) { continue; } try { if (type.Equals(typeof(string))) { value = Convert.ToString(result[intern.Name]); } else if (type.Equals(typeof(Int32))) { value = Convert.ToInt32(result[intern.Name]); } else if (type.Equals(typeof(Int64))) { value = Convert.ToInt64(result[intern.Name]); } else if (type.Equals(typeof(double))) { value = Convert.ToInt64(result[intern.Name]); } else if (type.Equals(typeof(bool))) { value = Convert.ToBoolean(result[intern.Name]); } else if (type.Equals(typeof(DateTime))) { value = result[intern.Name]; } else if (type.Equals(typeof(TypedObject))) { value = (TypedObject)result[intern.Name]; } else if (type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(List <>))) { object[] temp = result.GetArray(intern.Name); // Create List<T> with correct T type by reflection Type elementType = type.GetGenericArguments()[0]; var genericListType = typeof(List <>).MakeGenericType(new[] { elementType }); IList objectList = (IList)Activator.CreateInstance(genericListType); foreach (object data in temp) { if (elementType.Equals(typeof(string))) { objectList.Add((string)data); } else { objectList.Add(Activator.CreateInstance(elementType, data)); } } value = objectList; } else if (type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Dictionary <,>))) { TypedObject to = result.GetTO(intern.Name); Type[] elementTypes = type.GetGenericArguments(); var genericDictionaryType = typeof(Dictionary <,>).MakeGenericType(elementTypes); IDictionary objectDictionary = (IDictionary)Activator.CreateInstance(genericDictionaryType); foreach (string key in to.Keys) { objectDictionary.Add(key, Activator.CreateInstance(elementTypes[1], to[key])); } value = objectDictionary; } else if (type.Equals(typeof(object[]))) { value = new ArrayCollection(result.GetArray(intern.Name)); } else if (type.Equals(typeof(object))) { value = result[intern.Name]; } else { try { value = Activator.CreateInstance(type, result[intern.Name]); } catch (Exception e) { throw new NotSupportedException(string.Format("Type {0} not supported by flash serializer", type.FullName), e); } } prop.SetValue(obj, value, null); } catch { } } }
public RemotingMessageReceivedEventArgs HandleMessage(object sender, RemotingMessageReceivedEventArgs e) { ArrayCollection data = new ArrayCollection { new GameQueueConfig { BlockedMinutesThreshold = 60, Ranked = false, MinimumParticipantListSize = 1, MaxLevel = 100, ThresholdEnabled = false, GameTypeConfigId = 1, MinLevel = 3, QueueState = "ON", Type = "NORMAL", CacheName = "matching-queue-NORMAL-5x5-game-queue", Id = 2.0, QueueBonusKey = "normalQueueBonuses", MaxSummonerLevelForFWOTD = 100, QueueStateString = "ON", PointsConfigKey = "normalSummonersRift", TeamOnly = false, MinimumQueueDodgeDelayTime = 8000, RandomizeTeamSides = false, SupportedMapIds = new ArrayCollection { 11 }, GameMode = "CLASSIC", TypeString = "NORMAL", NumPlayersPerTeam = 5, DisallowFreeChampions = false, MaximumParticipantListSize = 5, MapSelectionAlgorithm = "FIRST", BotsCanSpawnOnBlueSide = true, GameMutators = new ArrayCollection { "MapMusic(Bilgewater)" }, ThresholdSize = 2147483647.0, MatchingThrottleConfig = new MatchingThrottleConfig { CacheName = "", Limit = 2147483647.0, MatchingThrottleProperties = new ArrayCollection() } }, new GameQueueConfig { BlockedMinutesThreshold = 75, Ranked = true, MinimumParticipantListSize = 1, MaxLevel = 100, ThresholdEnabled = false, GameTypeConfigId = 2, MinLevel = 30, QueueState = "ON", Type = "RANKED_SOLO_5x5", CacheName = "matching-queue-RANKED_SOLO-5x5-game-queue", Id = 4.0, QueueBonusKey = "normalQueueBonuses", MaxSummonerLevelForFWOTD = 100, QueueStateString = "ON", PointsConfigKey = "rankedSummonersRift", TeamOnly = false, MinimumQueueDodgeDelayTime = 8000, RandomizeTeamSides = false, SupportedMapIds = new ArrayCollection { 11 }, GameMode = "CLASSIC", TypeString = "RANKED_SOLO_5x5", NumPlayersPerTeam = 5, DisallowFreeChampions = true, MaximumParticipantListSize = 2, MapSelectionAlgorithm = "FIRST", BotsCanSpawnOnBlueSide = true, GameMutators = new ArrayCollection { "MapMusic(Bilgewater)", "NOCLARITY" }, ThresholdSize = 2147483647.0, MatchingThrottleConfig = new MatchingThrottleConfig { CacheName = "", Limit = 2147483647.0, MatchingThrottleProperties = new ArrayCollection() } }, new GameQueueConfig { BlockedMinutesThreshold = 60, Ranked = false, MinimumParticipantListSize = 1, MaxLevel = 30, ThresholdEnabled = false, GameTypeConfigId = 4, MinLevel = 5, QueueState = "ON", Type = "ARAM_UNRANKED_5x5", CacheName = "matching-queue-BILGEWATER_ARAM-5x5-game-queue", Id = 100.0, QueueBonusKey = "ARAMQueueBonuses", MaxSummonerLevelForFWOTD = 100, QueueStateString = "ON", PointsConfigKey = "normalARAM", TeamOnly = false, MinimumQueueDodgeDelayTime = 8000, RandomizeTeamSides = true, SupportedMapIds = new ArrayCollection { 14 }, GameMode = "ARAM", TypeString = "ARAM_UNRANKED_5x5", NumPlayersPerTeam = 5, DisallowFreeChampions = false, MaximumParticipantListSize = 5, MapSelectionAlgorithm = "LAST", BotsCanSpawnOnBlueSide = true, GameMutators = new ArrayCollection { "ReRoll", "BattleBoost" }, ThresholdSize = 2147483647.0, MatchingThrottleConfig = new MatchingThrottleConfig { CacheName = "", Limit = 2147483647.0, MatchingThrottleProperties = new ArrayCollection() } }, new GameQueueConfig { BlockedMinutesThreshold = 60, Ranked = false, MinimumParticipantListSize = 1, MaxLevel = 30, ThresholdEnabled = false, GameTypeConfigId = 1, MinLevel = 0, QueueState = "ON", Type = "BOT", CacheName = "matching-queue-BOT_INTRO-5x5-game-queue", Id = 31.0, QueueBonusKey = "matchedBotsQueueBonuses", MaxSummonerLevelForFWOTD = 9, QueueStateString = "ON", PointsConfigKey = "coOpVsAiSummonersRift", TeamOnly = false, MinimumQueueDodgeDelayTime = 8000, RandomizeTeamSides = true, SupportedMapIds = new ArrayCollection { 11 }, GameMode = "CLASSIC", TypeString = "BOT", NumPlayersPerTeam = 5, DisallowFreeChampions = false, MaximumParticipantListSize = 5, MapSelectionAlgorithm = "FIRST", BotsCanSpawnOnBlueSide = false, GameMutators = new ArrayCollection { "OnboardCoopBeginner", "LearningQuests", "MapMusic(Bilgewater)" }, ThresholdSize = 2147483647.0, MatchingThrottleConfig = new MatchingThrottleConfig { CacheName = "", Limit = 2147483647.0, MatchingThrottleProperties = new ArrayCollection() } }, new GameQueueConfig { BlockedMinutesThreshold = 60, Ranked = false, MinimumParticipantListSize = 1, MaxLevel = 30, ThresholdEnabled = false, GameTypeConfigId = 1, MinLevel = 0, QueueState = "ON", Type = "BOT", CacheName = "matching-queue-BOT_EASY-5x5-game-queue", Id = 32.0, QueueBonusKey = "matchedBotsQueueBonuses", MaxSummonerLevelForFWOTD = 100, QueueStateString = "ON", PointsConfigKey = "coOpVsAiSummonersRift", TeamOnly = false, MinimumQueueDodgeDelayTime = 8000, RandomizeTeamSides = true, SupportedMapIds = new ArrayCollection { 11 }, GameMode = "CLASSIC", TypeString = "BOT", NumPlayersPerTeam = 5, DisallowFreeChampions = false, MaximumParticipantListSize = 5, MapSelectionAlgorithm = "FIRST", BotsCanSpawnOnBlueSide = false, GameMutators = new ArrayCollection { "AdvancedLearningQuests", "MapMusic(Bilgewater)" }, ThresholdSize = 2147483647.0, MatchingThrottleConfig = new MatchingThrottleConfig { CacheName = "", Limit = 2147483647.0, MatchingThrottleProperties = new ArrayCollection() } }, new GameQueueConfig { BlockedMinutesThreshold = 60, Ranked = false, MinimumParticipantListSize = 1, MaxLevel = 30, ThresholdEnabled = false, GameTypeConfigId = 1, MinLevel = 0, QueueState = "ON", Type = "BOT", CacheName = "matching-queue-BOT_MEDIUM-5x5-game-queue", Id = 33.0, QueueBonusKey = "matchedBotsQueueBonuses", MaxSummonerLevelForFWOTD = 100, QueueStateString = "ON", PointsConfigKey = "coOpVsAiSummonersRift", TeamOnly = false, MinimumQueueDodgeDelayTime = 8000, RandomizeTeamSides = true, SupportedMapIds = new ArrayCollection { 11 }, GameMode = "CLASSIC", TypeString = "BOT", NumPlayersPerTeam = 5, DisallowFreeChampions = false, MaximumParticipantListSize = 5, MapSelectionAlgorithm = "FIRST", BotsCanSpawnOnBlueSide = false, GameMutators = new ArrayCollection { "AdvancedLearningQuests", "MapMusic(Bilgewater)" }, ThresholdSize = 2147483647.0, MatchingThrottleConfig = new MatchingThrottleConfig { CacheName = "", Limit = 2147483647.0, MatchingThrottleProperties = new ArrayCollection() } }, new GameQueueConfig { BlockedMinutesThreshold = 75, Ranked = true, MinimumParticipantListSize = 5, MaxLevel = 100, ThresholdEnabled = false, GameTypeConfigId = 2, MinLevel = 30, QueueState = "ON", Type = "RANKED_TEAM_5x5", CacheName = "matching-queue-RANKED_TEAM-5x5-game-queue", Id = 42.0, QueueBonusKey = "normalQueueBonuses", MaxSummonerLevelForFWOTD = 100, QueueStateString = "ON", PointsConfigKey = "rankedSummonersRift", TeamOnly = true, MinimumQueueDodgeDelayTime = 8000, RandomizeTeamSides = true, SupportedMapIds = new ArrayCollection { 11 }, GameMode = "CLASSIC", TypeString = "RANKED_TEAM_5x5", NumPlayersPerTeam = 5, DisallowFreeChampions = false, MaximumParticipantListSize = 5, MapSelectionAlgorithm = "FIRST", BotsCanSpawnOnBlueSide = false, GameMutators = new ArrayCollection { "MapMusic(Bilgewater)", "NOCLARITY" }, ThresholdSize = 2147483647.0, MatchingThrottleConfig = new MatchingThrottleConfig { CacheName = "", Limit = 2147483647.0, MatchingThrottleProperties = new ArrayCollection() } }, new GameQueueConfig { BlockedMinutesThreshold = 75, Ranked = false, MinimumParticipantListSize = 5, MaxLevel = 100, ThresholdEnabled = false, GameTypeConfigId = 12, MinLevel = 25, QueueState = "ON", Type = "CAP_5x5", CacheName = "matching-queue-GROUP_FINDER-5x5-game-queue", Id = 61.0, QueueBonusKey = "normalQueueBonuses", MaxSummonerLevelForFWOTD = 100, QueueStateString = "ON", PointsConfigKey = "normalSummonersRift", TeamOnly = false, MinimumQueueDodgeDelayTime = 8000, RandomizeTeamSides = true, SupportedMapIds = new ArrayCollection { 11 }, GameMode = "CLASSIC", TypeString = "CAP_5x5", NumPlayersPerTeam = 5, DisallowFreeChampions = false, MaximumParticipantListSize = 5, MapSelectionAlgorithm = "FIRST", BotsCanSpawnOnBlueSide = true, GameMutators = new ArrayCollection { "MapMusic(Bilgewater)" }, ThresholdSize = 2147483647.0, MatchingThrottleConfig = new MatchingThrottleConfig { CacheName = "", Limit = 2147483647.0, MatchingThrottleProperties = new ArrayCollection() } }, new GameQueueConfig { BlockedMinutesThreshold = 60, Ranked = false, MinimumParticipantListSize = 1, MaxLevel = 30, ThresholdEnabled = false, GameTypeConfigId = 16, MinLevel = 10, QueueState = "ON", Type = "BILGEWATER", CacheName = "matching-queue-BILGEWATER-5x5-game-queue", Id = 313.0, QueueBonusKey = "normalQueueBonuses", MaxSummonerLevelForFWOTD = 100, QueueStateString = "ON", PointsConfigKey = "normalSummonersRift", TeamOnly = false, MinimumQueueDodgeDelayTime = 8000, RandomizeTeamSides = true, SupportedMapIds = new ArrayCollection { 11 }, GameMode = "CLASSIC", TypeString = "BILGEWATER", NumPlayersPerTeam = 5, DisallowFreeChampions = false, MaximumParticipantListSize = 5, MapSelectionAlgorithm = "FIRST", BotsCanSpawnOnBlueSide = true, GameMutators = new ArrayCollection { "Bilgewater" }, ThresholdSize = 2147483647.0, MatchingThrottleConfig = new MatchingThrottleConfig { CacheName = "", Limit = 2147483647.0, MatchingThrottleProperties = new ArrayCollection() } }, }; e.ReturnRequired = true; e.Data = data; return(e); }
public ArrayCollectionIterator(ArrayCollection collection) { this.collection = collection; currentIndex = 0; }
/// <summary> /// This type supports the infrastructure and is not intended to be used directly from your code. /// </summary> /// <param name="context">An ITypeDescriptorContext that provides a format context.</param> /// <param name="culture">A CultureInfo object. If a null reference (Nothing in Visual Basic) is passed, the current culture is assumed.</param> /// <param name="value">The Object to convert.</param> /// <param name="destinationType">The Type to convert the value parameter to.</param> /// <returns>An Object that represents the converted value.</returns> public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { ArrayCollection ac = value as ArrayCollection; ValidationUtils.ArgumentNotNull(ac, "value"); if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (destinationType == typeof(ArrayCollection)) { return(value); } if (destinationType.IsArray) { return(ac.ToArray()); } #if !SILVERLIGHT if (destinationType == typeof(ArrayList)) { if (ac.List is ArrayList) { return(ac.List); } return(ArrayList.Adapter(ac.List)); } #endif if (destinationType == typeof(IList)) { return(ac.List); } //generic interface Type typeGenericICollection = destinationType.GetInterface("System.Collections.Generic.ICollection`1", false); if (typeGenericICollection != null) { object obj = TypeHelper.CreateInstance(destinationType); MethodInfo miAddCollection = typeGenericICollection.GetMethod("Add"); if (miAddCollection != null) { ParameterInfo[] parameters = miAddCollection.GetParameters(); if (parameters != null && parameters.Length == 1) { Type parameterType = parameters[0].ParameterType; IList list = (IList)value; for (int i = 0; i < list.Count; i++) { miAddCollection.Invoke(obj, new object[] { TypeHelper.ChangeType(list[i], parameterType) }); } return(obj); } } } Type typeIList = destinationType.GetInterface("System.Collections.IList", false); if (typeIList != null) { object obj = TypeHelper.CreateInstance(destinationType); IList list = obj as IList; for (int i = 0; i < ac.List.Count; i++) { list.Add(ac.List[i]); } return(obj); } #if !SILVERLIGHT return(base.ConvertTo(context, culture, value, destinationType)); #else return(base.ConvertTo(value, destinationType)); #endif }
public static void InitMasteryAndRuneTree() { Dictionary <string, int> _masterySort = new Dictionary <string, int> { { "Ferocity", 1 }, { "Cunning", 2 }, { "Resolve", 3 } }; Console.WriteLine("[LOG] Initialize Mastery and Rune Tree"); using (WebClient client = new WebClient()) { //Download the latest mastery daata string MasteryData = client.DownloadString("http://ddragon.leagueoflegends.com/cdn/6.24.1/data/en_US/mastery.json"); Masteries mData = JsonConvert.DeserializeObject <Masteries>(MasteryData); TalentTree = new ArrayCollection(); //Parse the data and convert it into a type that is sent in the LoginDataPacket foreach (var mastery in mData.tree) { TalentGroup group = new TalentGroup { Name = mastery.Key, TalentRows = new ArrayCollection(), TltGroupId = _masterySort[mastery.Key], Index = _masterySort[mastery.Key] - 1 }; for (int i = 0; i < mastery.Value.Count; i++) { ArrayCollection talentList = new ArrayCollection(); List <MasteryLite> masteryList = mastery.Value[i]; for (int j = 0; j < masteryList.Count; j++) { if (masteryList[j] == null) { continue; } var data = mData.data[masteryList[j].masteryId]; Talent t = new Talent { Index = j, Name = data.name, Level1Desc = data.name, Level2Desc = data.name, Level3Desc = data.name, Level4Desc = data.name, Level5Desc = data.name, GameCode = data.id, TltId = data.id, MaxRank = data.ranks, MinLevel = 1, MinTier = 1, TalentGroupId = group.TltGroupId, TalentRowId = (i + 1) * group.TltGroupId }; if (data.preReq != "0") { t.PrereqTalentGameCode = Convert.ToInt32(data.preReq); } talentList.Add(t); } TalentRow row = new TalentRow { Index = i, Talents = talentList, PointsToActivate = i * 4, TltRowId = (i + 1) * group.TltGroupId, TltGroupId = group.TltGroupId }; group.TalentRows.Add(row); } TalentTree.Add(group); } #region Rune Loading RuneTree = new ArrayCollection(); //This code is... bad. int Modifier = 0; //Skip 10, 20, 30 int Take = 3; //Take one each loop and it will increase what it starts from (1 - 2 - 3) //Loop from 1-9 and do it 3 times to generate the red, yellow and blue runes for (int i = 1; i <= 9; i++) { //At 10, 20 and 30 you need to increment the min level. if ((i - 1) % 3 == 0 && i != 1) { Modifier += 1; } //The id goes past 9 so add the required amount that we have looped int IdAdd = (Math.Abs(Take - 3) * 10); //Take the amount that it has gone over IdAdd -= Math.Abs(Take - 3); RuneSlot slot = new RuneSlot() { Id = IdAdd + i, RuneType = new RuneType(), MinLevel = (3 * i + 1) - Take + Modifier }; if (Take == 3) { slot.RuneType.Name = "Red"; slot.RuneType.Id = 1; } else if (Take == 2) { slot.RuneType.Name = "Yellow"; slot.RuneType.Id = 3; } else { slot.RuneType.Name = "Blue"; slot.RuneType.Id = 5; } RuneTree.Add(slot); //Re do the loop, reset the modifier and take one from the take so the min level starts off one integer higher than last time if (i == 9 && Take > 1) { Take -= 1; i = 0; Modifier = 0; } } //Add black runes for (int i = 1; i <= 3; i++) { RuneSlot slot = new RuneSlot() { Id = 27 + i, //Start id from 27 since thats where we left off RuneType = new RuneType { Id = 7, Name = "Black" }, MinLevel = 10 * i }; RuneTree.Add(slot); } #endregion } }
public void WriteData(AMFWriter writer, object data) { if (data is ArrayCollection) { writer.WriteByte(AMF3TypeCode.Object); writer.WriteAMF3Object(data); return; } //TODO: configure somehow Vector support /* if (CollectionUtils.IsGenericListType(data.GetType())) { Type itemType = ReflectionUtils.GetListItemType(data.GetType()); switch (Type.GetTypeCode(itemType)) { case TypeCode.Int32: writer.WriteByte(AMF3TypeCode.IntVector); writer.WriteAMF3IntVector(data as IList<int>); return; case TypeCode.UInt32: writer.WriteByte(AMF3TypeCode.UIntVector); writer.WriteAMF3UIntVector(data as IList<uint>); return; case TypeCode.Double: writer.WriteByte(AMF3TypeCode.NumberVector); writer.WriteAMF3DoubleVector(data as IList<double>); return; case TypeCode.String: writer.WriteByte(AMF3TypeCode.ObjectVector); writer.WriteAMF3ObjectVector(data as IList<string>); return; case TypeCode.Boolean: writer.WriteByte(AMF3TypeCode.ObjectVector); writer.WriteAMF3ObjectVector(data as IList<bool>); return; default: writer.WriteByte(AMF3TypeCode.ObjectVector); writer.WriteAMF3ObjectVector(data as IList); return; } } */ IList list = data as IList; if (list != null) { //http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001104.html#270405 //http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001105.html#268711 if (writer.UseLegacyCollection) { writer.WriteByte(AMF3TypeCode.Array); writer.WriteAMF3Array(list); } else { writer.WriteByte(AMF3TypeCode.Object); object value = new ArrayCollection(list); writer.WriteAMF3Object(value); } return; } #if !(SILVERLIGHT) IListSource listSource = data as IListSource; if (listSource != null) { if (writer.UseLegacyCollection) { writer.WriteByte(AMF3TypeCode.Array); writer.WriteAMF3Array(listSource.GetList()); } else { writer.WriteByte(AMF3TypeCode.Object); object value = new ArrayCollection(listSource.GetList()); writer.WriteAMF3Object(value); } return; } #endif IDictionary dictionary = data as IDictionary; if (dictionary != null) { //writer.WriteByte(AMF3TypeCode.Object); //writer.WriteAMF3Object(data); writer.WriteByte(AMF3TypeCode.Array); writer.WriteAMF3AssociativeArray(dictionary); return; } if (data is Exception) { writer.WriteByte(AMF3TypeCode.Object); if (writer.UseLegacyThrowable) writer.WriteAMF3Object(new ExceptionASO(data as Exception)); else writer.WriteAMF3Object(data); return; } if (data is IExternalizable) { writer.WriteByte(AMF3TypeCode.Object); writer.WriteAMF3Object(data); return; } if (data is IEnumerable) { IEnumerator enumerator = (data as IEnumerable).GetEnumerator(); #if !(NET_1_1) List<object> tmp = new List<object>(); #else ArrayList tmp = new ArrayList(); #endif foreach (object element in (data as IEnumerable)) { tmp.Add(element); } if (writer.UseLegacyCollection) { writer.WriteByte(AMF3TypeCode.Array); writer.WriteAMF3Array(tmp); } else { writer.WriteByte(AMF3TypeCode.Object); object value = new ArrayCollection(tmp); writer.WriteAMF3Object(value); } return; } writer.WriteByte(AMF3TypeCode.Object); writer.WriteAMF3Object(data); }
/// <summary> /// Load the data for packets for League of Legends on patcher launch /// </summary> public void LoadData() { //Only load the data once if (_hasLoaded) { return; } _hasLoaded = true; //Load the gameStats from the client (the client location is loaded when the patcher runes) SQLiteConnection conn = new SQLiteConnection(Path.Combine(PoroServer.ClientLocation, "assets", "data", "gameStats", "gameStats_en_US.sqlite")); //Generate the champion list Champions = (from s in conn.Table <Champions>() orderby s.name select s).ToList(); //Generate the champion skin list ChampionSkins = (from s in conn.Table <ChampionSkins>() select s).ToList(); //Close the SQLite connection conn.Close(); using (WebClient client = new WebClient()) { //Download latest ddragon string Versions = client.DownloadString("http://ddragon.leagueoflegends.com/realms/euw.js"); //Get the ddragon version Versions = Versions.Replace(";", "").Replace("Riot.DDragon.m=", ""); JObject DDragonObject = JsonConvert.DeserializeObject <JObject>(Versions); JObject DDragonVersions = DDragonObject["n"] as JObject; //Download the latest mastery daata string MasteryVersion = DDragonVersions["mastery"].ToString(); string MasteryData = client.DownloadString(string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/data/en_US/mastery.json", MasteryVersion)); #region Mastery loading Masteries mData = JsonConvert.DeserializeObject <Masteries>(MasteryData); TalentTree = new ArrayCollection(); //Parse the data and convert it into a type that is sent in the LoginDataPacket foreach (KeyValuePair <string, List <List <MasteryLite> > > mastery in mData.tree) { TalentGroup group = new TalentGroup { Name = mastery.Key, TalentRows = new ArrayCollection(), TltGroupId = _masterySort[mastery.Key], Index = _masterySort[mastery.Key] - 1 }; for (int i = 0; i < mastery.Value.Count; i++) { ArrayCollection talentList = new ArrayCollection(); List <MasteryLite> masteryList = mastery.Value[i]; for (int j = 0; j < masteryList.Count; j++) { if (masteryList[j] == null) { continue; } var data = mData.data[Convert.ToInt32(masteryList[j].masteryId)]; Talent t = new Talent { Index = j, Name = data.name, Level1Desc = data.name, Level2Desc = data.name, Level3Desc = data.name, Level4Desc = data.name, Level5Desc = data.name, GameCode = data.id, TltId = data.id, MaxRank = data.ranks, MinLevel = 1, MinTier = 1, TalentGroupId = group.TltGroupId, TalentRowId = (i + 1) * group.TltGroupId }; if (data.preReq != "0") { t.PrereqTalentGameCode = Convert.ToInt32(data.preReq); } talentList.Add(t); } TalentRow row = new TalentRow { Index = i, Talents = talentList, PointsToActivate = i * 4, TltRowId = (i + 1) * group.TltGroupId, TltGroupId = group.TltGroupId }; group.TalentRows.Add(row); } TalentTree.Add(group); } #endregion #region Rune Loading RuneTree = new ArrayCollection(); //This code is... bad. int Modifier = 0; //Skip 10, 20, 30 int Take = 3; //Take one each loop and it will increase what it starts from (1 - 2 - 3) //Loop from 1-9 and do it 3 times to generate the red, yellow and blue runes for (int i = 1; i <= 9; i++) { //At 10, 20 and 30 you need to increment the min level. if ((i - 1) % 3 == 0 && i != 1) { Modifier += 1; } //The id goes past 9 so add the required amount that we have looped int IdAdd = (Math.Abs(Take - 3) * 10); //Take the amount that it has gone over IdAdd -= Math.Abs(Take - 3); RuneSlot slot = new RuneSlot() { Id = IdAdd + i, RuneType = new RuneType(), MinLevel = (3 * i + 1) - Take + Modifier }; if (Take == 3) { slot.RuneType.Name = "Red"; slot.RuneType.Id = 1; } else if (Take == 2) { slot.RuneType.Name = "Yellow"; slot.RuneType.Id = 3; } else { slot.RuneType.Name = "Blue"; slot.RuneType.Id = 5; } RuneTree.Add(slot); //Re do the loop, reset the modifier and take one from the take so the min level starts off one integer higher than last time if (i == 9 && Take > 1) { Take -= 1; i = 0; Modifier = 0; } } //Add black runes for (int i = 1; i <= 3; i++) { RuneSlot slot = new RuneSlot() { Id = 27 + i, //Start id from 27 since thats where we left off RuneType = new RuneType { Id = 7, Name = "Black" }, MinLevel = 10 * i }; RuneTree.Add(slot); } #endregion } Console.WriteLine("[LOG] Loaded League of Legends Data"); }
public BaseList(ArrayCollection obj) { Base = obj; }