public bool Initialize(IScriptedGameServerRole parent) { MonitoringFacade.RegisterMonitoringSource(id); var entryScript = entryFile.ReadAllTextFromFile(); try { using (var context = JavascriptContextFactory.Create()) { context.Run(entryScript, Path.GetFileName(entryFile)); } } catch (JavascriptException ex) { LogScriptError(entryFile, folderName, ex); return(false); } if (string.IsNullOrEmpty(id)) { throw new BusinessException("Game type cannot be empty (entry file '{0}').".FormatString(entryFile)); } gameTypeEntity = ExternalServiceFacade.GetGameCoreService().GetGameType(id); return(true); }
public void NotifyIstanceRenamed(string oldName, ScriptedGameInstance gameInstance) { MonitoringFacade.UnregisterMonitoringSource(oldName); MonitoringFacade.RegisterMonitoringSource(gameInstance.Name); if (OnUnRegisterInstance != null) { OnUnRegisterInstance(gameInstance, new ScriptedGameWrapperEventArgs(oldName)); } if (OnRegisterInstance != null) { OnRegisterInstance(gameInstance, new ScriptedGameWrapperEventArgs(gameInstance.Id)); } }
public void NotifyIstanceAdded(ScriptedGameInstance gameInstance) { lock (instanceLock) { instanceCount++; gameInstances.Add(gameInstance); } MonitoringFacade.RegisterMonitoringSource(gameInstance.Name); if (OnRegisterInstance != null) { OnRegisterInstance(gameInstance, new ScriptedGameWrapperEventArgs(gameInstance.Id)); } }