/// <summary> /// Loads the options from their location on disk. /// </summary> /// <returns>An OptionsModel instance with the loaded options.</returns> private static OptionsModel LoadOptions() { string filePath = GetOptionsFilePath(); OptionsModel result; if (File.Exists(filePath)) { try { using (FileStream fileStream = new FileStream(filePath, FileMode.Open)) { DataContractSerializer serializer = new DataContractSerializer(typeof(OptionsModel)); result = (OptionsModel)serializer.ReadObject(fileStream); } } catch (Exception) { //Ignoring exception and skipping file load result = new OptionsModel(); } } else { result = new OptionsModel(); } return result; }