public static void LoadTitles(string root) { try { using (var fs = new FileStream(Path.Combine(root, @".\data\client_titles.xml"), FileMode.Open, FileAccess.Read)) using (var reader = XmlReader.Create(fs)) { XmlSerializer ser = new XmlSerializer(typeof(ClientTitlesFile)); ser.UnknownElement += new XmlElementEventHandler(delegate(object sender, XmlElementEventArgs e) { Debug.Print("Unknown element: '{0}' (line: {1})", e.Element.Name, e.LineNumber); }); TitleIndex = (ClientTitlesFile)ser.Deserialize(reader); TitleIndex.CreateIndex(); } } catch (Exception ex) { Debug.Print(ex.ToString()); } }
public static void LoadTitles(string root) { try { using (var fs = new FileStream(Path.Combine(root, @".\data\client_titles.xml"), FileMode.Open, FileAccess.Read)) using (var reader = XmlReader.Create(fs)) { XmlSerializer ser = new XmlSerializer(typeof(ClientTitlesFile)); ser.UnknownElement += new XmlElementEventHandler(delegate(object sender, XmlElementEventArgs e) { Debug.Print("Unknown element: '{0}' (line: {1})", e.Element.Name, e.LineNumber); }); TitleIndex = (ClientTitlesFile)ser.Deserialize(reader); TitleIndex.CreateIndex(); } } catch (Exception ex) { Debug.Print(ex.ToString()); } }