private void SaveImpl() { var spath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, SettingsFile); try { var data = JsonConvert.SerializeObject(this, _jsonsettings); if (File.Exists(spath)) { File.Delete(spath); } File.WriteAllText(spath, data); } catch (Exception ex) { LogToFile.LogError("Error saving SettingsFile[{0}]:{1}", spath, ex); } }
private void LoadImpl() { var spath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, SettingsFile); try { Console.WriteLine("Opening SettingsFile[" + spath + "]"); if (File.Exists(spath)) { var data = File.ReadAllText(spath); var obj = JsonConvert.DeserializeObject(data, _jsonsettings); CopyOntoSelf(obj as Settings); } else { LogToFile.LogWarn("SettingsFile [{0}] does not exist!", spath); } } catch (Exception ex) { LogToFile.LogError("Error loading SettingsFile[{0}]: {1}", spath, ex); } }
void AppDomain_CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { LogToFile.LogError("CRASH:", e.ExceptionObject as Exception); LogToFile.Close(); }
void _loadThread_ThreadExceptionOccurred(object sender, ThreadExceptionEventArgs e) { Log(LogMode.Error, "Update-Thread-Crash! " + e.Exception); LogToFile.LogError("Update-Thread-Exception:{0}", e.Exception); IsUpdating = false; }