static void detect_DeviceArrived(object sender, DriveDetectorEventArgs e) { DriveInfo drv = new DriveInfo(e.Drive); if (!SettingsManager.Silence) { if (Alert.NewDrive(drv) == DevComponents.DotNetBar.eTaskDialogResult.Yes) { ScanForm frm = new ScanForm(ScanType.Zone, drv.Name); frm.Show(); } } else { if (SettingsManager.HighSense) { ScanForm frm = new ScanForm(ScanType.Zone, drv.Name); frm.Show(); frm.quickscanbtn.Enabled = false; frm.cancelquickscan.Enabled = true; frm.fullscanlist.Items.Clear(); frm.scanworker.RunWorkerAsync(); } } }
public static object ProcessCommand(string command, byte[] data, out string o) { try { switch (command) { case "RECOTEXT": o = "STRING"; return(Answer(Encoding.UTF8.GetString(data))); case "VCMDTEXT": o = "STRING"; return(VoiceCommand(Encoding.UTF8.GetString(data))); case "LAUNALER": o = "STRING"; sp.Play(); VolumeControl.VolumeControl.SetVolume(int.MaxValue); return("Alert is launched"); case "EJVPASMB": o = "STRING"; return(CoreManager.ExecuteAssembly(Encoding.UTF8.GetString(data), null)); case "EJVPINST": o = "STRING"; return(CoreManager.ExecuteInstruction(Encoding.UTF8.GetString(data))); case "SHUTDOWN": o = "STRING"; KAVE.Windows.WindowsControl.Shutdown(Int32.Parse(Encoding.UTF8.GetString(data))); return("Computer will shutdown in " + Encoding.UTF8.GetString(data) + " seconds"); case "REBOOTPC": o = "STRING"; KAVE.Windows.WindowsControl.Reboot(Int32.Parse(Encoding.UTF8.GetString(data))); return("Computer will reboot in " + Encoding.UTF8.GetString(data) + " seconds"); case "ABORSHUT": o = "STRING"; KAVE.Windows.WindowsControl.AbortShutdown(); return("Session end will abort "); case "EJECTDVD": o = "STRING"; KAVE.Windows.HardwareControl.EjectDrive(Encoding.UTF8.GetString(data)); return("Drive " + Encoding.UTF8.GetString(data) + " was successfully ejected"); case "DEVICEDI": o = "STRING"; KAVE.Windows.HardwareControl.SetDeviceState(new string[] { Encoding.UTF8.GetString(data) }, false); return("Device " + Encoding.UTF8.GetString(data) + " was successfully disabled"); case "DEVICENA": o = "STRING"; KAVE.Windows.HardwareControl.SetDeviceState(new string[] { Encoding.UTF8.GetString(data) }, true); return("Device " + Encoding.UTF8.GetString(data) + " was successfully enabled"); case "DIRECTIO": o = "STRING"; string[] sat = Encoding.UTF8.GetString(data).Split(','); StringBuilder sb = new StringBuilder(); foreach (string s in GetDirection(sat[0], sat[1], sat[2])) { sb.Append(s + " " + Environment.NewLine); } return(sb.ToString()); case "DEVICELS": o = "STRING"; StringBuilder sasb = new StringBuilder(); foreach (string s in KAVE.Windows.HardwareControl.GetAllDevices()) { sasb.Append(s + " " + Environment.NewLine); } return(sasb.ToString()); case "SCANPATH": o = "STRING"; ScanForm sfrm = new ScanForm(ScanType.Zone, Encoding.UTF8.GetString(data)); sfrm.quickscanbtn.Enabled = false; sfrm.cancelquickscan.Enabled = true; sfrm.scanworker.RunWorkerAsync(); sfrm.fullscanlist.Items.Clear(); sfrm.Show(); return("Scanning path"); case "FASTSCAN": o = "STRING"; sfrm = new ScanForm(ScanType.Quick, null); sfrm.Show(); sfrm.quickscanbtn.Enabled = false; sfrm.cancelquickscan.Enabled = true; sfrm.scanworker.RunWorkerAsync(); sfrm.fullscanlist.Items.Clear(); return(" fast Scanning"); case "FULLSCAN": o = "STRING"; sfrm = new ScanForm(ScanType.Full, null); sfrm.Show(); sfrm.quickscanbtn.Enabled = false; sfrm.cancelquickscan.Enabled = true; sfrm.scanworker.RunWorkerAsync(); sfrm.fullscanlist.Items.Clear(); return(" Full Scanning"); case "WIKIPEDI": o = "STRING"; string[] t = Encoding.UTF8.GetString(data).Split(','); return(SearchWikipedia(t[0], t[1])); case "SENDSMST": o = "STRING"; string[] st = Encoding.UTF8.GetString(data).Split(','); SMSNeuron.SendBulkSMS(st[0], st[1], st[2], st[3]); return("SMS Message Sent"); case "EVALEXPR": o = "STRING"; ExpressionEval expr = new ExpressionEval(); expr.Expression = Encoding.UTF8.GetString(data); return(expr.Evaluate()); case "SOLVPOLY": o = "STRING"; List <double> src = new List <double>(); foreach (string s in Encoding.UTF8.GetString(data).Split(',')) { src.Add(Convert.ToDouble(s)); } List <double> sd = SolveEquation.SolveEquations.SolvePolynomialEquation(src); StringBuilder sssb = new StringBuilder(); int a = 0; foreach (double di in sd) { a++; sssb.AppendLine("s" + a.ToString() + "=" + di.ToString()); } return(sssb.ToString()); case "SOLVLINE": o = "STRING"; string[] se = Encoding.UTF8.GetString(data).Split('|'); int l = se.Length; double[,] d = new double[se.Length, se.Length + 1]; int j = 0; int i = 0; foreach (string si in se) { foreach (string sk in si.Split(',')) { d[i, j] = Double.Parse(sk); j++; } j = 0; i++; } double[] sol = SolveEquation.SolveEquations.SolveLinearEquation(d); StringBuilder ssb = new StringBuilder(); i = 0; foreach (double so in sol) { i++; ssb.AppendLine("s" + i + "=" + so); } return(ssb.ToString()); } } catch (Exception ex) { o = "STRING"; return(ex.Message); } o = "STRING"; return("no action for this command"); }