From 2e78d7ccfe7f36593c5e4fcf2dd704cbda5c1160 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Sun, 23 Dec 2018 20:19:13 +0300 Subject: [PATCH] Ex handling and API changes --- OWTrack/MainForm.cs | 2 +- OWTrack/saveManeger.cs | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/OWTrack/MainForm.cs b/OWTrack/MainForm.cs index 05a33e6..37078c7 100644 --- a/OWTrack/MainForm.cs +++ b/OWTrack/MainForm.cs @@ -92,7 +92,7 @@ namespace OWTrack } catch (Exception) { - MessageBox.Show("Could not load Save.\n" + + MessageBox.Show("Could not load Save!\n" + "Starting new save."); tr = new Tracker(); } diff --git a/OWTrack/saveManeger.cs b/OWTrack/saveManeger.cs index 74d29a0..1e88428 100644 --- a/OWTrack/saveManeger.cs +++ b/OWTrack/saveManeger.cs @@ -33,6 +33,10 @@ namespace OWTrack public static string GetSaves() { return SAVES; } public static string GetCurrentDir() { return curDir; } + /// + /// Paths of 'Program Files' folders. + /// + /// public struct ProgramFiles { public const string C = "C:\\Program Files"; @@ -47,17 +51,16 @@ namespace OWTrack /// /// Deserialize saved tracker instance. /// - /// + /// Tracker public static Tracker GetSavedTracker() { try { return JsonConvert.DeserializeObject(File.ReadAllText(Paths.GetSaves())); } - catch (Exception) + catch (Exception e) { - Exception ex = new Exception("json"); - throw ex; + throw e; } } @@ -81,8 +84,8 @@ namespace OWTrack /// ///Saves the Tracker Object. /// - /// - /// + /// + /// Boolean Value public static bool SaveJSON(Tracker tracker) { try @@ -90,9 +93,9 @@ namespace OWTrack File.WriteAllText(Paths.GetSaves(), JsonConvert.SerializeObject(tracker, Formatting.Indented)); return true; } - catch (Exception) + catch (Exception e) { - return false; + throw e; } }