private string GetChromaName(int id, int chromaId) { if ((Chromas == null) || !Chromas.ContainsKey(new KeyValuePair <Champion, byte>(Player.Instance.Hero, (byte)id))) { return(string.Empty); } var dictionary = GetChromaList(id); var baseSkinName = Skins.FirstOrDefault(x => x.Value == id).Key; if (dictionary == null) { return(baseSkinName); } var chromaIdT = dictionary.ElementAtOrDefault(chromaId).Key; return(chromaIdT != default(string) ? $"{baseSkinName} : {chromaIdT} chroma" : baseSkinName); }
public static void Load() { XmlElement xroot = null; try { XmlDocument xdoc = new XmlDocument(); xdoc.Load(SettingsFile); xroot = xdoc["settings"] ?? xdoc["root"]; // first load the simplest properties if (xroot["Email"] != null) { Email = xroot["Email"].InnerText; } if (xroot["BackgroundColor"] != null) { BackgroundColor = Color.FromArgb(int.Parse(xroot["BackgroundColor"].InnerText)); } if (xroot["Delay"] != null) { Delay = TimeSpan.FromMilliseconds(int.Parse(xroot["Delay"].InnerText)); } if (xroot["SkinFolders"] is XmlNode xSkinFolders) { foreach (XmlNode xDir in xSkinFolders) { var sf = new SkinDirectoryEntry { Path = xDir.Attributes["path"].Value, Types = (SkinType)int.Parse(xDir.Attributes["types"].Value) }; // setup skin folders to default svg only SkinFolders.Add(sf); } } } catch (XmlException) { } catch (FormatException) { } if (!SkinFolders.Any()) { // setup skin folders to default svg only SkinFolders.Add(new SkinDirectoryEntry { Path = "./skins", Types = SkinType.Svg }); } // then load all skins as they have no dependencies LoadSkins(); LoadRemaps(); try { // now we can load the skin-specific settings if (xroot["ActiveSkin"] != null) { ActiveSkin = Skins.FirstOrDefault(s => s.Path == xroot["ActiveSkin"].InnerText); } foreach (XmlNode skinCfg in xroot["SkinSettings"].ChildNodes) { string path = skinCfg.Attributes["path"].Value; var skin = Skins.FirstOrDefault(s => s.Path == path); var wsz = skinCfg.Attributes["WindowSize"]; if (wsz != null && skin != null) { string size = wsz.Value; Size sz = new Size(int.Parse(size.Substring(0, size.IndexOf("x"))), int.Parse(size.Substring(size.IndexOf("x") + 1))); WindowSizes[skin] = sz; } if (skin is SvgSkin svg && skinCfg.Attributes["ActiveRemap"] != null) { Guid uuid = Guid.Parse(skinCfg.Attributes["ActiveRemap"].Value); var remapList = AvailableRemaps.Where(kvp => kvp.Value.Any(cr => cr.UUID == uuid)); if (remapList.Any()) { var skinList = remapList.First().Value; SelectedRemaps[svg] = skinList.First(r => r.UUID == uuid); } } else if (skin is NintendoSpySkin nspySkin && skinCfg.Attributes["ActiveBackground"] != null) { SelectedNSpyBackgrounds[nspySkin] = skinCfg.Attributes["ActiveBackground"].Value; } }
public MojangSkinProfile GetActiveSkin() { return(Skins?.FirstOrDefault(x => x.State.Equals("ACTIVE", StringComparison.OrdinalIgnoreCase))); }
public static void Load() { try { XmlDocument xdoc = new XmlDocument(); xdoc.Load(SettingsFile); XmlElement xroot = xdoc["settings"] ?? xdoc["root"]; // first load the simplest properties if (xroot["Email"] != null) { Email = xroot["Email"].InnerText; } if (xroot["BackgroundColor"] != null) { BackgroundColor = Color.FromArgb(int.Parse(xroot["BackgroundColor"].InnerText)); } if (xroot["Delay"] != null) { Delay = TimeSpan.FromMilliseconds(int.Parse(xroot["Delay"].InnerText)); } // then load all skins as they have no dependencies LoadSkins(); // now we can load the skin-specific settings if (xroot["active_skin"] != null) { ActiveSkin = Skins.FirstOrDefault(s => s.Path == xroot["active_skin"].InnerText); } foreach (XmlNode skinCfg in xroot["skin_settings"].ChildNodes) { string path = skinCfg.Attributes["skin_path"].Value; var wsz = skinCfg.Attributes["window_size"]; if (wsz != null) { string size = wsz.Value; Size sz = new Size(int.Parse(size.Substring(0, size.IndexOf("x"))), int.Parse(size.Substring(size.IndexOf("x") + 1))); var skin = Skins.FirstOrDefault(s => s.Path == path); if (skin != null) { WindowSizes[skin] = sz; } } } // load arduino map, then controllers var arduinoMap = xroot["arduino_mapping"]; if (arduinoMap != null) { foreach (XmlNode e in arduinoMap.ChildNodes) { ArduinoMapping[e.Attributes["port"].Value] = (ControllerType)Enum.Parse(typeof(ControllerType), e.Attributes["type"].Value, true); } } LoadControllers(); // finally we can determine the active controller if (xroot["active_dev_path"] != null) { SetActiveController(Controllers.FirstOrDefault(c => c.DevicePath == xroot["active_dev_path"].InnerText)); } } catch { } }