コード例 #1
0
        public List <LangInfo> GetLangList()
        {
            if (!Directory.Exists(_langDir))
            {
                _mainForm.WriteOutput("Language directory (/lng) doesn't exists", Color.Red);
                return(null);
            }
            var files = Directory.GetFiles(_langDir, "*.lng");

            return(files.Select(text => new LangInfo {
                File = text, Name = IniReader.ReadStringFromIni("General", "LanguageName", text), Version = IniReader.ReadStringFromIni("General", "Version", text), RightToLeft = IniReader.ReadStringFromIni("General", "RightToLeft", text)
            }).ToList());
        }
コード例 #2
0
        public void LoadLanguageFromFile(string lngFile)
        {
            _currentLangDict.Clear();
            var iniReader = new IniReader(lngFile);

            _currentRightToLeft = iniReader.ReadString("General", "RightToLeft");
            var sectionList = iniReader.GetSectionList();

            foreach (var text in sectionList)
            {
                var dictionary = new Dictionary <string, string>();
                var keyList    = iniReader.GetKeyList(text);
                foreach (var key in keyList)
                {
                    dictionary[key] = iniReader.ReadString(text, key);
                }
                _currentLangDict[text] = dictionary;
            }
        }