Пример #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();
        }
 //This method executes the advanced functions.
 private void Advanced()
 {
     foreach (string command in File_Managment.ReadFromCMD())
     {
         System.Diagnostics.Process.Start("cmd.exe", command);
     }
 }