コード例 #1
0
 public static void checkForPipes(bool chrome, bool ff)
 {
     //registreChromeNativeMessagingHost(false);
     //registreffNativeMessagingHost(false);
     if (chromepipe == null && chrome)
     {
         var SessionId = System.Diagnostics.Process.GetCurrentProcess().SessionId;
         chromepipe = new NamedPipeClientAsync <NativeMessagingMessage>(SessionId + "_" + PIPE_NAME + "_chrome");
         chromepipe.ServerMessage += Client_OnReceivedMessage;
         chromepipe.Disconnected  += () => { onDisconnected?.Invoke("chrome"); };
         chromepipe.Connected     += () => { Connected?.Invoke("chrome"); Task.Run(() => enumwindowandtabs()); };
         chromepipe.Error         += (e) => { Log.Debug(e.ToString()); };
         chromepipe.Start();
     }
     if (ffpipe == null && ff)
     {
         var SessionId = System.Diagnostics.Process.GetCurrentProcess().SessionId;
         ffpipe = new NamedPipeClientAsync <NativeMessagingMessage>(SessionId + "_" + PIPE_NAME + "_ff");
         ffpipe.ServerMessage += Client_OnReceivedMessage;
         ffpipe.Disconnected  += () => { onDisconnected?.Invoke("ff"); };
         ffpipe.Connected     += () => { Connected?.Invoke("ff"); Task.Run(() => enumwindowandtabs()); };
         ffpipe.Error         += (e) => { Log.Debug(e.ToString()); };
         ffpipe.Start();
     }
 }
コード例 #2
0
ファイル: NMHook.cs プロジェクト: sanshao27/openrpa
 public static void checkForPipes(bool chrome, bool ff)
 {
     registreChromeNativeMessagingHost(false);
     registreffNativeMessagingHost(false);
     if (chromepipe == null && chrome)
     {
         chromepipe = new NamedPipeClientAsync <NativeMessagingMessage>(PIPE_NAME + "_chrome");
         chromepipe.ServerMessage += Client_OnReceivedMessage;
         chromepipe.Disconnected  += () => { onDisconnected?.Invoke("chrome"); };
         chromepipe.Connected     += () => { Connected?.Invoke("chrome"); Task.Run(() => reloadtabs()); };
         chromepipe.Error         += (e) => { Log.Debug(e.ToString()); };
         chromepipe.Start();
         //chromepipe.OnReceivedMessage += Client_OnReceivedMessage;
         //chromepipe.onDisconnected += () => { onDisconnected?.Invoke(); };
         //chromepipe.onConnected += (pipe) => { FoundBrowser?.Invoke("chrome"); };
     }
     if (ffpipe == null && ff)
     {
         ffpipe = new NamedPipeClientAsync <NativeMessagingMessage>(PIPE_NAME + "_ff");
         ffpipe.ServerMessage += Client_OnReceivedMessage;
         ffpipe.Disconnected  += () => { onDisconnected?.Invoke("ff"); };
         ffpipe.Connected     += () => { Connected?.Invoke("ff"); Task.Run(() => reloadtabs()); };
         ffpipe.Error         += (e) => { Log.Debug(e.ToString()); };
         ffpipe.Start();
         //ffpipe = new rpa.pipe.NamedPipeClient<NativeMessagingMessage>(PIPE_NAME + "_ff", true);
         //ffpipe.OnReceivedMessage += Client_OnReceivedMessage;
         //ffpipe.onDisconnected += () => { onDisconnected?.Invoke(); };
         //ffpipe.onConnected += (pipe) => { FoundBrowser?.Invoke("ff"); };
     }
 }