Example #1
0
        public static void analyse(DataGridView dataGridView1, Label label1)
        {
            log.WriteLog("Maintainer Registry Cleaner analysis start");
            dataGridView1.Rows.Clear();
            PCS.process("lrc\\lrc.exe", " /analyse", true);

            if (File.Exists("settings\\regcleanresult.txt"))
            {
                System.Threading.Thread.Sleep(1000);
                string  json = File.ReadAllText("settings\\regcleanresult.txt");
                JObject o    = JObject.Parse(json);

                int count = (int)o["problems"];
                Global.registryerrors = count;
                label1.Text           = "Registry Errors Found: " + count.ToString();
                if (count > 0)
                {
                    for (int i = 1; i <= count; i++)
                    {
                        JArray bdky = (JArray)o[i.ToString()];
                        if ((int)bdky[0] == 1)
                        {
                            problem   = (string)bdky[1];
                            regKey    = (string)bdky[4];
                            valueName = (string)bdky[5];
                            dataGridView1.Rows.Add(problem, regKey, valueName);
                        }
                    }
                }
                log.WriteLog("Maintainer Registry Cleaner End");
            }
        }
Example #2
0
        public static void repair()
        {
            PCS pcs = new PCS();

            log.WriteLog("Maintainer Registry Cleaner repair start");
            PCS.process("lrc\\lrc.exe", " /repair", true);
            if (File.Exists("settings\\reglog.txt"))
            {
                Global.registry = pcs.findword("settings\\reglog.txt", "Total problems found", 21);
            }
            log.WriteLog("Maintainer Registry Cleaner repair end");
        }
Example #3
0
        public static void analyse(System.Windows.Forms.DataVisualization.Charting.Chart chart1, System.Windows.Forms.DataVisualization.Charting.Series series1, DataGridView dataGridView1, CheckBox optimize, CheckBox optimizemft, CheckBox uncompress, Label label4, string settingsfile)
        {
            PCS pcs = new PCS();

            log.WriteLog("Maintainer DiskDefrag analysis start");
            DiskDefragger.read_defragsettings(dataGridView1, optimize, optimizemft, uncompress, settingsfile, true);
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                string driveselection = dataGridView1[0, i].Value.ToString();

                if (driveselection == "True")
                {
                    string path = dataGridView1[1, i].Value.ToString().Substring(0, 2);
                    PCS.process("cmd", "/C set UD_TIME_LIMIT=0h 30m && set UD_LOG_FILE_PATH=ud\\" + i.ToString() + ".log && ud\\udefrag.exe -a " + path, true);
                    string fragmentedpercent = pcs.findword("ud\\" + i + ".log", "fragmentation is above the threshold:", 61);
                    System.Threading.Thread.Sleep(1000);
                    Global.fragmentedp[i] = fragmentedpercent.Substring(0, 5);
                }
            }
            string fragmentedf = pcs.findword("ud\\0.log", "fragmented files", 41);
            string fragmentedp = pcs.findword("ud\\0.log", "fragmentation is above the threshold:", 61);

            string compf             = pcs.findword("ud\\0.log", "compressed files:", 41);
            string totalf            = pcs.findword("ud\\0.log", "files total:", 41);
            double defragmentedfiles = Convert.ToDouble(totalf) - Convert.ToDouble(compf) + Convert.ToDouble(fragmentedf);

            label4.Text = "Fragmentation: " + fragmentedp.Substring(0, 7);


            series1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.DiagonalLeft;
            series1.ChartArea         = "ChartArea1";
            series1.ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Pie;
            series1.Legend            = "Legend1";
            series1.Name = "Series1";
            series1.Points.AddXY("Defragmented Files: " + defragmentedfiles, defragmentedfiles);
            series1.Points.AddXY("Fragmented Files: " + fragmentedf, Convert.ToDouble(fragmentedf));
            series1.Points.AddXY("Compressed Files: " + compf, Convert.ToDouble(compf));
            double fs  = Convert.ToDouble(dataGridView1[3, 0].Value);
            double rs  = 100 - fs;
            double fsp = Math.Round((fs * Convert.ToDouble(totalf)) / rs, 0);

            series1.Points.AddXY("Free Space: " + fs + "%", fsp);


            chart1.Series.Add(series1);
            chart1.Series[0]["PieLabelStyle"] = "Disabled";
        }
Example #4
0
        public static void analyse(System.Windows.Forms.DataVisualization.Charting.Chart chart1)
        {
            log.WriteLog("Maintainer Registry Optimize analyse start");
            chart1.Series.Clear();
            PCS.process("lro\\lro.exe", " /analyse", false);
            string oldregistrysize  = PCS.IniReadValue("settings\\regdefragresult.ini", "main", "oldregistrysize");
            string newregistrysize  = PCS.IniReadValue("settings\\regdefragresult.ini", "main", "newregistrysize");
            string diffregistrysize = PCS.IniReadValue("settings\\regdefragresult.ini", "main", "diffregistrysize");

            Global.newRegistrySize = Convert.ToDouble(newregistrysize);
            Global.oldRegistrySize = Convert.ToDouble(oldregistrysize);
            System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
            series1.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.DiagonalLeft;
            series1.ChartArea         = "ChartArea1";
            series1.ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Pie;
            series1.Legend            = "Legend1";
            series1.Name = "Series1";

            series1.Points.AddXY("Registry Size: " + newregistrysize + " MB", Convert.ToDouble(newregistrysize));
            series1.Points.AddXY("Size Saving: " + diffregistrysize + " MB", Convert.ToDouble(diffregistrysize));
            chart1.Series.Add(series1);
            chart1.Series[0]["PieLabelStyle"] = "Disabled";
            log.WriteLog("Maintainer Registry Optimize analyse end");
        }
Example #5
0
 private void Main_FormClosing(object sender, FormClosingEventArgs e)
 {
     PCS.process("cmd", "/c taskkill /im lrc.exe /im bleachbit_console.exe /im udefrag.exe /t /f", true);
     log.WriteLog("Maintainer Closed");
 }
Example #6
0
        public static void defrag(DataGridView dataGridView1, string settingsfile)
        {
            PCS pcs = new PCS();

            log.WriteLog("Maintainer DiskDefrag defrag start");
            string series = " ";

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                string driveselection = dataGridView1[0, i].Value.ToString();

                if (driveselection == "True")
                {
                    series = series + dataGridView1[1, i].Value.ToString().Substring(0, 2) + " ";
                }
            }
            string argoptions = " ";
            string optimize   = PCS.IniReadValue(settingsfile, "main", "optimize");

            log.WriteLog("Maintainer DiskDefrag defrag optimize: " + optimize);
            if (optimize == "True")
            {
                argoptions = argoptions + "-o ";
            }


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

            log.WriteLog("Maintainer DiskDefrag defrag uncompress: " + uncompress);
            if (uncompress == "True")
            {
                log.WriteLog("Maintainer DiskDefrag defrag uncompress start");
                Global.compactstatus = true;
                try
                {
                    ProcessStartInfo startInfo1 = new ProcessStartInfo("compact.exe");

                    startInfo1.UseShellExecute        = false;
                    startInfo1.RedirectStandardInput  = true;
                    startInfo1.RedirectStandardOutput = true;
                    startInfo1.Arguments        = "/u /s /a /q /i *.*";
                    startInfo1.WorkingDirectory = "c:\\";
                    startInfo1.CreateNoWindow   = true;
                    startInfo1.WindowStyle      = ProcessWindowStyle.Hidden;

                    Process process1 = new Process();
                    process1.StartInfo = startInfo1;
                    process1.Start();


                    string lineVal = process1.StandardOutput.ReadLine();
                    while (lineVal != null)
                    {
                        if (lineVal != "")
                        {
                            Global.compactprocess = lineVal;
                        }
                        Application.DoEvents();
                        lineVal = process1.StandardOutput.ReadLine();
                    }
                    log.WriteLog("Maintainer DiskDefrag defrag uncompress end");
                }
                catch
                {
                }
            }
            Global.compactstatus = false;

            PCS.process("cmd", "/C set UD_TIME_LIMIT=1h 30m && set UD_LOG_FILE_PATH=ud\\d.log && ud\\udefrag.exe -a C:", true);
            Global.defragmented = pcs.findword("ud\\d.log", "fragmented files", 41);
            try
            {
                ProcessStartInfo startInfo2 = new ProcessStartInfo("ud\\udefrag.exe");
                startInfo2.UseShellExecute        = false;
                startInfo2.RedirectStandardInput  = true;
                startInfo2.RedirectStandardOutput = true;
                startInfo2.Arguments      = argoptions + series;
                startInfo2.CreateNoWindow = true;
                startInfo2.WindowStyle    = ProcessWindowStyle.Hidden;

                Process process2 = new Process();
                process2.StartInfo = startInfo2;
                process2.Start();


                string lineVal2 = process2.StandardOutput.ReadLine();
                while (lineVal2 != null)
                {
                    if (lineVal2.Length > 14)
                    {
                        string checkanalyse = lineVal2.Substring(3, 8);
                        if (checkanalyse != "analyse:")
                        {
                            Global.diskdefragdrive    = lineVal2.Substring(0, 2);
                            Global.diskdefragprogress = lineVal2.Substring(14, 2);
                        }
                    }
                    Application.DoEvents();
                    lineVal2 = process2.StandardOutput.ReadLine();
                }
                log.WriteLog("Maintainer DiskDefrag defrag uncompress end");
            }
            catch
            {
            }

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

            log.WriteLog("Maintainer DiskDefrag defrag optimizemft: " + optimizemft);
            if (optimizemft == "True")
            {
                log.WriteLog("Maintainer DiskDefrag defrag optimizemft start");
                try
                {
                    ProcessStartInfo startInfo3 = new ProcessStartInfo("ud\\udefrag.exe");
                    startInfo3.UseShellExecute        = false;
                    startInfo3.RedirectStandardInput  = true;
                    startInfo3.RedirectStandardOutput = true;
                    startInfo3.Arguments      = " --optimize-mft " + series;
                    startInfo3.CreateNoWindow = true;
                    startInfo3.WindowStyle    = ProcessWindowStyle.Hidden;

                    Process process3 = new Process();
                    process3.StartInfo = startInfo3;
                    process3.Start();


                    string lineVal1 = process3.StandardOutput.ReadLine();
                    while (lineVal1 != null)
                    {
                        if (lineVal1.Length > 14)
                        {
                            string checkanalyse = lineVal1.Substring(3, 8);
                            if (checkanalyse != "analyse:")
                            {
                                Global.diskdefragdrive    = lineVal1.Substring(0, 2);
                                Global.diskdefragprogress = lineVal1.Substring(14, 2);
                            }
                        }
                        Application.DoEvents();
                        lineVal1 = process3.StandardOutput.ReadLine();
                    }
                }
                catch
                {
                }
                log.WriteLog("Maintainer DiskDefrag defrag optimizemft end");
            }
        }
Example #7
0
 public static void defrag()
 {
     log.WriteLog("Maintainer Registry Optimize Defrag start");
     PCS.process("lro\\lro.exe", " /optimize", false);
     log.WriteLog("Maintainer Registry Optimize Defrag end");
 }