protected PrototypeCollection GetPrototypesFromJson(string filePath) { string output = File.ReadAllText($"{Application.dataPath}{filePath}"); PrototypeCollection collection = JsonUtility.FromJson <PrototypeCollection>(output); return(collection); }
/// <summary> /// Initializes a new instance of the ModuleBlackboardServer class /// </summary> /// <param name="name">Module name</param> /// <param name="port">Port for accepting incoming connections</param> internal ModuleBlackboardServer(string name, int port) { if ((port < 1024) || (port > 65535)) { throw new ArgumentException("Port must be between 1024 and 65535", "port"); } if (!Regex.IsMatch(name, @"\w[\w\-_\d]{2,}")) { throw new ArgumentException("Invalid module name", "name"); } this.name = name; this.port = port; this.busy = false; //this.waitingResponse = new List<Command>(10); //this.responses = new List<Response>(); //this.commands = new List<Command>(); this.prototypes = new PrototypeCollection(this); this.lockList = new List <Command>(); this.restartActions = new ActionCollection(this); this.restartTestActions = new ActionCollection(this); this.startupActions = new ActionCollection(this); this.stopActions = new ActionCollection(this); this.dataReceived = new Queue <byte[]>(10); this.restartRequested = false; this.restartTestRequested = false; this.simOptions = SimulationOptions.SimulationDisabled; }
/// <summary> /// Initializes a new instance of the Module class /// </summary> /// <param name="name">Module name</param> protected ModuleClient(string name) { this.name = name; this.alias = name; this.busy = false; this.ready = false; this.enabled = true; this.checkInterval = GlobalCheckInterval; this.executableInfo = new ModuleProcessInfo(); //this.waitingResponse = new List<Command>(10); //this.responses = new List<Response>(); //this.commands = new List<Command>(); this.prototypes = new PrototypeCollection(this); this.lockList = new List<Command>(); this.restartActions = new ActionCollection(this); this.restartTestActions = new ActionCollection(this); this.startupActions = new ActionCollection(this); this.stopActions = new ActionCollection(this); this.testTimeOutActions = new ActionCollection(this); this.restartRequested = false; this.restartTestRequested = false; this.rnd = new Random(name.GetHashCode()); this.simOptions = ModuleSimulationOptions.SimulationDisabled; // Shared Variable related prototypes this.Prototypes.Add(Prototype.CreateVar); this.Prototypes.Add(Prototype.ListVars); this.Prototypes.Add(Prototype.Prototypes); this.Prototypes.Add(Prototype.ReadVar); this.Prototypes.Add(Prototype.ReadVars); this.Prototypes.Add(Prototype.StatVar); this.Prototypes.Add(Prototype.WriteVar); this.readyEvent = new ManualResetEvent(false); }