private void CompileData() { if (cannotCompile) { Debug.LogError("Cannot compile, you must fix all errors before compiling"); return; } DynamicClassCreator.CompileClass(); }
private void CompileEnumData() { if (cannotCompileEnum) { Debug.LogError("Cannot compile the current enum, you must fix all errors before compiling"); return; } DynamicClassCreator.CompileEnum(); }
/// <summary> Get the shared class from the remote client </summary> /// <param name="name">The name of the class that has been shared</param> /// <param name="BaseType"></param> /// <param name="RemoteArgs">Use this only if the shared class is having RemoteInitialize enabled</param> /// <returns>The shared class from the remote client</returns> public InterfacePrototype GetSharedClass <InterfacePrototype>(string name, params object[] RemoteArgs) { SyncObject syncObject = null; lock (GetSharedClassRequests) { int RequestId = 0; Random rnd = new Random(DateTime.Now.Millisecond); while (Requests.ContainsKey(RequestId)) { RequestId = rnd.Next(); } syncObject = new SyncObject(Connection.Connection); GetSharedClassRequests.Add(RequestId, syncObject); Connection.SendMessage(new MsgGetSharedClass(name, RemoteArgs, RequestId)); //send message } ReturnResult result = syncObject.Wait <ReturnResult>(null, 0); //wait for response if (result == null) { throw new Exception("A timeout occured"); } if (result.ExceptionOccured) { throw new Exception(result.exceptionMessage); } if (result.ReturnValue == null) { throw new Exception("The shared class \"" + name + "\" could not be found in the remote client"); } SharedClass c = (SharedClass)result.ReturnValue; c.connection = this; InterfacePrototype tmp = DynamicClassCreator.CreateDynamicClass <InterfacePrototype>(c); lock (LocalSharedClasses) { LocalSharedClasses.Add(c.SharedId, c); } return(tmp); }
public InterfacePrototype GetSharedClass <InterfacePrototype>(string name, params object[] RemoteArgs) { lock (Connection.InitializedClasses) { SyncObject syncObject = null; lock (Connection.Requests) { int RequestId = 0; RequestId = GetNextRandomInteger(); while (Connection.Requests.ContainsKey(RequestId)) { RequestId = GetNextRandomInteger(); } syncObject = new SyncObject(this); Connection.Requests.Add(RequestId, syncObject); Connection.SendMessage(new MsgGetSharedClass(name, RemoteArgs, RequestId), PacketId.LiteCode); //send message } ReturnResult result = syncObject.Wait <ReturnResult>(null, 30000); //wait for response if (result == null) { throw new Exception("A timeout occured" + syncObject.TimedOut + ", " + syncObject.Pulsed + "..." + Connection.Connected); } if (result.ExceptionOccured) { throw new Exception(result.exceptionMessage); } if (result.ReturnValue == null) { throw new Exception("The shared class \"" + name + "\" could not be found in the remote client"); } SharedClass c = (SharedClass)result.ReturnValue; c.Client = this; InterfacePrototype tmp = DynamicClassCreator.CreateDynamicClass <InterfacePrototype>(c); Connection.InitializedClasses.Add(c.SharedId, c); return(tmp); } }