static void Main(string[] args) { try { try { _ = SAPGuiApiAssembly; InputDriver.Instance.OnMouseDown -= OnMouseDown; } catch (Exception) { throw; } form = new MainWindow(); var SessionId = System.Diagnostics.Process.GetCurrentProcess().SessionId; pipe = new NamedPipeServer <SAPEvent>(SessionId + "_openrpa_sapbridge"); pipe.ClientConnected += Pipe_ClientConnected; pipe.ClientMessage += Server_OnReceivedMessage; pipe.Start(); // SAPHook.Instance. System.Windows.Forms.Application.Run(form); } catch (Exception ex) { log(ex.ToString()); } }
static void Main(string[] args) { var server = new NamedPipeServer("MY_PIPE_NAME"); Greeter.BindService(server.ServiceBinder, new GreeterService()); server.Start(); }
public void SetUp() { Logger.Debug("Setting up test..."); _barrier.Reset(); _server = new NamedPipeServer <byte[]>(PipeName); _client = new NamedPipeClient <byte[]>(PipeName); _expectedData = null; _expectedHash = null; _actualData = null; _actualHash = null; _clientDisconnected = false; _server.ClientDisconnected += ServerOnClientDisconnected; _server.ClientMessage += ServerOnClientMessage; _server.Error += ServerOnError; _client.Error += ClientOnError; _server.Start(); _client.Start(); // Give the client and server a few seconds to connect before sending data Thread.Sleep(TimeSpan.FromSeconds(1)); Logger.Debug("Client and server started"); Logger.Debug("---"); _startTime = DateTime.Now; }
public void SetUp() { Logger.Debug("Setting up test..."); _barrier.Reset(); _server = new NamedPipeServer<byte[]>(PipeName); _client = new NamedPipeClient<byte[]>(PipeName); _expectedData = null; _expectedHash = null; _actualData = null; _actualHash = null; _clientDisconnected = false; _server.ClientDisconnected += ServerOnClientDisconnected; _server.ClientMessage += ServerOnClientMessage; _server.Error += ServerOnError; _client.Error += ClientOnError; _server.Start(); _client.Start(); // Give the client and server a few seconds to connect before sending data Thread.Sleep(TimeSpan.FromSeconds(1)); Logger.Debug("Client and server started"); Logger.Debug("---"); _startTime = DateTime.Now; }
private void OnLoad(object sender, EventArgs eventArgs) { _server.ClientConnected += OnClientConnected; _server.ClientDisconnected += OnClientDisconnected; _server.ClientMessage += (client, message) => AddLine("<b>" + client.Name + "</b>: " + message); _server.Start(); }
public static void init() { Printers.init(); log.Info("Loading config start..."); Program.config = new Config(err => { log.Error(err, "Config loading error."); }); //pingPongPipe(); //printers(); //jobsList(); //jobPrint(); //ConfigReload(); //JobsServerState(); server = new NamedPipeServer <string>(Pipe.name); server.ClientConnected += server_ClientConnected; server.ClientMessage += server_ClientMessage; server.ClientDisconnected += server_ClientDisconnected; server.Error += server_Error; server.Start(); if (Program.config.channel.Length != 0) { srvConnect(Program.config.channel); } msgTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); msgTimer.Interval = 100; msgTimer.Enabled = true; configWatch(); }
static void Main(string[] args) { try { form = new MainWindow(); var SessionId = System.Diagnostics.Process.GetCurrentProcess().SessionId; pipe = new NamedPipeServer <JavaEvent>(SessionId + "_openrpa_javabridge"); pipe.ClientMessage += Server_OnReceivedMessage; pipe.Start(); hook = new JavaHook(); hook.OnJavaShutDown += OnJavaShutDown; hook.OnMouseClicked += OnMouseClicked; hook.OnMouseEntered += OnMouseEntered; hook.OnMouseExited += OnMouseExited; hook.OnMousePressed += OnMousePressed; hook.OnMouseReleased += OnMouseReleased; System.Windows.Forms.Application.Run(form); } catch (Exception ex) { log(ex.ToString()); } }
public void Start() { _serverPipe.Error += OnError; _serverPipe.ClientConnected += OnClientConnected; _serverPipe.ClientMessage += ClientMessageEventHandler; _serverPipe.Start(); }
static void Main(string[] args) { try { form = new MainWindow(); pipe = new NamedPipeServer <JavaEvent>("openrpa_javabridge"); pipe.ClientMessage += Server_OnReceivedMessage; pipe.Start(); hook = new JavaHook(); hook.OnJavaShutDown += OnJavaShutDown; hook.OnMouseClicked += OnMouseClicked; hook.OnMouseEntered += OnMouseEntered; hook.OnMouseExited += OnMouseExited; hook.OnMousePressed += OnMousePressed; hook.OnMouseReleased += OnMouseReleased; System.Windows.Forms.Application.Run(form); } catch (Exception ex) { System.IO.File.AppendAllText("log.txt", ex.ToString()); throw; } }
private void HandleMultiInstance() { _mutex = new Mutex(true, @"Global\WinDynamicDesktop", out bool isFirstInstance); GC.KeepAlive(_mutex); if (isFirstInstance) { _namedPipe = new NamedPipeServer <string>("WinDynamicDesktop"); _namedPipe.ClientMessage += OnNamedPipeClientMessage; _namedPipe.Start(); } else { if (ThemeManager.importPaths.Count > 0) { var namedPipeClient = new NamedPipeClient <string>("WinDynamicDesktop"); namedPipeClient.Start(); namedPipeClient.WaitForConnection(); namedPipeClient.PushMessage(string.Join("|", ThemeManager.importPaths)); Thread.Sleep(1000); namedPipeClient.Stop(); } else { MessageBox.Show(_("Another instance of WinDynamicDesktop is already " + "running. You can access it by clicking on the icon in the system tray."), _("Error"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } Environment.Exit(0); } }
private static bool KillOtherInstanceAndRestart(string pipeName, bool createdNew) { //Mutex used by another instance of the app //Ask the other instance to stop and restart this instance to get the mutex again. if (!createdNew) { using var pipeClient = new NamedPipeClient(pipeName); Log.Information("Other instance detected."); pipeClient.SendMsg("Close"); Log.Information("Other instance detected: asked to stop, restarting now."); RestartApp(); return(true); } using var pipeServer = new NamedPipeServer(pipeName); pipeServer.Start(message => { if (message == "Close") { Log.Information("Other instance detected and asked to stop."); Application.Exit(); } }); return(false); }
private void HandleMultiInstance() { _mutex = new Mutex(true, @"Global\WinDynamicDesktop", out bool isFirstInstance); GC.KeepAlive(_mutex); if (isFirstInstance) { _namedPipe = new NamedPipeServer <string[]>("WinDynamicDesktop"); _namedPipe.ClientMessage += OnNamedPipeClientMessage; _namedPipe.Start(); } else { if (ThemeManager.importPaths.Count > 0) { // TODO Test passing string[] through named pipe var namedPipeClient = new NamedPipeClient <string[]>("WinDynamicDesktop"); namedPipeClient.Start(); namedPipeClient.WaitForConnection(); namedPipeClient.PushMessage(ThemeManager.importPaths.ToArray()); Thread.Sleep(1000); namedPipeClient.Stop(); } else { MessageDialog.ShowWarning(_("Another instance of WinDynamicDesktop is already running. You can " + "access it by clicking on the icon in the system tray."), _("Error")); } Environment.Exit(0); } }
public void SetUp() { Logger.Debug("Setting up test..."); _barrier.Reset(); _exceptions.Clear(); var serializer = new BinaryFormatterSerializer <TestCollection>(); _server = new NamedPipeServer <TestCollection>(PipeName, serializer); _client = new NamedPipeClient <TestCollection>(PipeName, serializer); _expectedData = null; _expectedHash = 0; _actualData = null; _actualHash = 0; _clientDisconnected = false; _server.ClientMessage += ServerOnClientMessage; _server.Error += OnError; _client.Error += OnError; _server.Start(); _client.Start(); // Give the client and server a few seconds to connect before sending data Thread.Sleep(TimeSpan.FromSeconds(1)); Logger.Debug("Client and server started"); Logger.Debug("---"); _startTime = DateTime.Now; }
static void Main(string[] args) { var server = new NamedPipeServer <Message>("localhost"); server.ClientConnected += delegate(NamedPipeConnection <Message, Message> conn){ var messageConnected = new Message { Text = string.Format("Client {0} is now connected!", conn.Id) }; Console.WriteLine(messageConnected.Text); conn.PushMessage(new Message { Text = "Welcome!" }); }; server.ClientDisconnected += delegate(NamedPipeConnection <Message, Message> conn) { var messageDisconnected = new Message { Text = string.Format("Client {0} is now disconnected!", conn.Id) }; Console.WriteLine(messageDisconnected.Text, conn.Id); }; server.ClientMessage += delegate(NamedPipeConnection <Message, Message> conn, Message msg){ Console.WriteLine("Client {0} says: {1}", conn.Id, msg.Text); }; // Start up the server asynchronously and begin listening for connections. // This method will return immediately while the server runs in a separate background thread. server.Start(); Console.ReadKey(); }
private void Form1_Load(object sender, EventArgs e) { _avalonFloatWindow.MainForm = this; ThreadPool.QueueUserWorkItem(new WaitCallback(GetAdProc), this); ThreadPool.QueueUserWorkItem(new WaitCallback(UpdateAdPictureProc), this); string temp = _currentDir.TrimEnd("\\/".ToCharArray()); string parentDir = Path.GetDirectoryName(temp); _bfgMinerDir = Path.Combine(parentDir, Constants.BfgMinerDirName); _bfgMinerPath = Path.Combine(_bfgMinerDir, Constants.BfgMinerFileName); _configPath = Path.Combine(_currentDir, ConfigFileName); LOG.Info("config path: " + _configPath); _appConfig = new AvalonConfig(_configPath); _appConfig.LoadConfig(); _processManager = new ProcessManager(); _summaryQueue = new Queue <SummaryResult>(); //DebugMinerData(); string windowsRoot = Environment.GetEnvironmentVariable("SystemRoot"); string systemDir = Environment.SystemDirectory; string pathValue = string.Format("{0};{1};{2};", _bfgMinerDir, systemDir, windowsRoot); Environment.SetEnvironmentVariable("PATH", pathValue); int screenWidth = Screen.PrimaryScreen.Bounds.Width; int screenHeight = Screen.PrimaryScreen.Bounds.Height; //_avalonFloatWindow.Location = new Point(screenWidth - 186 - 50, 50); _avalonFloatWindow.Location = new Point(screenWidth - 261 - 50, 50); _avalonFloatWindow.USBCount = DeviceCounter.GetNanoCount(); LOG.Info("Form_load, usb count: " + _avalonFloatWindow.USBCount); if (_avalonFloatWindow.USBCount > 0) { RunMinerAndMonitorData(); _avalonFloatWindow.Show(); notifyIcon1.Visible = true; _avalonFloatWindowVisible = true; } else { //_avalonFloatWindow.Show(); notifyIcon1.Visible = false; _avalonFloatWindowVisible = false; this.Visible = this.ShowInTaskbar = false; } _namedpipeServer.ClientConnected += OnClientConnected; _namedpipeServer.ClientDisconnected += OnClientDisconnected; _namedpipeServer.ClientMessage += OnClientMessage; _namedpipeServer.Start(); }
public void StartServer() { _server = new NamedPipeServer <PipedData>(ServerName); _server.ClientMessage += (connection, message) => ReceieveClientMessage(message); _server.Start(); Registry.SetValue(@"HKEY_CURRENT_USER\Software\Classes\nxm\shell\open\command", "", $"\"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Automaton.exe")}\" \"%1\""); }
public static void INIT() //inicializa a comunicação por "pipes" { PServer1 = new NamedPipeServer(@"\\.\pipe\PetServerPipe0", 0); //sread PServer2 = new NamedPipeServer(@"\\.\pipe\PetServerPipe1", 1); //swrite PServer1.Start(); PServer2.Start(); NamedPipeServer.OnDataReceived += SeverResponse;//sempre que onDataR.. for chamado , chama serverRes.. com o parâmetro }
public static NamedPipeServer <string[]> StartServer() { var namedPipeServer = new NamedPipeServer <string[]>("WinDynamicDesktop"); namedPipeServer.ClientMessage += OnNamedPipeClientMessage; namedPipeServer.Start(); return(namedPipeServer); }
public PipeMemory(Process proc) : base(proc) { string pipename = string.Format("BmpPipe{0}", proc.Id); dataPipe = new NamedPipeServer <PipeData>(pipename); dataPipe.ClientConnected += ClientConnected; dataPipe.Start(); Console.WriteLine(string.Format("Pipe name: {0}", pipename)); }
protected override void OnStart(string[] args) { _timer.Elapsed += OnElapsedTime; _timer.Interval = 3000; //_timer.Enabled = true; //_timer.Start(); _server.Start(); _fileServer.Start(); }
public Program() { _server = new NamedPipeServer <byte[]>("aDrumsSimulatorPipe"); _server.ClientConnected += OnClientConnected; _server.ClientDisconnected += OnClientDisconnected; _server.ClientMessage += OnClientMessage; _server.Error += OnError; _server.Start(); Log("Pipe-Server started"); }
public void Start() { server.Start(); Enabled = true; while (KeepRunning) { // Do nothing - wait for user to press 'q' key } server.Stop(); }
public static void init(int id) { var server = new NamedPipeServer <byte[]>(id.ToString()); server.ClientConnected += OnClientConnected; server.ClientDisconnected += OnClientDisconnected; server.ClientMessage += OnClientMessage; server.Error += OnError; server.Start(); }
public void StartServerAndClientAndDispose() { var pipeName = Guid.NewGuid().ToString("N"); var server = new NamedPipeServer(pipeName, 1, 1, (s, e) => {}); server.Start(); var client = new NamedPipeClient(pipeName, 100); client.Dispose(); server.Dispose(); }
/// <summary> /// Initializes a new instance of the <see cref="DataTableVisualizerToolWindowControl"/> class. /// </summary> public DataTableVisualizerToolWindowControl() { this.InitializeComponent(); this.Loaded += OnLoaded; this.Unloaded += OnUnloaded; _server = new NamedPipeServer <DataTable>("DataTablePipe"); _server.ClientMessage += ServerOnClientMessage; _server.Start(); }
static void Main() { var server = new NamedPipeServer(Options.PipeName); Greeter.BindService(server.ServiceBinder, new GreeterService()); server.Start(); Console.WriteLine("Server started."); Console.ReadLine(); }
public ModHook() { if (System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName.Contains("Staxel.Server")) { _pipeServer.ClientConnected += _pipeServer_ClientConnected; _pipeServer.ClientMessage += _pipeServer_ClientMessage; _pipeServer.Start(); } }
private void StartNamedPipe() { if (this.enlistment.NamedPipeName.Length > MaxPipeNameLength) { this.FailMountAndExit("Failed to create mount point. Mount path exceeds the maximum number of allowed characters"); } NamedPipeServer pipeServer = new NamedPipeServer(this.enlistment.NamedPipeName, this.HandleConnection); pipeServer.Start(); }
public void Start() { _settings.Validate(); if (_versionDetector == null) { _versionDetector = new NewVersionDetector(_settings.PickupPath, _settings.AppDirectory); _versionDetector.VersionFound += OnNewVersion; } _versionDetector.Start(); _server.Start(); }
static void Server() { var server = new NamedPipeServer(pipeName, 4, 1); server.RequestReceived += (s, e) => e.Response = "Echo. " + e.Request; server.Start(); Console.WriteLine("Server started"); Task.Delay(10000).Wait(); Console.WriteLine("Server shutdown"); server.Dispose(); }
public Service(string id, Application application) { if (application is null) { throw new ArgumentNullException(nameof(application)); } Server = new NamedPipeServer(XamlTest.Server.PipePrefix + id); Protocol.BindService(Server.ServiceBinder, new VisualTreeService(application)); Server.Start(); }
public MyServer(string pipeName) { var server = new NamedPipeServer<MyMessage>(pipeName); server.ClientConnected += OnClientConnected; server.ClientDisconnected += OnClientDisconnected; server.ClientMessage += OnClientMessage; server.Error += OnError; server.Start(); while (KeepRunning) { // Do nothing - wait for user to press 'q' key } server.Stop(); }
public Events() { _server = new NamedPipeServer<string>("io-jaywick-labs-pastr-messaging"); _server.ClientMessage += server_ClientMessage; _server.Start(); _ahkEngine = new AutoHotkey.Interop.AutoHotkeyEngine(); _shortcutCallbackMap = new Dictionary<string, Action>(); ReserveHotKey("^+z", () => OnInvokeDrop.SafeInvoke()); ReserveHotKey("^+x", () => OnInvokeShunt.SafeInvoke()); ReserveHotKey("^+c", () => OnInvokePush.SafeInvoke()); ReserveHotKey("^+v", () => OnInvokePeek.SafeInvoke()); ReserveHotKey("^+b", () => OnInvokePop.SafeInvoke()); ReserveHotKey("^+a", () => OnInvokeExpire.SafeInvoke()); ReserveHotKey("^+s", () => OnInvokePinch.SafeInvoke()); ReserveHotKey("^+d", () => OnInvokeWipe.SafeInvoke()); ReserveHotKey("^+w", () => OnInvokeSwap.SafeInvoke()); ReserveHotKey("^+f", () => OnInvokePoke.SafeInvoke()); ReserveHotKey("^+q", () => OnInvokeRotateLeft.SafeInvoke()); ReserveHotKey("^+e", () => OnInvokeRotateRight.SafeInvoke()); ReserveHotKey("^+r", () => OnInvokeReverse.SafeInvoke()); RegisterHotKeys(); }
private void StartServer() { Server = new NamedPipeServer(NAME_OF_PIPE); Server.OnReceivedMessage += new EventHandler<ReceivedMessageEventArgs>(Server_OnReceivedMessage); Server.Start(); }