Merge branch 'master' into saveNotLoading

This commit is contained in:
HeshamTB 2018-12-20 19:03:39 +03:00
commit 86efb124c6
7 changed files with 18 additions and 26 deletions

View File

@ -322,6 +322,7 @@
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "OWTrack";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.SettingsGroup.ResumeLayout(false);
this.SettingsGroup.PerformLayout();
this.ResumeLayout(false);

View File

@ -21,7 +21,6 @@ SOFTWARE.*/
using System;
using System.Drawing;
using System.Windows.Forms;
using Newtonsoft.Json;
using System.IO;
namespace OWTrack
@ -156,7 +155,7 @@ namespace OWTrack
else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff();
srTextBox.Text = null;
saveManeger.SaveJSON(tr);
}
}
#region Events
private void timer1_Tick(object sender, EventArgs e) => checkStatus();
@ -243,6 +242,12 @@ namespace OWTrack
tr.gamePath = getGamePath();
update();
}
#endregion
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
notifyIcon1.Icon = null;
notifyIcon1.Dispose();
}
#endregion
}
}

View File

@ -90,8 +90,8 @@
<ApplicationIcon>assets\Jeanette-Foshee-Simpsons-11-Rollover-Homer-donut-1.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />

View File

@ -17,10 +17,6 @@ namespace OWTrack
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
public static string Version { get; } = "1.4.3";
//public static string Version = Application.ProductVersion;
//public static Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
public static string Version { get; } = "1.4.3";
}
}

View File

@ -1,4 +1,4 @@
/*Copyright(c) 2018 Hesham Systems LLC.
/*Copyright(c) 2018 Hesham Systems LLC.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -25,14 +25,12 @@ using System.IO;
using System.Windows.Forms;
using System.Collections.Generic;
namespace OWTrack
{
class Tracker
{
public int wins, losses, startSR, newSR, totalMatches = 0;
public string gamePath;
public void Track() { }//Deserailize here
public void reset() { wins = 0; losses = 0; startSR = 0; newSR = 0; gamePath = null; }
public void addWin() => wins++;
@ -91,6 +89,7 @@ namespace OWTrack
if (paths.Count > 1)
{
//TODO: ask about correct path
//New Form??
return true;
}
@ -107,12 +106,7 @@ namespace OWTrack
MessageBox.Show(e.Message);
return false;
}
}
private bool ProgramFilesExist(char drive)
{
return Directory.Exists(drive+":\\Program Files");
}
}
public static IEnumerable<string> GetFiles(string root, string searchPattern)
{

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net461" />
</packages>

View File

@ -20,11 +20,7 @@ SOFTWARE.*/
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OWTrack
{
@ -76,8 +72,8 @@ namespace OWTrack
public static bool SaveJSON(Tracker tracker)
{
try
{
File.WriteAllText(Paths.GetSaves(), JsonConvert.SerializeObject(tracker));
{
File.WriteAllText(Paths.GetSaves(), JsonConvert.SerializeObject(tracker, Formatting.Indented));
return true;
}
catch (Exception)