public MasterAPI(string[] pcsUrls) { Servers = new ConcurrentDictionary <string, IServer>(); ServerUrls = ""; ServerIdsToUrls = new ConcurrentDictionary <string, string>(); Clients = new ConcurrentDictionary <string, IClient>(); PCSs = new ConcurrentDictionary <string, ProcessCreationService>(); foreach (string url in pcsUrls) { PCSs.TryAdd(BaseUrlExtractor.Extract(url), (ProcessCreationService)Activator.GetObject(typeof(ProcessCreationService), url)); } _startProcessDelegate = new StartProcessDelegate(StartProcess); _serverDelegate = new ServerDelegate(ServerSync); _clientDelegate = new ClientDelegate(ClientSync); _addRoomDelegate = new AddRoomDelegate(AddRoomSync); _statusDelegate = new StatusDelegate(StatusSync); _crashDelegate = new CrashDelegate(CrashSync); _freezeDelegate = new FreezeDelegate(FreezeSync); _unfreezeDelegate = new UnfreezeDelegate(UnfreezeSync); _shutDownSystemDelegate = new ShutDownSystemDelegate(ShutDownSystemSync); _checkNodeStatusDelegate = new CheckNodeStatus(CheckNode); _nodesCreated = 0; }
// Debugging Commands // Crash server_id public void CrashSync(string fields) { // match right PCS string basePcsUrl = BaseUrlExtractor.Extract(ServerIdsToUrls[fields]); ProcessCreationService pcs = PCSs[basePcsUrl]; pcs.Crash(fields); }
public void StartProcess(string url, string fields, string exePath, string id) { // match right PCS string basePcsUrl = BaseUrlExtractor.Extract(url); ProcessCreationService pcs = PCSs[basePcsUrl]; pcs.Start(@exePath, fields, id); }