示例#1
0
 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());
         }
     }
 }
示例#2
0
 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.");
             }
         }
     }
 }
示例#3
0
		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.");
					}
				}
			}
		}