Forex_Strategy_Builder.Language.SaveLangFile C# (CSharp) Метод

SaveLangFile() публичный статический Метод

Generates a new language file.
public static SaveLangFile ( string>.Dictionary dict, string sAuthor, string sWebsite, string sEmail ) : void
dict string>.Dictionary
sAuthor string
sWebsite string
sEmail string
Результат void
        public static void SaveLangFile(Dictionary<string,string> dict , string sAuthor, string sWebsite, string sEmail)
        {
            string path = languageFiles[Configs.Language];
            XmlDocument xmlLanguage = new XmlDocument();
            xmlLanguage.Load(path);

            xmlLanguage.SelectSingleNode("lang//translatedby").InnerText = sAuthor;
            xmlLanguage.SelectSingleNode("lang//website"     ).InnerText = sWebsite;
            xmlLanguage.SelectSingleNode("lang//corrections" ).InnerText = sEmail;

            XmlNodeList xmlStringList = xmlLanguage.GetElementsByTagName("str");

            foreach (XmlNode nodeString in xmlStringList)
            {
                nodeString.SelectSingleNode("alt").InnerText = dict[nodeString.SelectSingleNode("main").InnerText];
            }

            try
            {
                xmlLanguage.Save(path);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            return;
        }

Usage Example

        /// <summary>
        /// Saves the translation
        /// </summary>
        private void SaveTranslation()
        {
            string author   = AtbxInputValues[2].Text;
            string website  = AtbxInputValues[3].Text;
            string contacts = AtbxInputValues[4].Text;

            for (int i = 0; i < _phrases; i++)
            {
                _dictLanguage[_asMain[i]] = _asAlt[i];
            }

            Language.SaveLangFile(_dictLanguage, author, website, contacts);

            _isTranslChanged = false;
        }
All Usage Examples Of Forex_Strategy_Builder.Language::SaveLangFile