private void frmConfig_FormClosing(object sender, FormClosingEventArgs e) { if (this.DialogResult != DialogResult.OK) { MUI.TrySetLangByName(initialLangName); MUI.RefreshFrmLang(); } }
public static bool LoadSettings(string xmlText) { try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlText); XmlNode root = xmlDoc.SelectSingleNode("SuperCMD"); foreach (XmlAttribute attr in root.Attributes) { string attrName = attr.Name.ToLower(); if (attrName == "dpiaware") { Program.beDPIaware = bool.Parse(attr.Value); } if (attrName == "w31ui") { Program.beClassic = bool.Parse(attr.Value); } if (attrName == "lang") { if (!MUI.TrySetLangByName(attr.Value)) { RevertFallbackLangFrom(attr.Value); } } } XmlNodeList Q_nodes = root.SelectNodes("QLaunch/Q"); foreach (XmlNode Q_node in Q_nodes) { int i = int.Parse(Q_node.Attributes["index"].Value); if (i < 1 | i > 9) { continue; } Q q = new Q(); foreach (XmlAttribute attr in Q_node.Attributes) { string attrName = attr.Name.ToLower(); if (attrName == "name") { q.Name = attr.Value; } if (attrName == "exe") { q.ExeToRun = attr.Value; } if (attrName == "args") { q.Arguments = attr.Value; } if (attrName == "dir") { q.WorkingDir = attr.Value; } if (attrName == "ti") { q.UseTItoken = bool.Parse(attr.Value); } } Qs[i - 1] = q; } } catch (Exception) { return(false); } return(true); }