Esempio n. 1
0
 void Execute(TranslationJosmStringsSettings settings)
 {
     TextFilesFolderTextBox.Text = settings.TextFilesFolder;
     LangFilesFolderTextBox.Text = settings.LangFilesFolder;
     if (ShowDialog().Value)
     {
         settings.TextFilesFolder = TextFilesFolderTextBox.Text;
         settings.LangFilesFolder = LangFilesFolderTextBox.Text;
         SettingsRegistryDriver.SaveSettings(settings);
     }
 }
Esempio n. 2
0
        public virtual void Save(TranslationJosmStringsSettings settings)
        {
            if (settings == null)
            {
                settings = new TranslationJosmStringsSettings();
            }
            RegistryKey registryFolder = Registry.CurrentUser;

            try
            {
                registryFolder = registryFolder.CreateSubKey("Software\\Rodsoft\\TranslationJosmStrings", RegistryKeyPermissionCheck.ReadWriteSubTree);
                bool isNotSuccess = true;
                //try
                //{
                //    registryFolder = registryFolder.CreateSubKey("Rodsoft");
                //    registryFolder = registryFolder.CreateSubKey("TranslationJosmStrings");
                //    isNotSuccess = false;
                //}
                //catch
                //{
                //}
                //if (isNotSuccess)
                //{
                //    registryFolder = registryFolder.OpenSubKey("Rodsoft\\TranslationJosmStrings");
                //}
                if (registryFolder == null)
                {
                    return;
                }
                registryFolder.SetValue(LANG_FILES_FOLDER_KEY, settings.LangFilesFolder);
                registryFolder.SetValue(TEXT_FILES_FOLDER_KEY, settings.TextFilesFolder);
                registryFolder.SetValue(CURRENT_LANGUAGE_CODE_KEY, settings.CurrentLanguageCode);
            }
            catch
            { }
            finally
            {
                registryFolder.Close();
                registryFolder.Dispose();
                registryFolder = null;
            }
        }
Esempio n. 3
0
        public TranslationJosmStringsSettings Load(TranslationJosmStringsSettings settings)
        {
            if (settings == null)
            {
                settings = new TranslationJosmStringsSettings();
            }
            RegistryKey registryFolder = Registry.CurrentUser;

            try
            {
                registryFolder = registryFolder.OpenSubKey("Software\\Rodsoft\\TranslationJosmStrings");
                if (registryFolder == null)
                {
                    return(settings);
                }
                string langFilesFolder = (string)registryFolder.GetValue(LANG_FILES_FOLDER_KEY, settings.LangFilesFolder);
                if (!String.IsNullOrEmpty(langFilesFolder))
                {
                    settings.LangFilesFolder = langFilesFolder;
                }
                string textFilesFolder = (string)registryFolder.GetValue(TEXT_FILES_FOLDER_KEY, settings.LangFilesFolder);
                if (!String.IsNullOrEmpty(textFilesFolder))
                {
                    settings.TextFilesFolder = textFilesFolder;
                }
                string currentLanguageCode = (string)registryFolder.GetValue(CURRENT_LANGUAGE_CODE_KEY, settings.CurrentLanguageCode);
                if (!String.IsNullOrEmpty(currentLanguageCode))
                {
                    settings.CurrentLanguageCode = currentLanguageCode;
                }
            }
            finally
            {
                if (registryFolder != null)
                {
                    registryFolder.Close();
                    registryFolder.Dispose();
                    registryFolder = null;
                }
            }
            return(settings);
        }
Esempio n. 4
0
        public static void SaveSettings(TranslationJosmStringsSettings settings)
        {
            SettingsRegistryDriver driver = new SettingsRegistryDriver();

            driver.Save(settings);
        }
Esempio n. 5
0
        public static TranslationJosmStringsSettings LoadSettings(TranslationJosmStringsSettings settings)
        {
            SettingsRegistryDriver driver = new SettingsRegistryDriver();

            return(driver.Load(settings));
        }