public object CallMethod(object object_instance, RPCInvoker.RPC call) { MethodInfo method; if (call.parameters != null) { Type[] types = new Type[call.parameters.Length]; for (var index = 0; index < call.parameters.Length; ++index) { types[index] = call.parameters[index].GetType(); } method = object_instance.GetType().GetMethod(call.name, types); } else { method = object_instance.GetType().GetMethod(call.name); } if (method == null) { throw new MissingMethodException("the method is not in the class"); } return(method.Invoke(object_instance, call.parameters)); }
private void MessageThread() { try { while (!threadsAborted.Value) { var result = new RPCInvoker.RPC(); var flag = false; lock (queue_lock) { try { if (message_queue.Count > 0) { flag = message_queue.TryDequeue(out result); } } catch (Exception ex) { ErrorLogger.LogException("Exception in SpoolerClient.MessageThread " + ex.Message, ex); } } if (flag) { if (result.name.Contains("UpdatePrinterList")) { lock (queue_lock) { try { update_in_queue = false; } catch (Exception ex) { ErrorLogger.LogException("Exception in SpoolerClient.MessageThread 1 " + ex.Message, ex); } } } var num = (int)spooler_connection.SendSpoolerMessageInternal(result.Serialize()); } else { Thread.Sleep(50); } } } catch (Exception ex) { ErrorLogger.LogException("Exception in SpoolerClient.MessageThread 2 " + ex.Message, ex); } }
public SpoolerResult SendSpoolerMessageRPCAsync(RPCInvoker.RPC rpc_call) { if (AlwaysBlock) { return(SendSpoolerMessageRPC(rpc_call)); } if (MessagesInQueue > 128) { return(SpoolerResult.Fail); } lock (queue_lock) { message_queue.Enqueue(rpc_call); } return(SpoolerResult.OK); }
public RPC(string name, params object[] param) { this = new RPCInvoker.RPC(null, Guid.Empty, 0U, name, param); }
public object CallMethod(RPCInvoker.RPC call) { return(CallMethod(class_instance, call)); }
public SpoolerResult SendSpoolerMessageRPC(RPCInvoker.RPC rpc_call) { return(SendSpoolerMessage(rpc_call.Serialize())); }