/* * private string getLiveEmgStr(emgQuest e, string section = "->") //クーナライブがある時に使う * { * if (e.liveEnable == true) * { * if (Regex.IsMatch(e.live, "^クーナスペシャルライブ「.*」") == true) //他のライブの時は無理 * { * //もっといい方法がありそう * string str = Regex.Replace(e.live, "^クーナスペシャルライブ「", ""); * str = Regex.Replace(str, "」$", ""); * return string.Format("{0}{1}{2}", str, section, e.eventName); * } * else * { * return string.Format("{0}{1}{2}", e.live,section,e.eventName); * } * } * * return e.eventName; * } */ //-----イベント------ private void emgNotiy(object sender, EventArgs e) //緊急通知が来た時のイベント { if (e is emgEventData) { emgEventData tmp = (emgEventData)e; string postStr = ""; if (tmp.interval == 0) { postStr = string.Format("【緊急開始】{0} {1}", tmp.emgData.eventTime.ToString("HH:mm"), tmp.emgData.eventName); } else { string eventName = myFunction.getLiveEmgStr((emgQuest)tmp.emgData); postStr = string.Format("【{0}分前】{1} {2}", tmp.interval, tmp.emgData.eventTime.ToString("HH:mm"), eventName); } ToServicePOST(postStr); } }
private void EventLoop() //イベントループ { while (true) { DateTime dt = DateTime.Now; if ((DateTime.Compare(dt, nextNofity) > 0) && notify == true) //次の通知の時間を現在時刻が超えた時 { //通知のイベントを発生 emgEventData e = new emgEventData(nextEmg, nextInterval); emgNotify(this, e); if (nextInterval == 0) { setNextEmg(); } calcNextNofity(); } if (DateTime.Compare(dt, nextDayNtf) > 0) //日付が変わったら実行される { setRodosDay(); setDailyPost(); //日付が変わった時のイベントを発生させる。 List <Event> todayEvent = getTodayEmg(); if (todayEvent.Count != 0 || rodosDay == true) { DailyEventList e = new DailyEventList(todayEvent, rodosDay); newDay(this, e); } } if (DateTime.Compare(dt, nextReload) > 0) //水曜日17時になったら実行 { getEmgFromNet(); getChanpionFromNet(); //めんどいので覇者の紋章も一緒に取得 DailyEventList e = new DailyEventList(getTodayEmg(), rodosDay); Download(this, e); } if (rodosDay == true && DateTime.Compare(dt, rodosNotify) > 0) //バル・ロドスの日23時30分の通知 { EventData e = new EventData(2); rodos30Before(this, e); rodosDay = false; } if (chpTimeList.Count != 0 && DateTime.Compare(dt, chpTimeList[nextChpTimeIndex]) > 0) //覇者の紋章通知 { chanpionList e = new chanpionList(chanpionList); chpNotify(this, e); chpTimeList[nextChpTimeIndex] += new TimeSpan(7, 0, 0, 0); //一週間後 chpTimeList.Sort(); setNextChpNotify(); } /* * if(debug == true) //デバッグ用 * { * } */ System.Threading.Thread.Sleep(10); } }