void CheckerLogWrite(string value, bool fWrite = false) { ConsoleMe.WriteLine(string.Format("Receiver: {0}\t{1}", this.ReceiverMan.NickName, value)); if (fWrite) { ConsoleMe.WriteToLogFile(); } }
void timer_Elapsed(object sender, ElapsedEventArgs e) { CheckSleepingTime(); IsANewDay(); CheckerLogWrite(string.Format("Checker: begin time: {0}", DateTime.Now.ToLongTimeString())); this.CheckCurrentWeatherInfo(); this.CheckNextHourForecastInfo(); this.CheckSpecialStationAQI(); CheckerLogWrite(string.Format("Checker: end time: {0}\n\n", DateTime.Now.ToLongTimeString())); ConsoleMe.WriteToLogFile(); }
static void Main(string[] args) { CustomizedHRWNCheckerReceiver(); do { // First, we could use ReadLine to check the current datetime. // Second, easy to compare the log according to the log. // Third, explicitly write the log to file here. ConsoleMe.ReadLine(); ConsoleMe.WriteToLogFile(); } while (true); //Thread.Sleep(Timeout.Infinite); }