public bool SendCommandToUI(BeSafePipeCommand command) { try { _serverPipe.PushMessage(command); return(true); } catch (Exception ex) { ex.Log(); } return(false); }
public bool SendCommandToService(BeSafePipeCommand command) { try { command.ConfigFilePath = PathUtils.ConfigFilePath; pipeClient.PushMessage(command); return(true); } catch (Exception ex) { ex.Log(); } return(false); }
private void OnServerCommandReceived(NamedPipeConnection <BeSafePipeCommand, BeSafePipeCommand> connection, BeSafePipeCommand command) { switch (command.Command) { case PipeCommands.Notification: MessageBox.Show(command.Notification, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); break; case PipeCommands.PluginScanResult: { PluginResult pResult = command.PluginScanResult; notifyIcon.Tag = pResult; ToolTipIcon icon = command.PluginScanResult.RiskRate == ThreatRiskRates.HighRisk ? ToolTipIcon.Error : ToolTipIcon.Warning; string message = $"{pResult.PluginInfo.Name}{Environment.NewLine}{pResult.Message}"; notifyIcon.ShowBalloonTip(3000, Resources.ApplicationName, message, icon); } break; } }
private void OnClientCommandReceived(NamedPipeConnection <BeSafePipeCommand, BeSafePipeCommand> connection, BeSafePipeCommand command) { try { switch (command.Command) { case PipeCommands.ComponentConfiguration: { bool sotreSettingResult = new ServiceSetting().StoreConfigFilePath(command.ConfigFilePath); if (sotreSettingResult) { ConfigApplier(); } } break; case PipeCommands.ReloadPlugins: { } break; case PipeCommands.Notification: { } break; } } catch (Exception ex) { ex.Log(); } }