using System.Xml; using System.Xml.Serialization; using System.IO; namespace NWService { public class LanguageXmlLoader { public static string GetPath() { return Path.Combine(Directory.GetCurrentDirectory(), "language.xml"); } public static LanguageXml Load() { if (!File.Exists(GetPath())) { return default; } try { Dictionary dic = DicSerialize.XmlDeserialize(GetPath()); return new LanguageXml() { messageMaps = dic }; } catch(Exception e) { Console.WriteLine(e); return default; } } public static void Save(LanguageXml xml) { try { DicSerialize.XmlSerialize(GetPath(), xml.messageMaps); } catch(Exception e) { Console.WriteLine(e); } } } }