Exemple #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     DiskDefragger.save_defragsettings(dataGridView1, checkBox1, checkBox2, checkBox3, "settings//defragsettings.ini");
     this.Close();
 }
Exemple #2
0
        public static void read_defragsettings(DataGridView dataGridView1, CheckBox optimize, CheckBox optimizemft, CheckBox uncompress, string settingsfile, bool silent)
        {
            string optimize1 = PCS.IniReadValue(settingsfile, "main", "optimize");

            if (optimize1 == "True")
            {
                optimize.CheckState = CheckState.Checked;
            }
            else
            {
                optimize.CheckState = CheckState.Unchecked;
            }

            string optimizemft1 = PCS.IniReadValue(settingsfile, "main", "optimizemft");

            if (optimizemft1 == "True")
            {
                optimizemft.CheckState = CheckState.Checked;
            }
            else
            {
                optimizemft.CheckState = CheckState.Unchecked;
            }

            string uncompress1 = PCS.IniReadValue(settingsfile, "main", "uncompress");

            if (uncompress1 == "True")
            {
                uncompress.CheckState = CheckState.Checked;
            }
            else
            {
                uncompress.CheckState = CheckState.Unchecked;
            }

            string fixeddrives         = dataGridView1.Rows.Count.ToString();
            string settingsfixeddrives = PCS.IniReadValue(settingsfile, "main", "fixeddrives");

            if (fixeddrives == settingsfixeddrives)
            {
                for (int j = 0; j < dataGridView1.Rows.Count; j++)
                {
                    string settingsdrive = PCS.IniReadValue(settingsfile, j.ToString(), "drivename");
                    string detecteddrive = dataGridView1.Rows[j].Cells[1].Value.ToString().Substring(0, 2);
                    if (settingsdrive == detecteddrive)
                    {
                        string drivechecked = PCS.IniReadValue(settingsfile, j.ToString(), "checked");
                        if (drivechecked == "True")
                        {
                            dataGridView1.Rows[j].Cells[0].Value = true;
                        }
                        else
                        {
                            dataGridView1.Rows[j].Cells[0].Value = false;
                        }
                    }
                    else
                    {
                        if (silent == false)
                        {
                            MessageBox.Show("Drive Configurations has been changed. Rewriting Configuration.");
                        }
                        DiskDefragger.save_defragsettings(dataGridView1, optimize, optimizemft, uncompress, settingsfile);
                    }
                }
            }
            else
            {
                if (silent == false)
                {
                    MessageBox.Show("Drive Configurations has been changed. Rewriting Configuration.");
                }
                save_defragsettings(dataGridView1, optimize, optimizemft, uncompress, settingsfile);
            }
        }