/// <summary> /// Сохраняет настройки в файл /// </summary> public static bool SaveSettings(NiceHashSettings __object) { bool __result = false; var __ds = new DataContractSerializer(typeof(NiceHashSettings)); try { using (Stream __s = File.Create(NiceHashSettings.FILE_NAME)) { __ds.WriteObject(__s, __object); __result = true; } } catch { } return(__result); }
/// <summary> /// Загружает настройки из файла /// </summary> public static NiceHashSettings LoadSettings() { NiceHashSettings __result = new NiceHashSettings(); FileInfo __settingsInfo = new FileInfo(NiceHashSettings.FILE_NAME); if (__settingsInfo.Exists) { var __ds = new DataContractSerializer(typeof(NiceHashSettings)); using (Stream __s = File.OpenRead(NiceHashSettings.FILE_NAME)) { __result = (NiceHashSettings)__ds.ReadObject(__s); } } return(__result); }