diff --git a/OWTrack/Form1.Designer.cs b/OWTrack/Form1.Designer.cs index 7058f7e..e7c457c 100644 --- a/OWTrack/Form1.Designer.cs +++ b/OWTrack/Form1.Designer.cs @@ -46,6 +46,7 @@ this.srTextBox = new System.Windows.Forms.TextBox(); this.srBut = new System.Windows.Forms.Button(); this.srLabel = new System.Windows.Forms.Label(); + this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.SuspendLayout(); // // label1 @@ -70,7 +71,7 @@ // timer1 // this.timer1.Enabled = true; - this.timer1.Interval = 3000; + this.timer1.Interval = 6000; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // Time @@ -215,6 +216,12 @@ this.srLabel.TabIndex = 13; this.srLabel.Text = "0"; // + // openFileDialog1 + // + this.openFileDialog1.FileName = "Overwatch.exe"; + this.openFileDialog1.InitialDirectory = "C:\\"; + this.openFileDialog1.RestoreDirectory = true; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -265,6 +272,7 @@ private System.Windows.Forms.TextBox srTextBox; private System.Windows.Forms.Button srBut; private System.Windows.Forms.Label srLabel; + private System.Windows.Forms.OpenFileDialog openFileDialog1; } } diff --git a/OWTrack/Form1.cs b/OWTrack/Form1.cs index f00e742..a75d396 100644 --- a/OWTrack/Form1.cs +++ b/OWTrack/Form1.cs @@ -18,25 +18,23 @@ namespace OWTrack InitializeComponent(); loadSave(); checkStatus(); - label4.Text = Program.Version; - Text = "OWTrack " + Program.Version; + update(); + label4.Text = Program.Version.ToString(); + Text = "OWTrack " + Program.Version.ToString(); } private void checkStatus() - { + { try - { + { Time.Text = DateTime.Now.ToString("h:mm tt"); + status.Text = NOT_RUNNING; + status.ForeColor = Color.Red; if (tr.owRunning()) { status.Text = IS_RUNNING; status.ForeColor = Color.FromArgb(128, 255, 128); - } - else - { - status.Text = NOT_RUNNING; - status.ForeColor = Color.Red; - } + } } catch (Exception e) { @@ -50,17 +48,23 @@ namespace OWTrack { tr.wins = savedTracker().wins; tr.losses = savedTracker().losses; + tr.newSR = savedTracker().newSR; + tr.startSR = savedTracker().startSR; update(); } else MessageBox.Show("no save"); - } + } private bool saveExist() { try { if (File.Exists(Directory.GetCurrentDirectory() + "/data.json")) { return true; } - else return false; + else + { + getGamePath(); + return false; + } } catch (Exception e) { @@ -69,6 +73,20 @@ namespace OWTrack } } + private void getGamePath() + { + openFileDialog1.Title = "Select Overwatch.exe"; + openFileDialog1.DefaultExt = "exe"; + openFileDialog1.Filter = "exe Files (*.exe)|*.exe|All files (*.*)|*.*"; + openFileDialog1.CheckFileExists = true; + openFileDialog1.CheckPathExists = true; + + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + tr.gamePath = openFileDialog1.FileName; + } + } + private Tracker savedTracker() { try @@ -158,6 +176,6 @@ namespace OWTrack else tr.newSR = sr; } update(); - } + } } } diff --git a/OWTrack/Form1.resx b/OWTrack/Form1.resx index 1f666f2..5ec8f10 100644 --- a/OWTrack/Form1.resx +++ b/OWTrack/Form1.resx @@ -120,4 +120,7 @@ 17, 17 + + 104, 17 + \ No newline at end of file diff --git a/OWTrack/OWTrack.csproj b/OWTrack/OWTrack.csproj index 91f8bc3..e87106e 100644 --- a/OWTrack/OWTrack.csproj +++ b/OWTrack/OWTrack.csproj @@ -11,6 +11,7 @@ v4.6.1 512 true + false publish\ true Disk @@ -21,10 +22,10 @@ false false true - 0 - 1.0.0.%2a - false + 13 + 1.2.3.%2a false + true true @@ -67,6 +68,18 @@ MinimumRecommendedRules.ruleset true + + 120F37EDC91FF77172D31673046260B265C70C5D + + + OWTrack_TemporaryKey.pfx + + + true + + + true + ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll @@ -105,6 +118,7 @@ True Resources.resx + SettingsSingleFileGenerator diff --git a/OWTrack/Program.cs b/OWTrack/Program.cs index 9dfd33f..12db818 100644 --- a/OWTrack/Program.cs +++ b/OWTrack/Program.cs @@ -1,14 +1,16 @@ using System; using System.Collections.Generic; +using System.Deployment.Application; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; +using System.Deployment.Application; + namespace OWTrack { static class Program - { - public static string Version = "1.2.3"; + { /// /// The main entry point for the application. /// @@ -19,6 +21,10 @@ namespace OWTrack Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } - + + public static string Version = "1.2.4"; + //public static string Version = Application.ProductVersion; + //public static Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + } } diff --git a/OWTrack/Properties/AssemblyInfo.cs b/OWTrack/Properties/AssemblyInfo.cs index b13bdd9..657d72d 100644 --- a/OWTrack/Properties/AssemblyInfo.cs +++ b/OWTrack/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("OWTrack")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Hesham Systems LLC")] [assembly: AssemblyProduct("OWTrack")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] @@ -33,7 +33,10 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +//[assembly: AssemblyVersion("1.0.0.0")] +//[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("2.0.*")] +[assembly: AssemblyFileVersion("1.0.*")] [assembly: NeutralResourcesLanguage("")] + diff --git a/OWTrack/Tracker.cs b/OWTrack/Tracker.cs index afdfe43..5f3ca97 100644 --- a/OWTrack/Tracker.cs +++ b/OWTrack/Tracker.cs @@ -8,6 +8,7 @@ namespace OWTrack class Tracker { public int wins, losses, startSR, newSR = 0; + public string gamePath; public void Track() { } public void reset() { wins = 0; losses = 0; startSR = 0; newSR = 0; } @@ -20,12 +21,13 @@ namespace OWTrack public void setNewSR(int SR) { newSR = SR; } public int srDiff() { return newSR - startSR; } + public bool owRunning() { try { bool isRunning = Process.GetProcessesByName("Overwatch") - .FirstOrDefault(p => p.MainModule.FileName.StartsWith(@"D:\Hesham\installed Games\Overwatch")) != default(Process); + .FirstOrDefault(p => p.MainModule.FileName.StartsWith(gamePath)) != default(Process); return isRunning; } catch (Exception e)