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 SessionWrapper(IScriptedGameServerRole parentRole, string sessionId, string magic, long casinoId, long referenceId, string nick, bool isServiceSession = false) { this.parentRole = parentRole; IsServiceSession = isServiceSession; CasinoId = casinoId; ReferenceId = referenceId; SessionId = sessionId; Magic = magic; Nick = nick; SessionToken = TokenHelper.CreateGameSessionToken(sessionId, magic); Locale = "en"; Currency = CurrencyTypeEnum.Euro; var sessionThread = new Thread(SessionThread) { Name = $"Session {sessionId} background thread", IsBackground = true }; sessionThread.Start(); }