private void StartScan(string pathName) { ServiceController sc = null; try { sc = new ServiceController(ClamConfig.Services.Scan); } catch (Exception) { return; } EnableToolbarButtons(false); ScanLogUpdateTimer.Enabled = true; LogTabControl.SelectTab("LogScanTabPage"); // Clear Update Log ClearAction(); // Send our path to scan pInfo.AddNotification(ClamConfig.Notification.WHSClamAVScanShare, WHS_Notification_Severity.WHS_INFO, pathName, pathName, "", "", ""); try { sc.ExecuteCommand((int)ClamConfig.ServiceCommand.scanShare); } catch (Exception) { ThrowError.Throw("Scanning Service is not found on this machine"); return; } }
private void UpdateToolBarButton_Click(object sender, EventArgs e) { ServiceController sc = null; try { sc = new ServiceController(ClamConfig.Services.Update); } catch (Exception) { return; } try { if (sc.Status != ServiceControllerStatus.Running) { ThrowError.Throw("Update Service is not running: Service is " + sc.Status.ToString()); return; } } catch (Exception) { ThrowError.Throw("Update Service is not found on this machine"); return; } // First disable update button EnableToolbarButtons(false); // Start showing updated log UpdateLogUpdateTimer.Enabled = true; LogTabControl.SelectTab("LogUpdateTabPage"); ClearAction(); try { sc.ExecuteCommand((int)ClamConfig.ServiceCommand.update); } catch (Exception) { ThrowError.Throw("Scanning Service is not found on this machine"); return; } }
private void ScanMemoryToolBarButton_Click(object sender, EventArgs e) { ServiceController sc = null; try { sc = new ServiceController(ClamConfig.Services.Scan); } catch (Exception) { return; } try { if (sc.Status != ServiceControllerStatus.Running) { ThrowError.Throw("Scanning Service is not running: Service is " + sc.Status.ToString()); return; } } catch (Exception) { ThrowError.Throw("Scanning Service is not found on this machine"); return; } EnableToolbarButtons(false); ScanLogUpdateTimer.Enabled = true; LogTabControl.SelectTab("LogScanTabPage"); // Clear Update Log ClearAction(); try { sc.ExecuteCommand((int)ClamConfig.ServiceCommand.scanMemory); } catch (Exception) { ThrowError.Throw("Scanning Service is not found on this machine"); return; } }