Exemple #1
0
 public void save_Cleaners()
 {
     for (int x = 0; x < treeView1.Nodes.Count; x++)
     {
         if (treeView1.Nodes[x].Checked)
         {
             PCS.IniWriteValue(Global.system + "blb\\Bleachbit.ini", "tree", treeView1.Nodes[x].Name.ToString(), "True");
         }
         else
         {
             PCS.IniWriteValue(Global.system + "blb\\Bleachbit.ini", "tree", treeView1.Nodes[x].Name.ToString(), "False");
         }
         for (int y = 0; y < treeView1.Nodes[x].Nodes.Count; y++)
         {
             if (treeView1.Nodes[x].Nodes[y].Checked)
             {
                 PCS.IniWriteValue(Global.system + "blb\\Bleachbit.ini", "tree", treeView1.Nodes[x].Nodes[y].Tag.ToString(), "1");
             }
             else
             {
                 PCS.IniWriteValue(Global.system + "blb\\Bleachbit.ini", "tree", treeView1.Nodes[x].Nodes[y].Tag.ToString(), "0");
             }
         }
     }
 }
Exemple #2
0
        public static void WriteLog(String message)
        {
            PCS    pcs     = new PCS();
            string savelog = PCS.IniReadValue("main", "savelog");

            if (savelog == "true")
            {
                //just in case: we protect code with try.
                try
                {
                    string filename = "log\\" + GetFilenameYYYMMDD("_LOG", ".log");
                    if (!Directory.Exists("log"))
                    {
                        Directory.CreateDirectory("log");
                    }
                    System.IO.StreamWriter sw = new System.IO.StreamWriter(filename, true);
                    string line = System.DateTime.Now.ToString() + "\t" + message;
                    sw.WriteLine(line);
                    sw.Close();
                }
                catch (Exception)
                {
                }
            }
            else
            {
                return;
            }
        }
Exemple #3
0
        public void save_schedule()
        {
            string set = PCS.IniReadValue("main", "schedule");

            if (hourly_rb.Checked)
            {
                pcs.schtime("hourly");
                PCS.IniWriteValue("main", "schedule", "hourly");
            }
            else if (daily_rb.Checked && set != "daily")
            {
                pcs.schtime("daily");
                PCS.IniWriteValue("main", "schedule", "daily");
            }
            else if (weekly_rb.Checked)
            {
                pcs.schtime("weekly");
                PCS.IniWriteValue("main", "schedule", "weekly");
            }
            else if (monthly_rb.Checked)
            {
                pcs.schtime("monthly");
                PCS.IniWriteValue("settings\\downloadsettings.ini", "main", "schedule", "monthly");
            }
            else if (none_rb.Checked && set != "none")
            {
                TaskService ts = new TaskService();
                ts.RootFolder.DeleteTask(@"Performance Maintainer");
                PCS.IniWriteValue("main", "schedule", "none");
            }
        }
Exemple #4
0
        void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (Global.program == "sre")
            {
                Thread.Sleep(1000);
                string folder = PCS.IniReadValue(Global.program, "folder");
                Directory.CreateDirectory(folder);
                File.Copy("sre.exe", folder + "\\sre.exe", true);
                PCS.IniWriteValue(Global.program, "installed", "1");
                File.Delete("sre.exe");
            }


            else if (Global.program == "eraser")
            {
                string  filename    = PCS.IniReadValue(Global.program, "filename");
                Process SomeProgram = new Process();
                SomeProgram.StartInfo.FileName        = "7z.exe";
                SomeProgram.StartInfo.Arguments       = "e -y \"" + filename + "\" ";
                SomeProgram.StartInfo.WindowStyle     = ProcessWindowStyle.Hidden;
                SomeProgram.StartInfo.CreateNoWindow  = true;
                SomeProgram.StartInfo.UseShellExecute = false;

                SomeProgram.StartInfo.RedirectStandardOutput = false;
                SomeProgram.Start();
                while (!SomeProgram.HasExited)
                {
                    Application.DoEvents();
                    System.Threading.Thread.Sleep(6);
                }

                Thread.Sleep(5000);
                String Architecture = System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
                if (Architecture == "x86")
                {
                    Process.Start("msiexec.exe", "/i \"Eraser (x86).msi\" /qn");
                }
                if (Architecture == "x64")
                {
                    Process.Start("msiexec.exe", "/i \"Eraser (x64).msi\" /qn");
                }


                PCS.IniWriteValue(Global.program, "installed", "1");
                label1.Text = "Please Wait...";
                Thread.Sleep(10000);
                File.Delete("Eraser (x64).msi");
                File.Delete("Eraser (x86).msi");
                File.Delete("dotnetfx35.exe");
                File.Delete(filename);
            }

            else
            {
                Extract();
            }
            this.DialogResult = DialogResult.OK;
        }
Exemple #5
0
        public void get_system_info()
        {
            using (Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0"))
            {
                if (regKey != null)
                {
                    string procName = regKey.GetValue("ProcessorNameString") as string;

                    if (!string.IsNullOrEmpty(procName))
                    {
                        string pros      = System.Text.RegularExpressions.Regex.Replace(procName, @"\s+", " ");
                        string processor = pros.Replace("(R)", "\u00AE");
                        this.label2.Text = processor;
                    }
                    else
                    {
                        this.label2.Text = "Unknown";
                    }
                }
                else
                {
                    this.label2.Text = "Unknown";
                }
            }

            MEMORYSTATUSEX memStatus = new MEMORYSTATUSEX();

            if (GlobalMemoryStatusEx(memStatus))
            {
                this.label3.Text = string.Format("{0} RAM", PCS.ConvertSizeToString(Convert.ToInt64(memStatus.ullTotalPhys)));
            }
            else
            {
                this.label3.Text = "Unknown";
            }

            this.label1.Text = OSVersion.GetOSFriendlyName();

            OperatingSystem OS = Environment.OSVersion;

            if (OS.Version.Major >= 6)
            {
                if (OS.Version.Minor == 0)
                {
                    this.pictureBox1.Image = global::pcsm.Properties.Resources.vista;
                }
                if (OS.Version.Minor >= 1)
                {
                    this.pictureBox1.Image = global::pcsm.Properties.Resources._7;
                }
                if (OS.Version.Minor >= 2)
                {
                    this.pictureBox1.Image = global::pcsm.Properties.Resources._8;
                }
            }
        }
Exemple #6
0
        public void download(string sec)
        {
            string    link     = PCS.IniReadValue(sec, "link");
            string    filename = PCS.IniReadValue(sec, "filename");
            WebClient client   = new WebClient();

            client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
            client.DownloadFileCompleted   += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
            client.DownloadFileAsync(new Uri(link), filename);
        }
Exemple #7
0
        private void Main_Shown(object sender, EventArgs e)
        {
            string firstrun = PCS.IniReadValue("main", "firstrun");

            if (firstrun == "true")
            {
                IntroWiz a = new IntroWiz();
                a.Show();
                PCS.IniWriteValue("main", "firstrun", "false");
            }
            backgroundWorker1.RunWorkerAsync();
        }
Exemple #8
0
 private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     PCS.process("blb\\bleachbit_console.exe", " --update-winapp2", true);
     PCS.process(Global.system + "blb\\bleachbit_console.exe", " --update-winapp2", true);
     if (PCS.CheckForInternetConnection() == true)
     {
         using (System.Net.WebClient myWebClient = new System.Net.WebClient())
         {
             myWebClient.DownloadFile("http://www.pcstarters.net/pcsm/update/downloadsettings.ini", "settings\\downloadsettingsnew.ini");
         }
     }
 }
Exemple #9
0
        public bool selection(string cleanername)
        {
            string readselection = PCS.IniReadValue(Global.system + "blb\\Bleachbit.ini", "tree", cleanername);

            if (readselection == "0")
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #10
0
        public void save_defragsettings()
        {
            PCS.IniWriteValue(Global.system + "settings\\defragsettings.ini", "main", "optimize", checkBox1.Checked.ToString());

            PCS.IniWriteValue(Global.system + "settings\\defragsettings.ini", "main", "optimizemft", checkBox2.Checked.ToString());

            PCS.IniWriteValue(Global.system + "settings\\defragsettings.ini", "main", "fixeddrives", dataGridView1.Rows.Count.ToString());

            for (int j = 0; j < dataGridView1.Rows.Count; j++)
            {
                PCS.IniWriteValue(Global.system + "settings\\defragsettings.ini", j.ToString(), "drivename", this.dataGridView1.Rows[j].Cells[1].Value.ToString().Substring(0, 2));
                PCS.IniWriteValue(Global.system + "settings\\defragsettings.ini", j.ToString(), "checked", this.dataGridView1.Rows[j].Cells[0].Value.ToString());
            }
        }
Exemple #11
0
        public void CheckProgram(string section, Label ll, Label install_ll)
        {
            string name = PCS.IniReadValue(section, "name");

            ll.Text = name;

            string Installed = PCS.IniReadValue(section, "installed");

            if (Installed == "1")
            {
                ll.Enabled         = true;
                install_ll.Visible = false;
                if (File.Exists("settings\\downloadsettingsnew.ini"))
                {
                    string oldversion = PCS.IniReadValue(section, "link");
                    string newversion = PCS.IniReadValue(section, "link");
                    if (newversion != null && newversion != oldversion)
                    {
                        PCS.IniWriteValue(section, "link", newversion);
                        string folder = PCS.IniReadValue(section, "folder");
                        PCS.IniWriteValue(section, "folder", folder);
                        string subfolder = PCS.IniReadValue("settings\\downloadsettingsnew.ini", section, "subfolder");
                        PCS.IniWriteValue(section, "subfolder", subfolder);
                        string newname = PCS.IniReadValue("settings\\downloadsettingsnew.ini", section, "name");
                        PCS.IniWriteValue(section, "name", newname);
                        string exefile = PCS.IniReadValue("settings\\downloadsettingsnew.ini", section, "exefile");
                        PCS.IniWriteValue(section, "exefile", exefile);
                        install_ll.Visible = true;
                        install_ll.Text    = "Update";
                    }
                }
            }
            else
            {
                if (File.Exists("settings\\downloadsettingsnew.ini"))
                {
                    string oldversion = PCS.IniReadValue(section, "link");
                    string newversion = PCS.IniReadValue("settings\\downloadsettingsnew.ini", section, "link");
                    if (newversion != null && newversion != oldversion)
                    {
                        PCS.IniWriteValue(section, "link", newversion);
                        string folder = PCS.IniReadValue("settings\\downloadsettingsnew.ini", section, "folder");
                        PCS.IniWriteValue(section, "folder", folder);
                        string subfolder = PCS.IniReadValue("settings\\downloadsettingsnew.ini", section, "subfolder");
                        PCS.IniWriteValue(section, "subfolder", subfolder);
                    }
                }
            }
        }
Exemple #12
0
        public void save_regsections()
        {
            for (int i = 0; i < treeView2.Nodes.Count; i++)
            {
                String value = treeView2.Nodes[i].Name;

                if (treeView2.Nodes[i].Checked)
                {
                    PCS.IniWriteValue(Global.system + "settings\\regsections.ini", "sections", value, "1");
                }
                else
                {
                    PCS.IniWriteValue(Global.system + "settings\\regsections.ini", "sections", value, "0");
                }
            }
            this.Close();
        }
Exemple #13
0
        private void Extract()
        {
            string link            = PCS.IniReadValue(Global.program, "link");
            string filename        = PCS.IniReadValue(Global.program, "filename");
            string folder          = PCS.IniReadValue(Global.program, "folder");
            string zipToUnpack     = filename;
            string unpackDirectory = folder;

            using (ZipFile zip1 = ZipFile.Read(zipToUnpack))
            {
                foreach (ZipEntry e in zip1)
                {
                    e.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);
                }
            }
            PCS.IniWriteValue(Global.program, "installed", "1");
            File.Delete(filename);
        }
Exemple #14
0
        public void OpenProgram(string section)
        {
            String folder    = PCS.IniReadValue(section, "folder");
            String subfolder = PCS.IniReadValue(section, "subfolder");
            String exefile   = PCS.IniReadValue(section, "exefile");
            String exearg    = PCS.IniReadValue(section, "exearg");

            if (File.Exists(folder + "\\" + subfolder + "\\" + exefile))
            {
                Process.Start(folder + "\\" + subfolder + "\\" + exefile, exearg);
            }
            else
            {
                //MessageBox.Show("Application is misconfigured. Please restart Performance Maintainer and install again.");
                //PCS.IniWriteValue(section, "installed", "0");
                Download     myForm = new Download(section);
                DialogResult dlg    = myForm.ShowDialog(this);
                if (dlg == DialogResult.OK)
                {
                    Process.Start(folder + "\\" + subfolder + "\\" + exefile, exearg);
                }
            }
        }
Exemple #15
0
        public void start_repair(DoWorkEventArgs e)
        {
            log.WriteLog("Maintainer Repair start");
            Global.currentprocess = "repair";

            data.Add("button1.enabled", "false");
            data.Add("button2.enabled", "false");
            data.Add("checkbox1.visible", "false");
            data.Add("checkbox2.visible", "false");
            data.Add("checkbox3.visible", "false");
            data.Add("checkbox5.visible", "false");
            data.Add("linklabel1.visible", "false");
            data.Add("linklabel2.visible", "false");
            data.Add("linklabel3.visible", "false");
            data.Add("linklabel9.visible", "false");
            data["button1.visible"] = "true";
            data["button2.text"]    = "Repair";

            if (checkBox1.Checked)
            {
                data.Add("checkbox1.checked", "true");
            }
            else
            {
                data.Add("checkbox1.checked", "false");
            }

            if (checkBox2.Checked)
            {
                data.Add("checkbox2.checked", "true");
            }
            else
            {
                data.Add("checkbox2.checked", "false");
            }

            if (checkBox3.Checked)
            {
                data.Add("checkbox3.checked", "true");
            }
            else
            {
                data.Add("checkbox3.checked", "false");
            }

            if (checkBox4.Checked)
            {
                data.Add("checkbox4.checked", "true");
            }
            else
            {
                data.Add("checkbox4.checked", "false");
            }

            if (checkBox5.Checked)
            {
                data.Add("checkbox5.checked", "true");
            }
            else
            {
                data.Add("checkbox5.checked", "false");
            }


            data.Add("label4.visible", "true");
            data.Add("label6.visible", "true");
            data.Add("label7.visible", "true");
            data.Add("label8.visible", "true");
            data.Add("label11.visible", "true");

            backgroundWorker1.ReportProgress(5, data);

            if (checkBox1.Checked)
            {
                data["label4.visible"] = "false";
                backgroundWorker1.ReportProgress(10, data);
                data.Add("linklabel5.visible", "false");
                data.Add("picturebox11.visible", "true");
                backgroundWorker1.ReportProgress(10, data);
                if (this.backgroundWorker1.CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }
                Application.DoEvents();
                rc.repair();
                data.Add("linklabel5.text", Global.registry + " Registry\nProblems Cleared");
                data["picturebox11.visible"] = "false";
                data["linklabel5.visible"]   = "true";
                data["linklabel5.enabled"]   = "false";
                backgroundWorker1.ReportProgress(20, data);
                Thread.Sleep(500);
            }

            if (checkBox2.Checked)
            {
                data["label6.visible"] = "false";
                backgroundWorker1.ReportProgress(30, data);
                data.Add("picturebox12.visible", "true");
                backgroundWorker1.ReportProgress(30, data);
                if (this.backgroundWorker1.CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }
                Application.DoEvents();
                dc.clean();
                data.Add("linklabel6.text", Global.cleanupsize + " space is\nRecovered");
                data["picturebox12.visible"] = "false";
                data["linklabel6.visible"]   = "true";
                data["linklabel6.enabled"]   = "false";
                backgroundWorker1.ReportProgress(40, data);
                Thread.Sleep(500);
            }

            if (checkBox3.Checked)
            {
                data["label7.visible"] = "false";

                data.Add("linklabel8.visible", "false");
                data.Add("picturebox5.visible", "false");
                data.Add("progressbar2.visible", "true");
                data.Add("picturebox5.enabled", "false");
                data["label9.visible"] = "true";
                string uncompress = PCS.IniReadValue("settings//defragsettings.ini", "main", "uncompress");
                if (uncompress == "True")
                {
                    if (data.ContainsKey("progressbar2.visible"))
                    {
                        data["progressbar2.visible"] = "true";
                    }
                    else
                    {
                        data.Add("progressbar2.visible", "true");
                    }
                }
                backgroundWorker1.ReportProgress(50, data);
                if (this.backgroundWorker1.CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }
                Application.DoEvents();
                this.timer1.Interval = 300;
                timer1.Start();
                dd.defrag();
                timer1.Stop();
                this.timer1.Interval = 3000;
                data.Add("linklabel8.text", "");
                data["linklabel8.text"]      = "Defragmentation\nComplete";
                data["linklabel8.enabled"]   = "false";
                data["progressbar2.visible"] = "false";
                data["linklabel8.visible"]   = "true";
                data["label9.visible"]       = "false";
                backgroundWorker1.ReportProgress(60, data);
                Thread.Sleep(500);
            }

            if (checkBox4.Checked)
            {
                data["label11.visible"] = "false";
                backgroundWorker1.ReportProgress(65, data);
                data.Add("picturebox14.visible", "true");
                backgroundWorker1.ReportProgress(68, data);
                if (this.backgroundWorker1.CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }
                Application.DoEvents();
                Thread.Sleep(500);
                if (!Global.serviceanalysed)
                {
                    so.diagonise();
                }
                int j = 0;
                for (int i = 0; i < so.LstServices.Items.Count; i++)
                {
                    if (so.LstServices.Items[i].Checked)
                    {
                        j++;
                    }
                }
                so.Fix();
                data.Add("linklabel4.text", j.ToString() + " Services Optimized");
                data["picturebox14.visible"] = "false";
                data["linklabel4.visible"]   = "true";
                data["linklabel4.enabled"]   = "false";
                backgroundWorker1.ReportProgress(70, data);
                Thread.Sleep(500);
            }

            if (checkBox5.Checked)
            {
                DialogResult dlogResult = MessageBox.Show("Registry Defragmentation Analysis is a system intensive process. Please close your other windows. Your computer may not resond for several minutes while the scan is being completed. \n\n Do you wish to CONTINUE?", "Contine with Registry Defragmentation!", MessageBoxButtons.YesNo);
                if (dlogResult == DialogResult.Yes)
                {
                    data["label8.visible"] = "false";
                    backgroundWorker1.ReportProgress(70, data);
                    data.Add("linklabel7.Visible", "false");
                    backgroundWorker1.ReportProgress(70, data);
                    if (this.backgroundWorker1.CancellationPending)
                    {
                        e.Cancel = true;
                        return;
                    }
                    Application.DoEvents();
                    rd.defrag();
                    data["linklabel7.visible"] = "true";
                    data.Add("linklabel7.text", "Defragmentation\nComplete");
                    data["linklabel7.enabled"] = "false";
                    backgroundWorker1.ReportProgress(100, data);
                    DialogResult dialogResult = MessageBox.Show("Restart Required to complete Registry Defragmentation. Do you want to restart NOW?", "Restart Required!", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        PCS.process("shutdown.exe", "-r -t 0", true);
                        Thread.Sleep(1000);
                        Application.Exit();
                    }
                }
            }
            data["button2.enabled"] = "true";
            data["button1.visible"] = "false";
            data["button2.text"]    = "Close";
            backgroundWorker1.ReportProgress(100, data);
            log.WriteLog("Maintainer Analysis end");
        }
Exemple #16
0
 private void Maintainer_FormClosing(object sender, FormClosingEventArgs e)
 {
     PCS.process("cmd", "/c taskkill /im lrc.exe /im bleachbit_console.exe /im udefrag.exe /t /f", true);
     backgroundWorker1.CancelAsync();
     log.WriteLog("Maintainer Closed");
 }
Exemple #17
0
        public void check_update()
        {
            string checkforupdates = PCS.IniReadValue("main", "checkforupdates");
            string lastupdatecheck = PCS.IniReadValue("main", "lastupdatecheck");

            DateTime now = DateTime.Now;
            DateTime dt;

            if (DateTime.TryParseExact(lastupdatecheck, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt))
            {
            }
            else
            {
                dt = DateTime.Now;
                PCS.IniWriteValue("main", "lastupdatecheck", now.ToString("dd/MM/yyyy"));
            }
            //DateTime dt = DateTime.ParseExact(lastupdatecheck, "dd/MM/yyyy", CultureInfo.InvariantCulture);


            if (checkforupdates == "true" && (now - dt).TotalDays > 30)
            {
                if (PCS.CheckForInternetConnection() == true)
                {
                    using (System.Net.WebClient myWebClient = new System.Net.WebClient())
                    {
                        myWebClient.DownloadFile("http://www.pcstarters.net/pcsm/update/downloadsettings.ini", "settings\\downloadsettingsnew.ini");
                    }
                }

                string latestversion = PCS.IniReadValue("main", "version");


                if (Version != latestversion && PCS.CheckForInternetConnection() == true)
                {
                    PCS.IniWriteValue("main", "lastupdatecheck", now.ToString("dd/MM/yyyy"));

                    DialogResult dialogupdate = MessageBox.Show("Update Available! \n\nDo you want to download Performance Maintainer " + latestversion + " ?", "Performance Maintainer Update", MessageBoxButtons.YesNo);

                    if (dialogupdate == DialogResult.Yes)
                    {
                        string updatefile = PCS.IniReadValue("Main", "filename");
                        string updatelink = PCS.IniReadValue("Main", "link");

                        PCS.IniWriteValue("main", "filename", updatefile);
                        PCS.IniWriteValue("main", "link", updatelink);

                        Download     newupdate = new Download("main");
                        DialogResult dlg       = newupdate.ShowDialog(this);

                        if (dlg == DialogResult.OK && File.Exists(updatefile))
                        {
                            Process pcsmnew = new Process();
                            pcsmnew.StartInfo.FileName  = "pcsmnew.exe";
                            pcsmnew.StartInfo.Arguments = "";
                            pcsmnew.Start();
                            this.Close();
                        }
                    }
                }
            }
        }
Exemple #18
0
        public void read_checkbox_check()
        {
            string checkforupdates = PCS.IniReadValue("main", "checkforupdates");

            if (checkforupdates == "true")
            {
                cfu_cb.Checked = true;
            }

            string savelog = PCS.IniReadValue("main", "savelog");

            if (savelog == "true")
            {
                checkBox3.Checked = true;
            }

            string regclean = PCS.IniReadValue(Global.system + "settings\\downloadsettings.ini", "schedule", "regclean");

            if (regclean == "true")
            {
                checkBox4.Checked = true;
            }

            string diskclean = PCS.IniReadValue(Global.system + "settings\\downloadsettings.ini", "schedule", "diskclean");

            if (diskclean == "true")
            {
                checkBox5.Checked = true;
            }

            string diskdefrag = PCS.IniReadValue(Global.system + "settings\\downloadsettings.ini", "schedule", "diskdefrag");

            if (diskdefrag == "true")
            {
                checkBox6.Checked = true;
            }

            string notify = PCS.IniReadValue(Global.system + "settings\\downloadsettings.ini", "schedule", "notification");

            if (notify == "true")
            {
                checkBox7.Checked = true;
            }

            string sch = PCS.IniReadValue("main", "schedule");

            if (sch == "hourly")
            {
                hourly_rb.Checked = true;
            }
            else if (sch == "daily")
            {
                daily_rb.Checked = true;
            }
            else if (sch == "weekly")
            {
                weekly_rb.Checked = true;
            }
            else if (sch == "monthly")
            {
                monthly_rb.Checked = true;
            }
            else
            {
                none_rb.Checked = true;
            }
        }
Exemple #19
0
 public void save_checkbox_check()
 {
     if (cfu_cb.Checked)
     {
         PCS.IniWriteValue("settings\\downloadsettings.ini", "main", "checkforupdates", "true");
     }
     else
     {
         PCS.IniWriteValue("settings\\downloadsettings.ini", "main", "checkforupdates", "false");
     }
     if (checkBox3.Checked)
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "main", "savelog", "true");
         PCS.IniWriteValue("settings\\downloadsettings.ini", "main", "savelog", "true");
     }
     else
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "main", "savelog", "false");
         PCS.IniWriteValue("settings\\downloadsettings.ini", "main", "savelog", "false");
     }
     if (checkBox4.Checked)
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "schedule", "regclean", "true");
     }
     else
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "schedule", "regclean", "false");
     }
     if (checkBox5.Checked)
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "schedule", "diskclean", "true");
     }
     else
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "schedule", "diskclean", "false");
     }
     if (checkBox6.Checked)
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "schedule", "diskdefrag", "true");
     }
     else
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "schedule", "diskdefrag", "false");
     }
     if (checkBox6.Checked)
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "schedule", "diskdefrag", "true");
     }
     else
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "schedule", "diskdefrag", "false");
     }
     if (checkBox7.Checked)
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "schedule", "notification", "true");
     }
     else
     {
         PCS.IniWriteValue(Global.system + "settings\\downloadsettings.ini", "schedule", "notification", "false");
     }
 }
Exemple #20
0
        public void read_defragsettings(bool silent)
        {
            string optimize = PCS.IniReadValue(Global.system + "settings\\defragsettings.ini", "main", "optimize");

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

            string optimizemft = PCS.IniReadValue(Global.system + "settings\\defragsettings.ini", "main", "optimizemft");

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

            string fixeddrives         = dataGridView1.Rows.Count.ToString();
            string settingsfixeddrives = PCS.IniReadValue(Global.system + "settings\\defragsettings.ini", "main", "fixeddrives");

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