Compare commits

...

5 Commits

Author SHA1 Message Date
0632fe5b8f Merge branch 'Redo-SR' into release/1.4.3 2018-12-22 10:06:55 +03:00
bc3c84c984 Fixed #40 2018-12-22 10:04:45 +03:00
8d00ee0720 Paths to struct 2018-12-22 09:22:02 +03:00
5905ec0122 ProgramFiles class to struct 2018-12-22 09:18:39 +03:00
44595496be Fixed #37 2018-12-22 00:17:23 +03:00
3 changed files with 29 additions and 16 deletions

View File

@ -86,7 +86,16 @@ namespace OWTrack
{ {
try try
{ {
tr = saveManeger.GetSavedTracker(); try
{
tr = saveManeger.GetSavedTracker();
}
catch (Exception)
{
MessageBox.Show("Could not load Save.\n" +
"Starting new save.");
tr = new Tracker();
}
if (tr.startSR > 0) SRonce = true; if (tr.startSR > 0) SRonce = true;
if (tr.settings.GamePath == "" || tr.settings.GamePath == null) if (tr.settings.GamePath == "" || tr.settings.GamePath == null)
{ {
@ -217,12 +226,16 @@ namespace OWTrack
} }
finally finally
{ {
if (!SRonce) //if (!SRonce)
{ //{
// tr.startSR = sr;
// SRonce = true;
//}
//else tr.newSR = sr;
if (tr.GetCurrentSession().IsNewSession())
tr.startSR = sr; tr.startSR = sr;
SRonce = true; else
} tr.newSR = sr;
else tr.newSR = sr;
} }
AddMatch(); AddMatch();
update(); update();

View File

@ -71,7 +71,6 @@ namespace OWTrack
{ {
Session ses = new Session(startSR); Session ses = new Session(startSR);
sessions.Add(ses); sessions.Add(ses);
//Re do SR input!!
} }
public Session GetCurrentSession() public Session GetCurrentSession()
@ -216,6 +215,7 @@ namespace OWTrack
public Match() { } public Match() { }
public DateTime dateTime { get; set; } public DateTime dateTime { get; set; }
public int StartSR; public int StartSR;
public int LastMatchSR;
public int newSR; public int newSR;
public int ChangeInSR; public int ChangeInSR;
} }

View File

@ -24,7 +24,7 @@ using System.IO;
namespace OWTrack namespace OWTrack
{ {
public static class Paths public struct Paths
{ {
private static string curDir = Directory.GetCurrentDirectory(); private static string curDir = Directory.GetCurrentDirectory();
private static string SAVES = curDir + "/saves/data.json"; private static string SAVES = curDir + "/saves/data.json";
@ -33,14 +33,13 @@ 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; }
public static class ProgramFiles public struct ProgramFiles
{ {
public static readonly string C = "C:\\Program Files"; public const string C = "C:\\Program Files";
public static readonly string D = "D:\\Program Files"; public const string D = "D:\\Program Files";
public static readonly string E = "E:\\Program Files"; public const string E = "E:\\Program Files";
public static readonly string F = "F:\\Program Files"; public const string F = "F:\\Program Files";
} }
} }
class saveManeger class saveManeger
@ -55,9 +54,10 @@ namespace OWTrack
{ {
return JsonConvert.DeserializeObject<Tracker>(File.ReadAllText(Paths.GetSaves())); return JsonConvert.DeserializeObject<Tracker>(File.ReadAllText(Paths.GetSaves()));
} }
catch (Exception e) catch (Exception)
{ {
throw e; Exception ex = new Exception("json");
throw ex;
} }
} }