Ex handling and API changes
This commit is contained in:
parent
de978bb317
commit
2e78d7ccfe
@ -92,7 +92,7 @@ namespace OWTrack
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Could not load Save.\n" +
|
MessageBox.Show("Could not load Save!\n" +
|
||||||
"Starting new save.");
|
"Starting new save.");
|
||||||
tr = new Tracker();
|
tr = new Tracker();
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,10 @@ namespace OWTrack
|
|||||||
public static string GetSaves() { return SAVES; }
|
public static string GetSaves() { return SAVES; }
|
||||||
public static string GetCurrentDir() { return curDir; }
|
public static string GetCurrentDir() { return curDir; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Paths of 'Program Files' folders.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public struct ProgramFiles
|
public struct ProgramFiles
|
||||||
{
|
{
|
||||||
public const string C = "C:\\Program Files";
|
public const string C = "C:\\Program Files";
|
||||||
@ -47,17 +51,16 @@ namespace OWTrack
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deserialize saved tracker instance.
|
/// Deserialize saved tracker instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns>Tracker</returns>
|
||||||
public static Tracker GetSavedTracker()
|
public static Tracker GetSavedTracker()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return JsonConvert.DeserializeObject<Tracker>(File.ReadAllText(Paths.GetSaves()));
|
return JsonConvert.DeserializeObject<Tracker>(File.ReadAllText(Paths.GetSaves()));
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Exception ex = new Exception("json");
|
throw e;
|
||||||
throw ex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,8 +84,8 @@ namespace OWTrack
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///Saves the Tracker Object.
|
///Saves the Tracker Object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tracker"></param>
|
/// <param name="Tracker"></param>
|
||||||
/// <returns></returns>
|
/// <returns>Boolean Value</returns>
|
||||||
public static bool SaveJSON(Tracker tracker)
|
public static bool SaveJSON(Tracker tracker)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -90,9 +93,9 @@ namespace OWTrack
|
|||||||
File.WriteAllText(Paths.GetSaves(), JsonConvert.SerializeObject(tracker, Formatting.Indented));
|
File.WriteAllText(Paths.GetSaves(), JsonConvert.SerializeObject(tracker, Formatting.Indented));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return false;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user