WIP: Major update #45
@ -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();
|
||||
}
|
||||
|
@ -33,6 +33,10 @@ namespace OWTrack
|
||||
public static string GetSaves() { return SAVES; }
|
||||
public static string GetCurrentDir() { return curDir; }
|
||||
|
||||
/// <summary>
|
||||
/// Paths of 'Program Files' folders.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public struct ProgramFiles
|
||||
{
|
||||
public const string C = "C:\\Program Files";
|
||||
@ -47,17 +51,16 @@ namespace OWTrack
|
||||
/// <summary>
|
||||
/// Deserialize saved tracker instance.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>Tracker</returns>
|
||||
public static Tracker GetSavedTracker()
|
||||
{
|
||||
try
|
||||
{
|
||||
return JsonConvert.DeserializeObject<Tracker>(File.ReadAllText(Paths.GetSaves()));
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception e)
|
||||
{
|
||||
Exception ex = new Exception("json");
|
||||
throw ex;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,8 +84,8 @@ namespace OWTrack
|
||||
/// <summary>
|
||||
///Saves the Tracker Object.
|
||||
/// </summary>
|
||||
/// <param name="tracker"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="Tracker"></param>
|
||||
/// <returns>Boolean Value</returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user