public override void ProcessPayload(SecureSocketProtocol3.SSPClient client, SecureSocketProtocol3.Network.OperationalSocket OpSocket) { LiteCodeClient Client = OpSocket as LiteCodeClient; lock (Client.Requests) { if (Client.Requests.ContainsKey(RequestId)) { Client.Requests[RequestId].Value = Result; Client.Requests[RequestId].Pulse(); Client.Requests.Remove(RequestId); } } }
public override void onOperationalSocket_Disconnected(SecureSocketProtocol3.Network.OperationalSocket OPSocket, DisconnectReason Reason) { }
public override void onOperationalSocket_Connected(SecureSocketProtocol3.Network.OperationalSocket OPSocket) { }
public override void ProcessPayload(SecureSocketProtocol3.SSPClient client, SecureSocketProtocol3.Network.OperationalSocket OpSocket) { ReturnResult result = new ReturnResult(null, false); LiteCodeClient Client = OpSocket as LiteCodeClient; SharedClass localSharedClass = null; lock (Client.SharedClasses) { if (!Client.SharedClasses.TryGetValue(ClassName, out localSharedClass)) { return; } } try { if (localSharedClass.RemoteInitialize) { bool FoundConstructor = false; if (ArgObjects.Length > 0) { //lets check if there is a constructor with these arguments for (int i = 0; i < localSharedClass.ConstructorTypes.Count; i++) { if (localSharedClass.ConstructorTypes[i].Length == ArgObjects.Length) { bool CorrectArgs = true; for (int j = 0; j < ArgObjects.Length; j++) { if (localSharedClass.ConstructorTypes[i][j] != ArgObjects[j].GetType() && localSharedClass.ConstructorTypes[i][j] != ArgObjects[j].GetType().BaseType) { CorrectArgs = false; break; } } if (CorrectArgs) { FoundConstructor = true; break; } } } if (!FoundConstructor) { return; } } } if (localSharedClass.SharedInitializeCounter >= localSharedClass.MaxInitializations) { result.ExceptionOccured = true; result.exceptionMessage = "Reached maximum initializations"; } else { SharedClass sClass = new SharedClass(ClassName, localSharedClass.BaseClassType, Client, localSharedClass.RemoteInitialize, localSharedClass.MaxInitializations, localSharedClass.BaseClassTypeArgs); sClass.InitializedClass = Activator.CreateInstance(sClass.BaseClassType, localSharedClass.RemoteInitialize ? ArgObjects : sClass.BaseClassTypeArgs); int RandomId = Client.GetNextRandomInteger(); while (Client.InitializedClasses.ContainsKey(RandomId)) { RandomId = Client.GetNextRandomInteger(); } sClass.SharedId = RandomId; Client.InitializedClasses.Add(RandomId, sClass); result.ReturnValue = sClass; localSharedClass.SharedInitializeCounter++; } } catch (Exception ex) { result.ExceptionOccured = true; result.exceptionMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; } Client.Send(new MsgGetSharedClassResponse(RequestId, result)); }