public static void Log(string group, string key, string value) { if (InstanceCreated) { Instance.AddEntry(group, key, value); } }
public static void OnLoad() { Persistence.Deserialize( FilePath, reader => { int version = reader.ReadInt(); switch (version) { case 1: { TownCryerSystem.Load(reader); goto case 0; } case 0: { int count = reader.ReadInt(); for (int i = 0; i < count; i++) { var entry = new TownCrierEntry(reader); if (!entry.Expired) { Instance.AddEntry(entry); } } } break; } }); }
// plasma : Load global town crier entry list public static void OnLoad( ) { System.Console.WriteLine("TCGL Loading..."); string filePath = Path.Combine("Saves/AngelIsland", "TCGL.xml"); if (!File.Exists(filePath)) { return; } try { if (Instance.m_Entries == null) { Instance.m_Entries = new ArrayList(); } XmlDocument doc = new XmlDocument(); doc.Load(filePath); XmlElement root = doc["TCGL"]; foreach (XmlElement entry in root.GetElementsByTagName("TCEntry")) { try { // load in entry! TownCrierEntry tce = new TownCrierEntry(entry); // system messages cannot be loaded in this way as the system needs to maintain a handle to the message so that // it can be removed ondemand. This Load TCE system is designed for player 'paid for' messages. if (tce.Poster != Serial.MinusOne) { // and add to the global TC list Instance.AddEntry(tce); } } catch { Console.WriteLine("Warning: A TCGL entry load failed"); } } } catch (Exception e) { LogHelper.LogException(e); Console.WriteLine("Exception caught loading TCGL.xml"); Console.WriteLine(e.StackTrace); } }
public static void OnLoad() { Persistence.Deserialize( FilePath, reader => { int version = reader.ReadInt(); int count = reader.ReadInt(); for (int i = 0; i < count; i++) { var entry = new TownCrierEntry(reader); if (!entry.Expired) { Instance.AddEntry(entry); } } }); }