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"); } } } }
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"); } }
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; }
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(); }
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()); } }
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); } } } }
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(); }
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); }
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(); } } } } }
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"); } }