private CustomSituations GetCustomSituationSettings(string path) { CustomSituations situations = null; try { XmlSerializer serializer = new XmlSerializer(typeof(CustomSituations)); Stream fs = File.OpenRead(path); situations = (CustomSituations)serializer.Deserialize(fs); fs.Close(); } catch (Exception ex) { Trace.WriteLine("Failed to load CustomSituations: " + ex.Message); } return(situations); }
/// <summary> /// SaveCustomSituations to XML File /// </summary> /// <param name="setting">Custom Situation Settings to write to disk.</param> public void SaveCustomSituations(CustomSituations setting) { string path = GetFullPath(customSituationsFileName); SaveXML <CustomSituations>(setting, path); }