public void Load() { var projectSolutionPath = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory())); var xDoc = new XmlDocument(); xDoc.Load(projectSolutionPath + "\\Config\\figuredata.xml"); var colors = xDoc.GetElementsByTagName("colors"); foreach (XmlNode node in colors) { foreach (XmlNode child in node.ChildNodes) { _palettes.Add(Convert.ToInt32(child.Attributes["id"].Value), new Palette(Convert.ToInt32(child.Attributes["id"].Value))); foreach (XmlNode sub in child.ChildNodes) { _palettes[Convert.ToInt32(child.Attributes["id"].Value)].Colors.Add(Convert.ToInt32(sub.Attributes["id"].Value), new Color(Convert.ToInt32(sub.Attributes["id"].Value), Convert.ToInt32(sub.Attributes["index"].Value), Convert.ToInt32(sub.Attributes["club"].Value), Convert.ToInt32(sub.Attributes["selectable"].Value) == 1, Convert.ToString(sub.InnerText))); } } } var sets = xDoc.GetElementsByTagName("sets"); foreach (XmlNode node in sets) { foreach (XmlNode child in node.ChildNodes) { _setTypes.Add(child.Attributes["type"].Value, new FigureSet(SetTypeUtility.GetSetType(child.Attributes["type"].Value), Convert.ToInt32(child.Attributes["paletteid"].Value))); foreach (XmlNode sub in child.ChildNodes) { _setTypes[child.Attributes["type"].Value].Sets.Add(Convert.ToInt32(sub.Attributes["id"].Value), new Set(Convert.ToInt32(sub.Attributes["id"].Value), Convert.ToString(sub.Attributes["gender"].Value), Convert.ToInt32(sub.Attributes["club"].Value), Convert.ToInt32(sub.Attributes["colorable"].Value) == 1, Convert.ToInt32(sub.Attributes["selectable"].Value) == 1, Convert.ToInt32(sub.Attributes["preselectable"].Value) == 1)); foreach (XmlNode subb in sub.ChildNodes) { if (subb.Attributes["type"] != null) { _setTypes[child.Attributes["type"].Value].Sets[Convert.ToInt32(sub.Attributes["id"].Value)].Parts.Add(Convert.ToInt32(subb.Attributes["id"].Value) + "-" + subb.Attributes["type"].Value, new Part(Convert.ToInt32(subb.Attributes["id"].Value), SetTypeUtility.GetSetType(child.Attributes["type"].Value), Convert.ToInt32(subb.Attributes["colorable"].Value) == 1, Convert.ToInt32(subb.Attributes["index"].Value), Convert.ToInt32(subb.Attributes["colorindex"].Value))); } } } } } //Faceless. _setTypes["hd"].Sets.Add(99999, new Set(99999, "U", 0, true, false, false)); Logger.Trace("Loaded figure data manager"); }
public void Init() { if (this._palettes.Count > 0) { this._palettes.Clear(); } if (this._setTypes.Count > 0) { this._setTypes.Clear(); } XmlDocument xDoc = new XmlDocument(); xDoc.Load(@"extra/figuredata.xml"); XmlNodeList Colors = xDoc.GetElementsByTagName("colors"); foreach (XmlNode Node in Colors) { foreach (XmlNode Child in Node.ChildNodes) { this._palettes.Add(Convert.ToInt32(Child.Attributes["id"].Value), new Palette(Convert.ToInt32(Child.Attributes["id"].Value))); foreach (XmlNode Sub in Child.ChildNodes) { this._palettes[Convert.ToInt32(Child.Attributes["id"].Value)].Colors.Add(Convert.ToInt32(Sub.Attributes["id"].Value), new Color(Convert.ToInt32(Sub.Attributes["id"].Value), Convert.ToInt32(Sub.Attributes["index"].Value), Convert.ToInt32(Sub.Attributes["club"].Value), Convert.ToInt32(Sub.Attributes["selectable"].Value) == 1, Convert.ToString(Sub.InnerText))); } } } XmlNodeList Sets = xDoc.GetElementsByTagName("sets"); foreach (XmlNode Node in Sets) { foreach (XmlNode Child in Node.ChildNodes) { this._setTypes.Add(Child.Attributes["type"].Value, new FigureSet(SetTypeUtility.GetSetType(Child.Attributes["type"].Value), Convert.ToInt32(Child.Attributes["paletteid"].Value))); foreach (XmlNode Sub in Child.ChildNodes) { this._setTypes[Child.Attributes["type"].Value].Sets.Add(Convert.ToInt32(Sub.Attributes["id"].Value), new Set(Convert.ToInt32(Sub.Attributes["id"].Value), Convert.ToString(Sub.Attributes["gender"].Value), Convert.ToInt32(Sub.Attributes["club"].Value), Convert.ToInt32(Sub.Attributes["colorable"].Value) == 1, Convert.ToInt32(Sub.Attributes["selectable"].Value) == 1, Convert.ToInt32(Sub.Attributes["preselectable"].Value) == 1)); foreach (XmlNode Subb in Sub.ChildNodes) { if (Subb.Attributes["type"] != null) { this._setTypes[Child.Attributes["type"].Value].Sets[Convert.ToInt32(Sub.Attributes["id"].Value)].Parts.Add(Convert.ToInt32(Subb.Attributes["id"].Value) + "-" + Subb.Attributes["type"].Value, new Part(Convert.ToInt32(Subb.Attributes["id"].Value), SetTypeUtility.GetSetType(Child.Attributes["type"].Value), Convert.ToInt32(Subb.Attributes["colorable"].Value) == 1, Convert.ToInt32(Subb.Attributes["index"].Value), Convert.ToInt32(Subb.Attributes["colorindex"].Value))); } } } } } //Faceless. this._setTypes["hd"].Sets.Add(99999, new Set(99999, "U", 0, true, false, false)); log.Info("Loaded " + this._palettes.Count + " Color Palettes"); log.Info("Loaded " + this._setTypes.Count + " Set Types"); }
public void Init() { if (_palettes.Count > 0) { _palettes.Clear(); } if (_setTypes.Count > 0) { _setTypes.Clear(); } XmlDocument xDoc = new XmlDocument(); xDoc.Load(PlusEnvironment.ProjectSolutionPath() + "\\Config\\figuredata.xml"); XmlNodeList colors = xDoc.GetElementsByTagName("colors"); foreach (XmlNode node in colors) { foreach (XmlNode child in node.ChildNodes) { _palettes.Add(Convert.ToInt32(child.Attributes["id"].Value), new Palette(Convert.ToInt32(child.Attributes["id"].Value))); foreach (XmlNode sub in child.ChildNodes) { _palettes[Convert.ToInt32(child.Attributes["id"].Value)].Colors.Add(Convert.ToInt32(sub.Attributes["id"].Value), new Color(Convert.ToInt32(sub.Attributes["id"].Value), Convert.ToInt32(sub.Attributes["index"].Value), Convert.ToInt32(sub.Attributes["club"].Value), Convert.ToInt32(sub.Attributes["selectable"].Value) == 1, Convert.ToString(sub.InnerText))); } } } XmlNodeList sets = xDoc.GetElementsByTagName("sets"); foreach (XmlNode node in sets) { foreach (XmlNode child in node.ChildNodes) { _setTypes.Add(child.Attributes["type"].Value, new FigureSet(SetTypeUtility.GetSetType(child.Attributes["type"].Value), Convert.ToInt32(child.Attributes["paletteid"].Value))); foreach (XmlNode sub in child.ChildNodes) { _setTypes[child.Attributes["type"].Value].Sets.Add(Convert.ToInt32(sub.Attributes["id"].Value), new Set(Convert.ToInt32(sub.Attributes["id"].Value), Convert.ToString(sub.Attributes["gender"].Value), Convert.ToInt32(sub.Attributes["club"].Value), Convert.ToInt32(sub.Attributes["colorable"].Value) == 1, Convert.ToInt32(sub.Attributes["selectable"].Value) == 1, Convert.ToInt32(sub.Attributes["preselectable"].Value) == 1)); foreach (XmlNode subb in sub.ChildNodes) { if (subb.Attributes["type"] != null) { _setTypes[child.Attributes["type"].Value].Sets[Convert.ToInt32(sub.Attributes["id"].Value)].Parts.Add(Convert.ToInt32(subb.Attributes["id"].Value) + "-" + subb.Attributes["type"].Value, new Part(Convert.ToInt32(subb.Attributes["id"].Value), SetTypeUtility.GetSetType(child.Attributes["type"].Value), Convert.ToInt32(subb.Attributes["colorable"].Value) == 1, Convert.ToInt32(subb.Attributes["index"].Value), Convert.ToInt32(subb.Attributes["colorindex"].Value))); } } } } } //Faceless. _setTypes["hd"].Sets.Add(99999, new Set(99999, "U", 0, true, false, false)); Log.Info("Loaded " + _palettes.Count + " Color Palettes"); Log.Info("Loaded " + _setTypes.Count + " Set Types"); }
public void Init() { if (this._legacyEnabled == true) { this._legacy.Init(); log.Info("» Figure Manager -> PRONTO - BY: Thiago Araujo."); return; } if (this._palettes.Count > 0) { this._palettes.Clear(); } if (this._setTypes.Count > 0) { this._setTypes.Clear(); } XmlDocument xDoc = new XmlDocument(); xDoc.Load(@"extra/figuredata.xml"); XmlNodeList Colors = xDoc.GetElementsByTagName("colors"); foreach (XmlNode Node in Colors) { foreach (XmlNode Child in Node.ChildNodes) { this._palettes.Add(Convert.ToInt32(Child.Attributes["id"].Value), new Palette(Convert.ToInt32(Child.Attributes["id"].Value))); foreach (XmlNode Sub in Child.ChildNodes) { this._palettes[Convert.ToInt32(Child.Attributes["id"].Value)].Colors.Add(Convert.ToInt32(Sub.Attributes["id"].Value), new Color(Convert.ToInt32(Sub.Attributes["id"].Value), Convert.ToInt32(Sub.Attributes["index"].Value), Convert.ToInt32(Sub.Attributes["club"].Value), Convert.ToInt32(Sub.Attributes["selectable"].Value) == 1, Convert.ToString(Sub.InnerText))); } } } XmlNodeList sets = xDoc.GetElementsByTagName("sets"); foreach (XmlNode node in sets) { foreach (XmlNode childNode in node.ChildNodes) { this._setTypes.Add(childNode.Attributes["type"].Value, new FigureSet(SetTypeUtility.GetSetType(childNode.Attributes["type"].Value), Convert.ToInt32(childNode.Attributes["paletteid"].Value))); foreach (XmlNode subChild in childNode.ChildNodes) { int id = 0; if (int.TryParse(subChild.Attributes["id"].Value, out id)) { if (!this._setTypes[childNode.Attributes["type"].Value].Sets.ContainsKey(id)) { if (subChild.Attributes["selectable"] == null || subChild.Attributes["preselectable"] == null) { continue; } this._setTypes[childNode.Attributes["type"].Value].Sets.Add(Convert.ToInt32(subChild.Attributes["id"].Value), new Set(Convert.ToInt32(subChild.Attributes["id"].Value), Convert.ToString(subChild.Attributes["gender"].Value), Convert.ToInt32(subChild.Attributes["club"].Value), Convert.ToInt32(subChild.Attributes["colorable"].Value) == 1, Convert.ToInt32(subChild.Attributes["selectable"].Value) == 1, Convert.ToInt32(subChild.Attributes["preselectable"].Value) == 1)); foreach (XmlNode grandChild in subChild.ChildNodes) { if (grandChild.Attributes["type"] != null) { if (!this._setTypes[childNode.Attributes["type"].Value].Sets[id].Parts.ContainsKey(Convert.ToInt32(grandChild.Attributes["id"].Value) + "-" + grandChild.Attributes["type"].Value)) { this._setTypes[childNode.Attributes["type"].Value].Sets[id].Parts.Add(Convert.ToInt32(grandChild.Attributes["id"].Value) + "-" + grandChild.Attributes["type"].Value, new Part(Convert.ToInt32(grandChild.Attributes["id"].Value), SetTypeUtility.GetSetType(childNode.Attributes["type"].Value), Convert.ToInt32(grandChild.Attributes["colorable"].Value) == 1, Convert.ToInt32(grandChild.Attributes["index"].Value), Convert.ToInt32(grandChild.Attributes["colorindex"].Value))); } } } } } } } } //Faceless. this._setTypes["hd"].Sets.Add(99999, new Set(99999, "U", 0, true, false, false)); log.Info("Loaded " + this._palettes.Count + " Color Palettes"); log.Info("Loaded " + this._setTypes.Count + " Set Types"); }
public void Init() { if (this._palettes.Count > 0) { this._palettes.Clear(); } if (this._setTypes.Count > 0) { this._setTypes.Clear(); } XmlDocument xDoc = new XmlDocument(); xDoc.Load(ButterflyEnvironment.PatchDir + "figuredata.xml"); XmlNodeList Colors = xDoc.GetElementsByTagName("colors"); foreach (XmlNode Node in Colors) { foreach (XmlNode Child in Node.ChildNodes) { this._palettes.Add(Convert.ToInt32(Child.Attributes["id"].Value), new Palette(Convert.ToInt32(Child.Attributes["id"].Value))); foreach (XmlNode Sub in Child.ChildNodes) { this._palettes[Convert.ToInt32(Child.Attributes["id"].Value)].Colors.Add(Convert.ToInt32(Sub.Attributes["id"].Value), new Color(Convert.ToInt32(Sub.Attributes["id"].Value), Convert.ToInt32(Sub.Attributes["index"].Value), Convert.ToInt32(Sub.Attributes["club"].Value), Convert.ToInt32(Sub.Attributes["selectable"].Value) == 1, Convert.ToString(Sub.InnerText))); } } } XmlNodeList Sets = xDoc.GetElementsByTagName("sets"); foreach (XmlNode Node in Sets) { foreach (XmlNode Child in Node.ChildNodes) { this._setTypes.Add(Child.Attributes["type"].Value, new FigureSet(SetTypeUtility.GetSetType(Child.Attributes["type"].Value), Convert.ToInt32(Child.Attributes["paletteid"].Value))); foreach (XmlNode Sub in Child.ChildNodes) { try { this._setTypes[Child.Attributes["type"].Value].Sets.Add(Convert.ToInt32(Sub.Attributes["id"].Value), new Set(Convert.ToInt32(Sub.Attributes["id"].Value), Convert.ToString(Sub.Attributes["gender"].Value), Convert.ToInt32(Sub.Attributes["club"].Value), Convert.ToInt32(Sub.Attributes["colorable"].Value) == 1)); } catch { Console.WriteLine("Erreur 1 anti mutant Id: " + Sub.Attributes["id"].Value); } foreach (XmlNode Subb in Sub.ChildNodes) { if (Subb.Attributes["type"] != null) { try { this._setTypes[Child.Attributes["type"].Value].Sets[Convert.ToInt32(Sub.Attributes["id"].Value)].Parts.Add(Convert.ToInt32(Subb.Attributes["id"].Value) + "-" + Subb.Attributes["type"].Value, new Part(Convert.ToInt32(Subb.Attributes["id"].Value), SetTypeUtility.GetSetType(Child.Attributes["type"].Value), Convert.ToInt32(Subb.Attributes["colorable"].Value) == 1, Convert.ToInt32(Subb.Attributes["index"].Value), Convert.ToInt32(Subb.Attributes["colorindex"].Value))); } catch { Console.WriteLine("Erreur 2 anti mutant Id: " + Sub.Attributes["id"].Value); } } } } } } //Faceless. this._setTypes["hd"].Sets.Add(99999, new Set(99999, "U", 0, true)); }