Merge branch 'saveNotLoading' into release/1.4.3

This commit is contained in:
HeshamTB 2018-12-20 19:11:56 +03:00
commit aa4a08c525
7 changed files with 19 additions and 27 deletions

View File

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

View File

@ -21,7 +21,6 @@ SOFTWARE.*/
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using Newtonsoft.Json;
using System.IO; using System.IO;
namespace OWTrack namespace OWTrack
@ -88,7 +87,7 @@ namespace OWTrack
{ {
using (StreamReader st = new StreamReader(Paths.GetSaves())) using (StreamReader st = new StreamReader(Paths.GetSaves()))
{ {
string line = st.ReadLine(); string line = st.ReadToEnd();
if (line.Contains("Overwatch.exe")) if (line.Contains("Overwatch.exe"))
{ {
tr = saveManeger.GetSavedTracker(); tr = saveManeger.GetSavedTracker();
@ -156,7 +155,7 @@ namespace OWTrack
else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff(); else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff();
srTextBox.Text = null; srTextBox.Text = null;
saveManeger.SaveJSON(tr); saveManeger.SaveJSON(tr);
} }
#region Events #region Events
private void timer1_Tick(object sender, EventArgs e) => checkStatus(); private void timer1_Tick(object sender, EventArgs e) => checkStatus();
@ -243,6 +242,12 @@ namespace OWTrack
tr.gamePath = getGamePath(); tr.gamePath = getGamePath();
update(); 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> <ApplicationIcon>assets\Jeanette-Foshee-Simpsons-11-Rollover-Homer-donut-1.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />

View File

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

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

View File

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

View File

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