private void newDayPOST(object sender, EventArgs e) //日付が変わった時のイベント { if (e is DailyEventList) { System.Console.WriteLine("Download"); DailyEventList tmp = (DailyEventList)e; string postStr = ""; if (tmp.emgList.Count != 0) { postStr = string.Format("{0}月{1}日の緊急クエストは以下の通りです。\n", DateTime.Now.Month, DateTime.Now.Day); postStr += myFunction.generateEmgArrStr(tmp.emgList); } if (tmp.rodosDay == true && rodos == true) { postStr += "本日はデイリーオーダー「バル・ロドス討伐(VH)」の日です。"; } if (postStr != "") { 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); } }