public static SetHuntTime ( Hunt h, int clearMinutes ) : void | ||
h | Hunt | |
clearMinutes | int | |
Résultat | void |
public static void clearOldLog(Hunt h, int clearMinutes = 10) { var time = DateTime.Now; int hour = time.Hour; int minute = time.Minute; while (clearMinutes > 60) { hour--; clearMinutes -= 60; } if (minute >= clearMinutes) { minute -= clearMinutes; } else { hour--; minute = 60 + (minute - clearMinutes); } int stamp = TimestampManager.getDayStamp(); while (hour < 0) { hour += 24; stamp--; } h.Reset(clearMinutes); HuntManager.SetHuntTime(h, clearMinutes); LootDatabaseManager.DeleteMessagesBefore(h, stamp, hour, minute); SQLiteDataReader reader = LootDatabaseManager.GetHuntMessages(h); Dictionary <string, List <string> > logMessages = new Dictionary <string, List <string> >(); while (reader.Read()) { string line = reader["message"].ToString(); if (line.Length < 15) { continue; } string t = line.Substring(0, 5); if (!(t[0].isDigit() && t[1].isDigit() && t[3].isDigit() && t[4].isDigit() && t[2] == ':')) { continue; //not a valid timestamp } if (!logMessages.ContainsKey(t)) { logMessages.Add(t, new List <string>()); } logMessages[t].Add(line); } Parser.ParseLootMessages(h, logMessages, null, false, false, true); LootDatabaseManager.UpdateLoot(); }