void OnPacketReceived(object sender, PacketReceivedEventArgs e) { Program.Log("OnPacketReceived"); if (e.Packet.Length != 0) { try { WorkerProcess.MethodCall mc = (WorkerProcess.MethodCall)WorkerProcess.DeserializeObject(e.Packet); mc.CallOn(workerObject); } catch (TargetInvocationException ex) { Program.Log(ex.ToString()); CallMethodOnHost("ReportException", ex.InnerException.ToString()); } catch (Exception ex) { Program.Log(ex.ToString()); CallMethodOnHost("ReportException", ex.ToString()); } } }
void OnPacketReceived(object sender, PacketReceivedEventArgs e) { SetTimeout(); if (e.Packet.Length != 0) { if (clientAuthenticated) { MethodCall mc = (MethodCall)DeserializeObject(e.Packet); mc.CallOn(hostObject); } else { if (ArrayEquals(e.Packet, password)) { clientAuthenticated = true; } else { Kill(); throw new InvalidOperationException("Worker process authentication failed."); } } } }