private void Optionstart_DoWork(object sender, DoWorkEventArgs e) { dynamic data = e.Argument; switch (data.action.ToString()) { case "Shutdown": { Notificare.ShowBalloonTip(1000, "Optimised Cloud", "Sistemul se va opri in 2 secunde.", ToolTipIcon.Info); //Trimite messajul primit de la actiunea trimisa din Cloud. Functii.DownloadString("http://" + Functii.webip + "/notify/" + Key + "/" + token + "/shutdown/"); Thread.Sleep(2000); Shutdown.Shut(); break; } case "Restart": { Notificare.ShowBalloonTip(1000, "Optimised Cloud", "Sistemul se va reseta in 2 secunde.", ToolTipIcon.Info); //Trimite messajul primit de la actiunea trimisa din Cloud. Functii.DownloadString("http://" + Functii.webip + "/notify/" + Key + "/" + token + "/restart/"); Thread.Sleep(2000); Shutdown.Restart(); break; } default: break; } }
private void Opensite_DoWork(object sender, DoWorkEventArgs e) { dynamic data = e.Argument; if (data.url != null) { Process.Start(data.url.ToString()); //Porneste site-ul trimis din cloud. Notificare.ShowBalloonTip(1000, "Optimised Cloud", "Site-ul: " + data.url + " a pornit.", ToolTipIcon.Info); //Trimite messajul primit de la actiunea trimisa din Cloud. Functii.DownloadString("http://" + Functii.webip + "/notify/" + Key + "/" + token + "/site/" + Functii.Base64Encode(data.url.ToString())); } }
private void Optimised_All_DoWork(object sender, DoWorkEventArgs e) { ListBox.CheckForIllegalCrossThreadCalls = false; iTalk.iTalk_GroupBox.CheckForIllegalCrossThreadCalls = false; Notificare.ShowBalloonTip(1000, "Optimised Cloud", "Optimizarea trimisa din cloud pentru toti utilizatorii a inceput.", ToolTipIcon.Info); //Trimite messajul primit de la actiunea trimisa din Cloud. dynamic obj = (dynamic)e.Argument; if (obj["muic"] == 1) { try { regKey = Registry.CurrentUser.OpenSubKey(@"Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache", true); foreach (string value in regKey.GetValueNames()) { regKey.DeleteValue(value, true); } regKey.Close(); } catch { } } if (obj["pref"] == 1) { try { Array.ForEach(Directory.GetFiles(windows + @"Windows\Prefetch\", "*.pf"), delegate(string path) { File.Delete(path); if (!File.Exists(path)) { } }); } catch { }//Delete Prefetch } if (obj["rapp"] == 1) { try { RegistryKey regKeyAppRoot = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Search\RecentApps", true); foreach (string value in regKeyAppRoot.GetSubKeyNames()) { regKeyAppRoot.DeleteSubKeyTree(value, true); } regKeyAppRoot.Close(); } catch { }//Delete Regedit } if (obj["temp"] == 1) { string pat = Path.GetTempPath(); System.IO.DirectoryInfo di = new DirectoryInfo(pat.ToString()); foreach (FileInfo file in di.GetFiles()) { try { file.Delete(); if (!File.Exists(file.FullName)) { } } catch { } } foreach (DirectoryInfo dir in di.GetDirectories()) { try { dir.Delete(true); if (!Directory.Exists(dir.FullName)) { } } catch { } } } if (obj["trac"] == 1) { try { RegistryKey regKeyAppRoot = Registry.LocalMachine.OpenSubKey(@"Software\WOW6432Node\Microsoft\Tracing", true); foreach (string value in regKeyAppRoot.GetSubKeyNames()) { regKeyAppRoot.DeleteSubKeyTree(value, true); } regKeyAppRoot.Close(); } catch { }//Delete Regedit } if (obj["rebin"] == 1) { try { uint result = SHEmptyRecycleBin(IntPtr.Zero, null, RecycleFlags.SHERB_NOCONFIRMATION); } catch { } } if (obj["rfile"] == 1) { String recent = Environment.ExpandEnvironmentVariables("%APPDATA%") + @"\Microsoft\Windows\Recente"; try { Array.ForEach(Directory.GetFiles(recent, "*.*"), delegate(string path) { File.Delete(path); if (!File.Exists(path)) { } }); } catch { }//Delete Recent files try { SHAddToRecentDocs(ShellAddToRecentDocsFlags.Pidl, (IntPtr)(0)); } catch { } } if (obj["wlogs"] == 1) { foreach (var eventLog in EventLog.GetEventLogs()) { try { eventLog.Clear(); eventLog.Dispose(); } catch { } } } if (obj["mpoint"] == 1) { try { RegistryKey regKeyAppRoot = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2", true); foreach (string values in regKeyAppRoot.GetSubKeyNames()) { regKeyAppRoot.DeleteSubKeyTree(values, true); } } catch { }//Delete Regedit } if (obj["rstart"] == 1) { try { regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); foreach (string value in regKey.GetValueNames()) { regKey.DeleteValue(value, true); } regKey.Close(); } catch { } } if (obj["useras"] == 1) { try { regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\UserAssist", true); foreach (string value in regKey.GetSubKeyNames()) { regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\" + value.ToString() + @"\Count", true); foreach (string cont in regKey.GetValueNames()) { regKey.DeleteValue(cont, true); } } regKey.Close(); } catch { } } if (obj["compstore"] == 1) { try { RegistryKey regKeyAppRoot = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Store", true); foreach (string values in regKeyAppRoot.GetValueNames()) { regKeyAppRoot.DeleteValue(values, true); } } catch { }//Delete Regedit } Notificare.ShowBalloonTip(1000, "Optimised Cloud End", "Optimizarea trimisa din cloud pentru toti utilizatorii a fost efectuata.", ToolTipIcon.Info); //Trimite messajul primit de la actiunea trimisa din Cloud se termina. Functii.DownloadString("http://" + Functii.webip + "/notify/" + Key + "/" + token + "/all/"); }