private void _pipeServer_ClientConnected(NamedPipeConnection <PipeClass, PipeClass> connection) { connection.PushMessage(new PipeClass { Current = KeyEnum.Connected }); connection.PushMessage(new PipeClass { Current = KeyEnum.OnlineUsers, Data = _serverUsers.Select(x => x.PlayerEntityLogic.DisplayName()).ToList() }); }
private void OnClientConnected(NamedPipeConnection <string, string> connection) { _clients.Add(connection.Name); AddLine("<b>" + connection.Name + "</b> connected!"); UpdateClientList(); connection.PushMessage("Welcome! You are now connected to the server."); }
private void SendPipeMessage(PacketID packetId, bool isIdle = false, string data = "", string data2 = "", PacketID requestId = PacketID.None, NamedPipeConnection <IdleMessage, IdleMessage> connection = null) { try { if (connection == null) { server.PushMessage(new IdleMessage { packetId = (int)packetId, isIdle = isIdle, requestId = (int)requestId, data = data, data2 = data2 }); } else { connection.PushMessage(new IdleMessage { packetId = (int)packetId, isIdle = isIdle, requestId = (int)requestId, data = data, data2 = data2 }); } } catch (Exception ex) { Utilities.Log("SendPipeMessage: " + ex.Message); } }
private void OnClientConnected(NamedPipeConnection<string, string> connection) { _clients.Add(connection.Name); AddLine("<b>" + connection.Name + "</b> connected!"); UpdateClientList(); connection.PushMessage("Welcome! You are now connected to the server."); }
private void Server_ClientConnected(NamedPipeConnection<PipeMessage, PipeMessage> connection) { Console.WriteLine("Client {0} is now connected.", connection.Id); if (!CancelToken.IsCancellationRequested) connection.PushMessage(new PipeMessage() { Ack = true }); }
private void OnClientMessage(NamedPipeConnection <PipeMessageCommand, PipeMessageCommand> connection, PipeMessageCommand message) { stopwatchLastCommand.Restart(); if (message.Command == "Quit!") { KeepRunning = false; } if (message.Command.StartsWith("File")) { string fullFilePath = message.FullFileName; WriteResponseLine("Client {" + connection.Id + "} Proccessing file: {" + fullFilePath + "}"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Metadata metadata = databaseWindowsLivePhotGallery.Read(MetadataBrokerType.WindowsLivePhotoGallery, fullFilePath); WriteResponseLine( "Client ID: {" + connection.Id + "}, " + (metadata == null ? "File not found" : "Data found") + " " + "File: {" + fullFilePath + "}, " + "Time Elapsed Milliseconds: {" + stopwatch.ElapsedMilliseconds.ToString() + "}"); PipeMessageCommand pipeMessageCommand = new PipeMessageCommand(); pipeMessageCommand.FullFileName = fullFilePath; pipeMessageCommand.Command = "File"; pipeMessageCommand.Message = "File:" + fullFilePath; pipeMessageCommand.Metadata = metadata; connection.PushMessage(pipeMessageCommand); } else { WriteResponseLine("Unknown command: " + message.Command); } }
private void TheServer_ClientConnected(NamedPipeConnection <ContextContent, ContextContent> connection) { // Send current context this.Log("[SharedContext Server] Client connected. " + connection.Name + " > " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fffff tt")); this.Log("[SharedContext Server] Sending context: " + this.deserialisedContextContents.ToString() + " > " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fffff tt")); connection.PushMessage(this.deserialisedContextContents); }
private static void Error(NamedPipeConnection <Message, Message> conn) { conn.PushMessage(new Message() { Command = Command.Error, Data = null }); }
private void OnClientConnected(NamedPipeConnection<MyMessage, MyMessage> connection) { Console.WriteLine("Client {0} is now connected!", connection.Id); connection.PushMessage(new MyMessage { Id = new Random().Next(), Text = "Welcome!" }); }
private void OnClientConnected(NamedPipeConnection <MyMessage, MyMessage> connection) { Console.WriteLine("Client {0} is now connected!", connection.Id); connection.PushMessage(new MyMessage { Id = new Random().Next(), Text = "Welcome!" }); }
private void Server_ClientConnected(NamedPipeConnection <string[], string[]> conn) { Console.WriteLine($"Client Connected with id: {conn.Name}"); if (!Clients.Contains(DesktopManager.CurrentDesktop.Name)) { Clients.Add(DesktopManager.CurrentDesktop.Name); } conn.PushMessage(new string[] { "CurrentDesktopName", DesktopManager.CurrentDesktop.Name }); }
private void OnClientConnected(NamedPipeConnection <PipeMessageCommand, PipeMessageCommand> connection) { WriteResponseLine("Client {" + connection.Id + "} is now connected!"); PipeMessageCommand pipeMessageCommand = new PipeMessageCommand(); pipeMessageCommand.FullFileName = ""; pipeMessageCommand.Command = "Hello"; pipeMessageCommand.Message = "Hello"; connection.PushMessage(pipeMessageCommand); }
// TODO: these functions should not block the ipc thread /// <summary> /// Handles messages that are sent by clients by dispatching functions and then sending the results back /// </summary> /// <param name="connection"></param> /// <param name="message"></param> private static void OnClientMessage(NamedPipeConnection <SerializedFunction, SerializedResult> connection, SerializedFunction message) { // The pipeId that comes in from the message is the clients unique pipe id, // But that is not unique on the server, so we use the connections id. lock (client_lock) { // Log.WriteLine("Client message..."); // Log.WriteLine("{{"); // Log.WriteLine("\tClientId = {0}", message.ClientId); // Log.WriteLine("\tJobId = {0}", message.JobId); // Log.WriteLine("\tInterfaceId = {0}", message.InterfaceId); // Log.WriteLine("\tPipeId = \"{0}\"", connection.Id); // Log.WriteLine("\tName = \"{0}\"", message.Name); // if (message.Args == null) // { // Log.WriteLine("\tArgs = {}"); // } // else // { // Log.WriteLine("\tArgs = {{{0}}}", String.Join(",", message.Args)); // } // Log.WriteLine("}}"); Log.WriteLine("[{3}] [ClientMessage c: {1} p: {2}] \"{0}\"", message.Name, message.ClientId, message.PipeId, message.JobId); object result = null; try { result = Client.CallSerializedFunction(connection.Id, message.ClientId, message.InterfaceId, message.Name, message.Args); } catch (Exception e) { Console.WriteLine("Error occured processing job {0}, \"{1}\"", message.JobId, e.Message); } var result_message = new SerializedResult { PipeId = message.PipeId, ClientId = message.ClientId, InterfaceId = message.InterfaceId, JobId = message.JobId, Result = result, Args = message.Args, }; connection.PushMessage(result_message); } }
// 客户端连接上了NamedPipe private void OnClientConnected(NamedPipeConnection<string, string> connection) { connection.PushMessage(Constants.NamedPipe_Connect_Message); connection.PushMessage(Constants.NamedPipe_Command_USBCounting); }
protected void OnMessage(NamedPipeConnection <Message, Message> connection, Message message) { Console.WriteLine("OnMessage Received {0}, {1}, {2}", message.Command, message.Data?.GetType()?.Name, message.Property); switch (message.Command) { case Command.Set: { object obj; if (!variableObjects.TryGetValue(message.VariableName, out obj)) { Error(connection); return; } if (obj == null) { Error(connection); return; } Type objType = obj.GetType(); var propInfo = objType.GetProperty(message.Property); if (propInfo == null) { Error(connection); return; } try { propInfo.SetValue(obj, message.Data); } catch (Exception ex) { Error(connection); } } break; case Command.Get: { object obj; if (!variableObjects.TryGetValue(message.VariableName, out obj)) { Error(connection); return; } if (obj == null) { Error(connection); return; } Type objType = obj.GetType(); var propInfo = objType.GetProperty(message.Property); if (propInfo == null) { Error(connection); return; } try { object ret = propInfo.GetValue(obj); connection.PushMessage(new Message(message.Id) { Command = Command.GetResponse, Property = message.Property, VariableName = message.VariableName, Data = ret }); } catch (Exception ex) { Error(connection); } } break; case Command.Call: { object obj; if (!variableObjects.TryGetValue(message.VariableName, out obj)) { Error(connection); return; } if (obj == null) { Error(connection); return; } Type objType = obj.GetType(); var methodInfo = objType.GetMethod(message.Property); if (methodInfo == null) { Error(connection); return; } try { object ret = methodInfo.Invoke(obj, message.Data as object[]); connection.PushMessage(new Message(message.Id) { Command = Command.Response, Property = message.Property, VariableName = message.VariableName, Data = ret }); } catch (Exception ex) { Error(connection); } } break; } }
public void SendMessage(Message message) { pipe.PushMessage(message); }
private void OnServerMessage(NamedPipeConnection <IdleMessage, IdleMessage> connection, IdleMessage message) { Config.sessionLaunchAttempts = 0; Config.isPipeConnected = true; switch (message.packetId) { case ((int)PacketID.Idle): Utilities.Debug("Idle received from " + message.data + ": " + message.isIdle); if (Config.isUserLoggedIn) { client.PushMessage(new IdleMessage { packetId = (int)PacketID.Message, isIdle = false, requestId = (int)PacketID.None, data = "You have been detected as " + (message.isIdle ? "idle." : "active.") }); Config.cpuUsageQueue = new Queue <int>(); Config.isUserIdle = message.isIdle; OnMinerTimerEvent(minerTimer, null); //call the minerTime event immediately to process the change. } break; case ((int)PacketID.Pause): Config.isMiningPaused = true; Utilities.KillMiners(); Utilities.Log("Mining has been paused by IdleMon."); connection.PushMessage(new IdleMessage { packetId = (int)PacketID.Pause, isIdle = false, requestId = (int)PacketID.None, data = "" }); break; case ((int)PacketID.Resume): Config.isMiningPaused = false; Utilities.Log("Mining has been resumed by IdleMon."); connection.PushMessage(new IdleMessage { packetId = (int)PacketID.Resume, isIdle = false, requestId = (int)PacketID.None, data = "" }); break; case ((int)PacketID.Stop): Abort(); break; case ((int)PacketID.IgnoreFullscreenApp): Config.settings.ignoredFullscreenApps.Add(message.data); Config.WriteConfigToFile(); break; case ((int)PacketID.Fullscreen): lock (Config.timeLock) { if (message.isIdle && Config.fullscreenDetected != true) { Utilities.Log("idleMon detected Fullscreen program: " + message.data); client.PushMessage(new IdleMessage { packetId = (int)PacketID.Message, isIdle = false, requestId = (int)PacketID.None, data = "Mining has been stopped because " + message.data + " was detected fullscreen." }); Utilities.KillMiners(); } Config.fullscreenDetected = message.isIdle; } break; case ((int)PacketID.Hello): Utilities.Log("idleMon user " + message.data + " connected."); Config.isUserIdle = message.isIdle; connection.PushMessage(new IdleMessage { packetId = (int)PacketID.Log, isIdle = Config.settings.enableLogging, requestId = (int)PacketID.None, data = "" }); connection.PushMessage(new IdleMessage { packetId = (int)PacketID.Notifications, isIdle = Config.settings.showDesktopNotifications, requestId = (int)PacketID.None, data = "" }); connection.PushMessage(new IdleMessage { packetId = (int)PacketID.IdleTime, isIdle = false, requestId = (int)PacketID.None, data = Config.settings.minutesUntilIdle.ToString() }); connection.PushMessage(new IdleMessage { packetId = (int)PacketID.Fullscreen, isIdle = Config.settings.monitorFullscreen, requestId = (int)PacketID.None, data = "" }); foreach (var app in Config.settings.ignoredFullscreenApps) { connection.PushMessage(new IdleMessage { packetId = (int)PacketID.IgnoreFullscreenApp, isIdle = false, requestId = (int)PacketID.None, data = app }); } if (Config.isMiningPaused) { connection.PushMessage(new IdleMessage { packetId = (int)PacketID.Hello, isIdle = false, requestId = (int)PacketID.Pause, data = "" }); } else { connection.PushMessage(new IdleMessage { packetId = (int)PacketID.Hello, isIdle = false, requestId = (int)PacketID.Resume, data = "" }); } break; default: Utilities.Debug("MiningService Idle default: " + message.packetId); break; } }
private void OnClientConnected(NamedPipeConnection <string, string> connection) { Console.WriteLine("Client {0} is now connected!", connection.Id); connection.PushMessage("welcome"); }
private void OnServerMessage(NamedPipeConnection <IdleMessage, IdleMessage> connection, IdleMessage message) { Config.sessionLaunchAttempts = 0; Config.isPipeConnected = true; if (!Config.hasClientAuthenticated && message.packetId != (int)Config.PacketID.Authenticate) { Utilities.Log($"{connection.Name}: has not authenticated, and sending non-auth first packet; closing pipe: {message.packetId}"); connection.Close(); } switch (message.packetId) { case ((int)Config.PacketID.Authenticate): if (Utilities.VerifyAuthString(message.data, message.data2)) { Utilities.Log($"{message.data2} has authenticated successfully."); Config.hasClientAuthenticated = true; connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.Authenticate, isIdle = false, requestId = (int)Config.PacketID.None, data = Utilities.GenerateAuthString("SYSTEM"), data2 = "SYSTEM" }); } else { Utilities.Log($"{connection.Name}: incorrect authentication packet; closing pipe."); connection.Close(); } break; case ((int)Config.PacketID.Idle): Utilities.Debug("Idle received from " + message.data + ": " + message.isIdle); if (Config.isUserLoggedIn) { if (!Config.isMiningPaused) { connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.Message, isIdle = false, requestId = (int)Config.PacketID.None, data = "You have been detected as " + (message.isIdle ? "idle." : "active.") }); } else { if (!message.isIdle) { connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.Message, isIdle = false, requestId = (int)Config.PacketID.None, data = "You have been detected as active but mining is paused!" }); } } Config.cpuUsageQueue = new Queue <int>(); Config.isUserIdle = message.isIdle; OnMinerTimerEvent(minerTimer, null); //call the minerTime event immediately to process the change. } break; case ((int)Config.PacketID.Pause): Config.isMiningPaused = true; Utilities.KillMiners(); Utilities.Log("Mining has been paused by IdleMon."); connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.Pause, isIdle = false, requestId = (int)Config.PacketID.None, data = "" }); break; case ((int)Config.PacketID.Resume): Config.isMiningPaused = false; Utilities.Log("Mining has been resumed by IdleMon."); connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.Resume, isIdle = false, requestId = (int)Config.PacketID.None, data = "" }); break; case ((int)Config.PacketID.Stop): Abort(); break; case ((int)Config.PacketID.IgnoreFullscreenApp): Config.settings.ignoredFullscreenApps.Add(message.data); Config.WriteConfigToFile(); break; case ((int)Config.PacketID.Fullscreen): lock (Config.timeLock) { if (message.isIdle && Config.fullscreenDetected != true && !Config.isMiningPaused) { Utilities.Log("idleMon detected Fullscreen program: " + message.data); connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.Message, isIdle = false, requestId = (int)Config.PacketID.None, data = "Mining has been stopped because " + message.data + " was detected fullscreen." }); } if (message.isIdle) { Utilities.KillMiners(); } Config.fullscreenDetected = message.isIdle; } break; case (int)Config.PacketID.RunInUserSession: Utilities.Log($"RunInUserSession received: {message.isIdle}"); Config.settings.runInUserSession = message.isIdle; Utilities.KillMiners(); break; case ((int)Config.PacketID.Hello): Utilities.Log($"idleMon user {message.data} connected"); Config.isUserIdle = message.isIdle; connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.Log, isIdle = Config.settings.enableLogging, requestId = (int)Config.PacketID.None, data = "" }); connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.Notifications, isIdle = Config.settings.showDesktopNotifications, requestId = (int)Config.PacketID.None, data = "" }); connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.IdleTime, isIdle = false, requestId = (int)Config.PacketID.None, data = Config.settings.minutesUntilIdle.ToString() }); connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.Fullscreen, isIdle = Config.settings.monitorFullscreen, requestId = (int)Config.PacketID.None, data = "" }); // connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.CheckFullscreenStillRunning, isIdle = Config.settings.checkIfFullscreenAppStillRunning, requestId = (int)Config.PacketID.None, data = "" }); connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.RunInUserSession, isIdle = Config.settings.runInUserSession, requestId = (int)Config.PacketID.None, data = "" }); foreach (var app in Config.settings.ignoredFullscreenApps) { connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.IgnoreFullscreenApp, isIdle = false, requestId = (int)Config.PacketID.None, data = app }); } if (Config.isMiningPaused) { connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.Hello, isIdle = false, requestId = (int)Config.PacketID.Pause, data = "" }); } else { connection.PushMessage(new IdleMessage { packetId = (int)Config.PacketID.Hello, isIdle = false, requestId = (int)Config.PacketID.Resume, data = "" }); } break; default: Utilities.Debug("MiningService Idle default: " + message.packetId); break; } }
static void server_ClientConnected(NamedPipeConnection <string, string> connection) { Console.WriteLine("Client {0} is now connected!", connection.Id); connection.PushMessage(JsonConvert.SerializeObject(data)); Console.WriteLine(" data is pushed for conn {0}", connection.Id); }
private void ClientConnected(NamedPipeConnection <PipeData, PipeData> connection) { Console.WriteLine("Client connected"); this.ResetCache(); connection.PushMessage(CreatePipeData(notFoundSignatures)); }
private void OnClientConnected(NamedPipeConnection <string, string> connection) { Console.WriteLine($"Client {connection.Id} is now connected!"); connection.PushMessage($"Welcome {connection.Name}"); }
private void NpClient_ServerMessage(NamedPipeConnection <string, string> connection, string message) { if (tPumpUIUpdatesPreServiceStart != null && tPumpUIUpdatesPreServiceStart.Enabled == true) { tPumpUIUpdatesPreServiceStart.Stop(); } if (message == "Initialize pipe") { connection.PushMessage("Initialize pipe"); return; } if (message.StartsWith("\r\nInitialized service for trace with ID: ")) { Invoke(new System.Action(() => { txtStatus.Text = "Initializing SSAS diagnostics collection at " + DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss UTCzzz") + ".\r\n" + "Collection service SSASDiag_MSSQLSERVER started."; InitializeCaptureUI(); })); } if (message.StartsWith("\r\nCreated temporary folder ")) { txtFolderZipForAnalysis.Invoke(new System.Action(() => txtFolderZipForAnalysis.Text = m_analysisPath = Environment.CurrentDirectory + "\\" + message.Replace("\r\nCreated temporary folder ", "").Replace(" to collect diagnostic files.", "") + (chkZip.Checked && chkDeleteRaw.Checked ? ".zip" : "") )); } if (message.StartsWith("\r\nDiagnostics captured for ") || // && LastStatusLine.StartsWith("Diagnostics captured for ")) || message.StartsWith("\r\nTime remaining until collection starts: ")) //&& LastStatusLine.StartsWith("Time remaining until collection starts: "))) { string LastStatusLine = ""; txtStatus.Invoke(new System.Action(() => { if (txtStatus.Text.Length > 0) { LastStatusLine = txtStatus.Lines.Last(); } })); if (LastStatusLine != "" && LastStatusLine.StartsWith(message.Substring(2, 20))) { txtStatus.Invoke(new System.Action(() => { txtStatus.Text = txtStatus.Text.Replace(LastStatusLine, message.Replace("\r\n", "")); txtStatus.SelectionStart = txtStatus.TextLength; txtStatus.ScrollToCaret(); } )); } else { Invoke(new System.Action(() => { if (btnCapture.Image.Tag as string == "Play Half Lit") { btnHangDumps.Enabled = true; btnCapture.Image = imgStop; btnCapture.Click += btnCapture_Click; } })); txtStatus.Invoke(new System.Action(() => txtStatus.AppendText(message))); } } else if (message.StartsWith("\r\nWaiting for client interaction:\r\n")) { string uiMsg = message.Replace("\r\nWaiting for client interaction:\r\n", ""); if (uiMsg.StartsWith("Windows Administrator required for remote server:") && pp != null) { if (uiMsg.EndsWith("TryingAgain")) { uiMsg = uiMsg.Replace("TryingAgain", ""); pp.lblUserPasswordError.Visible = true; } pp.UserMessage = uiMsg; Invoke(new System.Action(() => { pp.Top = Top + Height / 2 - pp.Height / 2; pp.Left = Left + Width / 2 - pp.Width / 2; })); Invoke(new System.Action(() => { if (!pp.IsDisposed) { pp.Show(); } Enabled = false; } )); } } else if (message == "Dumping") { btnCapture.Image = imgStopHalfLit; btnCapture.Click -= btnCapture_Click; btnHangDumps.Invoke(new System.Action(() => { btnHangDumps.Enabled = false; })); } else if (message == "DumpingOver") { btnCapture.Image = imgStop; btnCapture.Click += btnCapture_Click; btnHangDumps.Invoke(new System.Action(() => { btnHangDumps.Enabled = true; })); } else if (message == "\r\nStop") { Invoke(new System.Action(() => { callback_StopAndFinalizeAllDiagnosticsComplete(); ProcessStartInfo p = null; try { svcName = "SSASDiag_" + (cbInstances.SelectedIndex == 0 ? "MSSQLSERVER" : cbInstances.Text); // Stop the service via command line. p = new ProcessStartInfo("cmd.exe", "/c net stop " + svcName); p.WindowStyle = ProcessWindowStyle.Hidden; p.UseShellExecute = true; p.Verb = "runas"; p.CreateNoWindow = true; Process.Start(p); if (Environment.UserInteractive) { // Uninstall service. We already got the Stop message indicating we're done closing, so the net stop command will finish very quickly. But give it a second. Better than blocking and not worth implementing a callback on this... p = new ProcessStartInfo("reg.exe", @"query HKLM\System\CurrentControlSet\Services\" + svcName + " /v ImagePath"); p.UseShellExecute = false; p.CreateNoWindow = true; p.WindowStyle = ProcessWindowStyle.Hidden; p.RedirectStandardOutput = true; p.RedirectStandardError = true; Process proc = Process.Start(p); string SvcPath = proc.StandardOutput.ReadToEnd(); if (SvcPath == "") { string err = proc.StandardError.ReadToEnd(); throw new Exception("Exception getting service path: " + err); } else { SvcPath = SvcPath.Replace("\r\nHKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\" + svcName + "\r\n ImagePath REG_EXPAND_SZ ", "").Replace("\r\n", ""); } //string SvcPath = Registry.LocalMachine.OpenSubKey("SYSTEM\\ControlSet001\\Services\\" + svcName, false).GetValue("ImagePath") as string; p = new ProcessStartInfo("cmd.exe", "/c ping 1.1.1.1 -n 1 -w 2000 > nul & " + SvcPath + " -u"); p.WindowStyle = ProcessWindowStyle.Hidden; p.Verb = "runas"; p.UseShellExecute = true; p.CreateNoWindow = true; Process.Start(p); } } catch (Exception e) { LogException(e); } })); } else if (message.Contains("Cancelled by client")) { if (pp != null && pp.Visible) { pp.DialogResult = DialogResult.Abort; Invoke(new System.Action(() => pp.Close())); } } else { txtStatus.Invoke(new System.Action(() => { txtStatus.AppendText(message); txtStatus.SelectionStart = txtStatus.TextLength; txtStatus.ScrollToCaret(); })); } if (pp != null && pp.InvokeRequired) { if (message.StartsWith("\r\nWindows authentication for remote SQL data source ")) { Invoke(new System.Action(() => pp.lblUserPasswordError.Text = "Incorrect user name or password")); } if (message.StartsWith("\r\nAuthenticated user ")) { Invoke(new System.Action(() => pp.lblUserPasswordError.Text = "User unauthorized to database ")); } if (message.StartsWith("\r\nRemote file share access failed for user ")) { Invoke(new System.Action(() => pp.lblUserPasswordError.Text = "User unauthorized to remote share")); } Invoke(new System.Action(() => pp.lblUserPasswordError.Left = pp.Width / 2 - pp.lblUserPasswordError.Width / 2)); } if (message.StartsWith("\r\nStopping collection at ")) { btnCapture.Image = imgStopHalfLit; } }
private static void OnClientConnected(NamedPipeConnection <byte[], byte[]> connection) { Console.WriteLine("Client {0} is now connected!", connection.Id); connection.PushMessage(new byte[] { 99 }); }
// 客户端连接上了NamedPipe private void OnClientConnected(NamedPipeConnection <string, string> connection) { connection.PushMessage(Constants.NamedPipe_Connect_Message); connection.PushMessage(Constants.NamedPipe_Command_USBCounting); }