Example #1
0
        //The method that loads all the settings in from the txt files.
        private void LoadSettings()
        {
            File_Managment.CreateDirFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SanguinesStartUpUtils\\Settings\\", "Paths.txt");
            File_Managment.CreateDirFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SanguinesStartUpUtils\\Settings\\", "Websites.txt");
            File_Managment.CreateDirFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SanguinesStartUpUtils\\Settings\\", "Sounds.txt");

            //Simple
            shutdownCheck.Checked    = Convert.ToBoolean(File_Managment.ReadFromSettings("shutdownEnabled"));
            shutdownTimeTextBox.Text = File_Managment.ReadFromSettings("shutdownTime");
            startProgram.Checked     = Convert.ToBoolean(File_Managment.ReadFromSettings("programsEnabled"));
            openWebsite.Checked      = Convert.ToBoolean(File_Managment.ReadFromSettings("websitesEnabled"));
            playSounds.Checked       = Convert.ToBoolean(File_Managment.ReadFromSettings("soundsEnabled"));
            soundsDelay.Text         = File_Managment.ReadFromSettings("soundsDelay");

            programTextBox.Lines          = getExecutableName();
            programTextBox.SelectionStart = programTextBox.Text.Length;
            programTextBox.ScrollToCaret();
            soundTextBox.Lines          = getSoundName();
            soundTextBox.SelectionStart = soundTextBox.Text.Length;
            soundTextBox.ScrollToCaret();
            websitesTextBox.Lines          = File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SanguinesStartUpUtils\\Settings\\Websites.txt");
            websitesTextBox.SelectionStart = websitesTextBox.Text.Length;
            websitesTextBox.ScrollToCaret();

            //Advanced
            cmdTextBox.Lines = File_Managment.ReadFromCMD();
        }
 //Opens the websites in the Websites.txt
 private void OpenWebsites()
 {
     File_Managment.CreateDirFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SanguinesStartUpUtils\\Settings\\", "Websites.txt");
     foreach (string line in File.ReadAllLines(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SanguinesStartUpUtils\\Settings\\Websites.txt"))
     {
         if (File_Managment.IsValidUri(line))
         {
             try
             {
                 System.Diagnostics.Process.Start(line);
             }
             catch { }
         }
     }
 }