Exemple #1
0
        public void Initialize()
        {
            LocalUserFolderTextBox.Text = new DirectoryInfo(Application.LocalUserAppDataPath).Parent.FullName;
            //Configuration config =
            //ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
            //Console.WriteLine("Local user config path: {0}", config.FilePath);
            //%APPDATA%\<AppName>\<AppName><AppConfigName_GUID>\<AssemblyVersion>\user.config
            // user.config will reside in the location specified by the Application.LocalUserAppDataPath
            //http://msdn.microsoft.com/en-us/library/8eyb2ct1.aspx
            //CurrentUserFolderTextBox.Text = config.FilePath;
            //http://www.blayd.co.uk/article.aspx?pageid=1013
            // http://www.app-fact.de/uploads/media/System_Configuration_en.pdf
            AllUsersFolderTextBox.Text    = new DirectoryInfo(Application.CommonAppDataPath).Parent.FullName;
            RoamingUserFolderTextBox.Text = new DirectoryInfo(Application.UserAppDataPath).Parent.FullName;
            var localSettings = new FileInfo(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath);

            LocalUserSettingsTextBox.Text = localSettings.Directory.FullName;
            var roamingSettings = new FileInfo(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoaming).FilePath);

            RoamingUserSettingsTextBox.Text = roamingSettings.Directory.FullName;
            string[] names = mainForm.GeneratorPanel.Presets.Select(x => x.PresetName).ToArray();
            PassGenHelper.LoadPresets(FavPreset1ComboBox, names, Settings.Default.FavPreset1ComboBox);
            PassGenHelper.LoadPresets(FavPreset2ComboBox, names, Settings.Default.FavPreset2ComboBox);
            PassGenHelper.LoadPresets(FavPreset3ComboBox, names, Settings.Default.FavPreset3ComboBox);
            // Load settings to controls.
            FavPreset1TextBox.Text = Settings.Default.FavPreset1TextBox;
            FavPreset2TextBox.Text = Settings.Default.FavPreset2TextBox;
            FavPreset3TextBox.Text = Settings.Default.FavPreset3TextBox;
            SettingsLoaded         = true;
        }
Exemple #2
0
        private void GenerateButton_Click(object sender, EventArgs e)
        {
            var adjective = PassGenHelper.GetRandom(Adjectives);
            var noun      = PassGenHelper.GetRandom(Nouns);
            var verb      = PassGenHelper.GetRandom(Verbs);
            var adverb    = PassGenHelper.GetRandom(Adverbs);

            PasswordTextBox.Text = string.Format("{0}{1}{2}{3}", adjective, noun, verb, adverb);
        }
Exemple #3
0
 public void Initialize()
 {
     LocalUserFolderTextBox.Text = PassGenHelper.AppDataPath;
     string[] names = mainForm.GeneratorPanel.Presets.Select(x => x.PresetName).ToArray();
     PassGenHelper.LoadPresets(FavPreset1ComboBox, names, Settings.Default.FavPreset1ComboBox);
     PassGenHelper.LoadPresets(FavPreset2ComboBox, names, Settings.Default.FavPreset2ComboBox);
     PassGenHelper.LoadPresets(FavPreset3ComboBox, names, Settings.Default.FavPreset3ComboBox);
     // Load settings to controls.
     FavPreset1TextBox.Text = Settings.Default.FavPreset1TextBox;
     FavPreset2TextBox.Text = Settings.Default.FavPreset2TextBox;
     FavPreset3TextBox.Text = Settings.Default.FavPreset3TextBox;
     SettingsLoaded         = true;
 }