コード例 #1
0
ファイル: Start.cs プロジェクト: Shame625/gta5basemod
        public Start()
        {
            _dbContext = new ApplicationDbContext(connectionString);
            _scheduler = new MainScheduler(connectionString);

            if (connectionString == "")
            {
                Debug.WriteLine("[TestMod] sql_connection_string convar not set!");
            }
            else
            {
                Debug.WriteLine("[TestMod] Connection: " + connectionString);
            }

            //Registers network events
            PlayerManagerNetwork.Instance.RegisterPlayerManagerNetworkEvents(EventHandlers);

            //get esx
            TriggerEvent("esx:getSharedObject", new object[] { new Action <dynamic>(esx => {
                    ESX = esx;
                }) });

            PlayerManager.Instance.Init(connectionString, ESX, EventHandlers);
            //Register commands here
            LotteryCommands.RegisterLotteryCommands();
            CounterCommands.RegisterCounterCommands();
        }
コード例 #2
0
ファイル: Server.Init.cs プロジェクト: marvelgit/MCGalaxy
 static void InitTimers(SchedulerTask task)
 {
     MainScheduler.QueueRepeat(RandomMessage, null,
                               Server.Config.AnnouncementInterval);
     Critical.QueueRepeat(ServerTasks.UpdateEntityPositions, null,
                          TimeSpan.FromMilliseconds(Server.Config.PositionUpdateInterval));
 }
コード例 #3
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseStaticFiles();

            app.InitializeContainer(_container, env);

            MainScheduler.Start(_container);

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AutomaticAuthenticate = true,
                AutomaticChallenge    = true,
                CookieName            = ".AspNet.AwesomeShop",
                ExpireTimeSpan        = TimeSpan.FromMinutes(5),
                LoginPath             = new PathString("/signin"),
                LogoutPath            = new PathString("/signout")
            });

            app.UseGitHubAuthentication(new GitHubAuthenticationOptions
            {
                ClientId     = "5fde51369004f1a0a42f",
                ClientSecret = "22a841b7bf9fe8db1a3f900a3fd15dd220521bfa",
                Scope        = { "user:email" }
            });

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
コード例 #4
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     MainScheduler.Init();
 }
コード例 #5
0
ファイル: Server.Init.cs プロジェクト: ProtheanGod/KingMC
        static void InitTimers(SchedulerTask task)
        {
            TextFile announcementsFile = TextFile.Files["Announcements"];

            announcementsFile.EnsureExists();

            string[] lines = announcementsFile.GetText();
            messages = new List <string>(lines);

            MainScheduler.QueueRepeat(RandomMessage, null,
                                      TimeSpan.FromMinutes(5));
            Critical.QueueRepeat(ServerTasks.UpdateEntityPositions, null,
                                 TimeSpan.FromMilliseconds(ServerConfig.PositionUpdateInterval));
        }
コード例 #6
0
        private IObservable <IEnumerable <Movie> > ClearAndGetMovies(string query, int page)
        {
            return(Observable
                   .Create <IEnumerable <Movie> >(
                       observer =>
            {
                if (page == 1)
                {
                    MainScheduler.Schedule(() => Movies.Clear());
                }

                return _movieService
                .GetMovies(query, page)
                .Subscribe(observer);
            }));
        }
コード例 #7
0
        protected void Application_Start(object sender, EventArgs e)
        {
            try
            {
                #region Schedule;

                var mainScheduler = new MainScheduler();
                mainScheduler.Run();

                #endregion
            }
            catch
            {
                // do nothing
            }
        }
コード例 #8
0
ファイル: Server.Init.cs プロジェクト: rdebath/MCGalaxy
        static void InitRest(SchedulerTask task)
        {
            CountdownGame.Instance.AutoStart();
            ZSGame.Instance.AutoStart();
            LSGame.Instance.AutoStart();
            CTFGame.Instance.AutoStart();
            TWGame.Instance.AutoStart();

            MainScheduler.QueueRepeat(BlockQueue.Loop, null,
                                      TimeSpan.FromMilliseconds(BlockQueue.Interval));
            Critical.QueueRepeat(ServerTasks.TickPlayers, null,
                                 TimeSpan.FromMilliseconds(20));

            Logger.Log(LogType.SystemActivity, "Finished setting up server");
            SetupFinished = true;
        }
コード例 #9
0
ファイル: Server.Init.cs プロジェクト: ProtheanGod/KingMC
        static void InitRest(SchedulerTask task)
        {
            IRC = new IRCBot();
            if (ServerConfig.UseIRC)
            {
                IRC.Connect();
            }

            InitZombieSurvival();
            InitLavaSurvival();
            MainScheduler.QueueRepeat(BlockQueue.Loop, null,
                                      TimeSpan.FromMilliseconds(BlockQueue.time));
            Critical.QueueRepeat(ServerTasks.LocationChecks, null,
                                 TimeSpan.FromMilliseconds(20));

            Logger.Log(LogType.SystemActivity, "Finished setting up server, finding classicube.net url..");
            ServerSetupFinished = true;
        }
コード例 #10
0
ファイル: Server.Init.cs プロジェクト: marvelgit/MCGalaxy
        static void InitRest(SchedulerTask task)
        {
            IRC = new IRCBot();
            IRC.LoadControllers();
            IRC.Connect();

            CountdownGame.Instance.AutoStart();
            ZSGame.Instance.AutoStart();
            LSGame.Instance.AutoStart();
            CTFGame.Instance.AutoStart();
            TWGame.Instance.AutoStart();

            MainScheduler.QueueRepeat(BlockQueue.Loop, null,
                                      TimeSpan.FromMilliseconds(BlockQueue.Interval));
            Critical.QueueRepeat(ServerTasks.TickPlayers, null,
                                 TimeSpan.FromMilliseconds(20));

            Logger.Log(LogType.SystemActivity, "Finished setting up server, finding classicube.net url..");
            SetupFinished = true;
        }
コード例 #11
0
        public void Start()
        {
            serverConfig = ConfigElement.GetAll(typeof(Server), typeof(ZombieGameProps));
            levelConfig  = ConfigElement.GetAll(typeof(Level));

            #pragma warning disable 0618
            Player.players       = PlayerInfo.Online.list;
            PlayerInfo.players   = PlayerInfo.Online.list;
            Server.levels        = LevelInfo.Loaded.list;
            PlayerBot.playerbots = PlayerBot.Bots.list;
            #pragma warning restore 0618

            StartTime      = DateTime.UtcNow;
            StartTimeLocal = StartTime.ToLocalTime();
            shuttingDown   = false;
            Log("Starting Server");
            try {
                if (File.Exists("Restarter.exe"))
                {
                    File.Delete("Restarter.exe");
                }
            } catch { }
            try {
                if (File.Exists("Restarter.pdb"))
                {
                    File.Delete("Restarter.pdb");
                }
            } catch { }

            CheckFile("MySql.Data.dll");
            CheckFile("System.Data.SQLite.dll");
            CheckFile("sqlite3.dll");
            CheckFile("Newtonsoft.Json.dll");
            CheckFile("LibNoise.dll");

            EnsureFilesExist();
            MoveOutdatedFiles();

            lava      = new LavaSurvival();
            zombie    = new ZombieGame();
            Countdown = new CountdownGame();
            LoadAllSettings();

            InitDatabase();
            Economy.LoadDatabase();
            Server.zombie.CheckTableExists();

            Level[] loaded = LevelInfo.Loaded.Items;
            foreach (Level l in loaded)
            {
                l.Unload();
            }

            Background.QueueOnce(UpgradeTasks.CombineEnvFiles);
            Background.QueueOnce(LoadMainLevel);
            Plugin.Load();
            Background.QueueOnce(UpgradeTasks.UpgradeOldBlacklist);
            Background.QueueOnce(LoadPlayerLists);
            Background.QueueOnce(LoadAutoloadCommands);
            Background.QueueOnce(UpgradeTasks.MovePreviousLevelFiles);
            Background.QueueOnce(UpgradeTasks.UpgradeOldLockdown);

            Background.QueueOnce(SetupSocket);
            Background.QueueOnce(InitTimers);
            Background.QueueOnce(InitRest);
            Background.QueueOnce(InitHeartbeat);

            Devs.Clear();
            Mods.Clear();
            Background.QueueOnce(InitTasks.UpdateStaffList);

            MainScheduler.QueueRepeat(ServerTasks.TemprankExpiry,
                                      null, TimeSpan.FromMinutes(1));
            Background.QueueRepeat(ServerTasks.AutoSave,
                                   1, TimeSpan.FromSeconds(Server.backupInterval));
            Background.QueueRepeat(ServerTasks.BlockUpdates,
                                   null, TimeSpan.FromSeconds(Server.blockInterval));
            Background.QueueRepeat(ThreadSafeCache.DBCache.CleanupTask,
                                   null, TimeSpan.FromMinutes(5));
        }
コード例 #12
0
ファイル: QuartzController.cs プロジェクト: weeeek/TeamSII
 public void RestartMainScheduler()
 {
     MainScheduler.Init();
 }