Beispiel #1
0
 private static void InitializeIpc()
 {
     AgentChannel = ChannelServices.GetChannel("LagfreeAgentClient") as IpcClientChannel;
     if (AgentChannel == null)
     {
         AgentChannel = new IpcClientChannel("LagfreeAgentClient", null);
         ChannelServices.RegisterChannel(AgentChannel, true);
     }
     RemotingConfiguration.RegisterWellKnownClientType(typeof(VisiblePids), "ipc://LagfreeAgent/VisiblePids");
     ForegroundPids = new VisiblePids();
 }
 private static void ShutdownAgent()
 {
     try
     {
         IpcClientChannel AgentChannel;
         VisiblePids      ForegroundPids = null;
         AgentChannel = new IpcClientChannel();
         ChannelServices.RegisterChannel(AgentChannel, true);
         RemotingConfiguration.RegisterWellKnownClientType(typeof(VisiblePids), "ipc://LagfreeAgent/VisiblePids");
         ForegroundPids = new VisiblePids();
         int pid = ForegroundPids.GetPid();
         using (var proc = Process.GetProcessById(pid))
         {
             ForegroundPids.Exit();
             proc.WaitForExit();
         }
     }
     catch (Exception) { }
 }