public static void Load(TextReader reader) { try { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(ItemFilterData)); data = (ItemFilterData)serializer.Deserialize(reader); reader.Close(); } catch (Exception) { data = new ItemFilterData(); } }
public static void Load(TextReader reader) { IsLoading = true; try { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(ItemFilterData)); data = (ItemFilterData)serializer.Deserialize(reader); reader.Close(); } catch (Exception) { data = new ItemFilterData(); } IsLoading = false; ItemCache.OnItemsChanged(); }
public static void Load(string fileName) { if (File.Exists(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), fileName))) { try { string xml = System.IO.File.ReadAllText(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), fileName)); System.IO.StringReader reader = new System.IO.StringReader(xml); System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(ItemFilterData)); data = (ItemFilterData)serializer.Deserialize(reader); reader.Close(); } catch (Exception) { data = new ItemFilterData(); } } else { data = new ItemFilterData(); } }