Merge branch 'refactor/usingSaveManeger' into release/1.4
This commit is contained in:
commit
b0846bc10a
@ -155,7 +155,7 @@ namespace OWTrack
|
||||
}
|
||||
else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff();
|
||||
srTextBox.Text = null;
|
||||
File.WriteAllText(Paths.SAVES, JsonConvert.SerializeObject(tr));
|
||||
saveManeger.SaveJSON(tr);
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
@ -37,6 +37,10 @@ namespace OWTrack
|
||||
|
||||
class saveManeger
|
||||
{
|
||||
/// <summary>
|
||||
/// Deserialize saved tracker instance.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Tracker GetSavedTracker()
|
||||
{
|
||||
try
|
||||
@ -49,7 +53,6 @@ namespace OWTrack
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: use para
|
||||
public static Tracker GetSavedTracker(string customPath)
|
||||
{
|
||||
try
|
||||
@ -62,11 +65,16 @@ namespace OWTrack
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///Saves the Tracker Object.
|
||||
/// </summary>
|
||||
/// <param name="tracker"></param>
|
||||
/// <returns></returns>
|
||||
public static bool SaveJSON(Tracker tracker)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.WriteAllText(Paths.JSON, JsonConvert.SerializeObject(tracker));
|
||||
File.WriteAllText(Directory.GetCurrentDirectory() + "/data.json", JsonConvert.SerializeObject(tracker));
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
@ -75,6 +83,10 @@ namespace OWTrack
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a 'data.json' exists in the default location '../saves/data.json'.
|
||||
/// </summary>
|
||||
/// <returns>Boolean Value</returns>
|
||||
public static bool saveExist()
|
||||
{
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user