Exemple #1
0
        public void Load(string languageName)
        {
            string fileName;

            try
            {
                fileName = Languages[languageName];
            }
            catch (Exception)
            {
                fileName = Languages.First().Value;
            }

            string path = Path.Combine(FolderStructure.IRSEFolderPath, "localization", fileName);

            if (File.Exists(path))
            {
                using (ResXResourceReader resXresourceReader = new ResXResourceReader(path))
                {
                    foreach (DictionaryEntry dictionaryEntry in resXresourceReader)
                    {
                        this.m_sentences.Add((string)dictionaryEntry.Key, (string)dictionaryEntry.Value);
                    }
                }
            }
            else
            {
                mainLog.Info("No localization file detected ! English language loading...");
                Localization.CreateDefault();
                Load("English (United States)");
            }
        }
Exemple #2
0
 public void Load(string FileName)
 {
     if (File.Exists(Localization.PathFolder + FileName + ".resx"))
     {
         if (new ResXResourceSet(Localization.PathFolder + FileName + ".resx").GetString("version") == Localization.Version)
         {
             using (ResXResourceReader resXresourceReader = new ResXResourceReader(Localization.PathFolder + FileName + ".resx"))
             {
                 foreach (DictionaryEntry dictionaryEntry in resXresourceReader)
                 {
                     this.m_sentences.Add((string)dictionaryEntry.Key, (string)dictionaryEntry.Value);
                 }
             }
         }
         else
         {
             mainLog.Info("Your localization file is not updated ! Please download the latest version on our github page. English language loading...");
             Localization.CreateDefault();
             this.Load("En");
         }
     }
     else
     {
         mainLog.Info("No localization file detected ! English language loading...");
         Localization.CreateDefault();
         this.Load("En");
     }
 }