/// <summary> /// Add the specified message, week, beginTime, endTime, isCycle and secondInterval. /// </summary> /// <param name="message">Message.</param> /// <param name="week">Week.</param> /// <param name="beginTime">Begin time.</param> /// <param name="endTime">End time. void</param> /// <param name="isCycle">If set to <c>true</c> is cycle. void</param> /// <param name="secondInterval">Second interval. void</param> public void Add(NoticeMessage message, DayOfWeek week, string beginTime, string endTime, bool isCycle, int secondInterval) { var planConfig = PlanConfig.EveryWeekPlan(DoBroadcast, "BroadcastTimer", week, beginTime); planConfig.Target = message; TimeListener.Append(planConfig); }
public static void Run() { //AppstoreClientManager.Current.InitConfig(); //var dispatch = TaskDispatch.StartTask(); //dispatch.Add(new StudyTask()); lock (thisLock) { _isRunning = false; } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); #if NO_MERGE_SERVICE_DATA var httpHost = GetSection().HttpHost; var httpPort = GetSection().HttpPort; var httpName = GetSection().HttpName; if (!string.IsNullOrEmpty(httpHost)) { var names = httpName.Split(','); new NewHttpListener(httpHost, httpPort, new HashSet <string>(names)); } LoadGlobalData(); // 上传该服务器的状态 TimeListener.Append(PlanConfig.EveryMinutePlan(submitServerStatus, "submitServerStatus", "00:00", "23:59", ConfigurationManager.AppSettings["ServerStatusSendInterval"].ToInt())); // 自动机器人,64争霸赛 TimeListener.Append(PlanConfig.EveryMinutePlan(LoopAction, "LoopAction", "00:00", "23:59", 3)); // new GameActiveCenter(null); // new GuildGameActiveCenter(null); //每天执行用于整点刷新 TimeListener.Append(PlanConfig.EveryDayPlan(UserHelper.DoZeroRefreshDataTask, "DoZeroRefreshDataTask", "00:00")); //TimeListener.Append(PlanConfig.EveryMinutePlan(UserHelper.DoZeroRefreshDataTask, "DoZeroRefreshDataTask", "08:00", "22:00", 60)); //每天5点执行用于整点刷新 TimeListener.Append(PlanConfig.EveryDayPlan(UserHelper.DoEveryDayRefreshDataTask, "EveryDayRefreshDataTask", "05:00")); // 每周二,周五 TimeListener.Append(PlanConfig.EveryWeekPlan(UserHelper.DoTuesdayRefreshTask, "TuesdayRefreshTask", DayOfWeek.Tuesday, "04:00")); //TimeListener.Append(PlanConfig.EveryWeekPlan(UserHelper.DoFridayRefreshTask, "FridayRefreshTask", DayOfWeek.Friday, "04:00")); DataHelper.InitData(); InitRanking(); if (DataHelper.IsFirstOpenService) { string ncikName = string.Empty; var botsNameSet = new ShareCacheStruct <Config_BotsName>(); for (int i = 0; i < 5; ++i) { ncikName = botsNameSet.FindKey(random.Next(botsNameSet.Count)).String; ncikName += botsNameSet.FindKey(random.Next(botsNameSet.Count)).Value; UserCenterUser ucu = Util.CreateUserCenterUser(Util.GetRandomGUIDPwd(), "0000", GameEnvironment.ProductServerId); Action1005.CreateRole(ucu.UserID, "", ucu.ServerID, ucu.OpenID, ucu.RetailID, ncikName, random.Next(1) + 1, ""); } } //Bots.InitBots(); //if (competition64 == null) //{ // competition64 = new Competition64(); // competition64.Initialize(); //} GlobalRemoteService.Reuest(); stopwatch.Stop(); new BaseLog().SaveLog("系统全局运行环境加载所需时间:" + stopwatch.Elapsed.TotalMilliseconds + "ms"); SendServerStatus(ServerStatus.Unhindered, 0); #else MERGE_SERVICE.Run(); #endif lock (thisLock) { _isRunning = true; } }