public static void HandleProcessStateInfo(ProcessStateInfo processStateInfo, PipeClientBase client) { switch (processStateInfo.State) { case PipeProcessState.Stop: StsServer.Shutdown(); break; default: Log.Message(LogTypes.Warning, $"Received unhandled process state '{processStateInfo.State}' from '{processStateInfo.Alias}'."); break; } }
public static async Task CallHandler(byte ipcMessage, Stream ipcMessageData, PipeClientBase client) { if (messageHandlers.TryGetValue(ipcMessage, out var data)) { var handlerObj = Activator.CreateInstance(data.Item2, ipcMessage, ipcMessageData) as PipePacketBase; await Task.Run(() => data.Item1.Invoke(null, new object[] { handlerObj, client })); } else { var msgName = Enum.GetName(typeof(IPCMessage), ipcMessage) ?? Enum.GetName(typeof(GlobalPipeMessage), ipcMessage); if (msgName == null) { Log.Message(LogTypes.Warning, $"Received unknown ipc message '0x{ipcMessage:X}'."); } else { Log.Message(LogTypes.Warning, $"Handler for '{msgName} (0x{ipcMessage:X}) not implemented."); } } }