diff --git a/OWTrack/Form1.Designer.cs b/OWTrack/Form1.Designer.cs index 7f6b050..e469608 100644 --- a/OWTrack/Form1.Designer.cs +++ b/OWTrack/Form1.Designer.cs @@ -38,6 +38,7 @@ this.label3 = new System.Windows.Forms.Label(); this.WinBut = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // label1 @@ -79,7 +80,7 @@ this.Wins.AutoSize = true; this.Wins.Font = new System.Drawing.Font("Miriam Mono CLM", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177))); this.Wins.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); - this.Wins.Location = new System.Drawing.Point(70, 75); + this.Wins.Location = new System.Drawing.Point(75, 75); this.Wins.Name = "Wins"; this.Wins.Size = new System.Drawing.Size(40, 42); this.Wins.TabIndex = 3; @@ -90,7 +91,7 @@ this.Losses.AutoSize = true; this.Losses.Font = new System.Drawing.Font("Miriam Mono CLM", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177))); this.Losses.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.Losses.Location = new System.Drawing.Point(153, 73); + this.Losses.Location = new System.Drawing.Point(130, 75); this.Losses.Name = "Losses"; this.Losses.Size = new System.Drawing.Size(40, 42); this.Losses.TabIndex = 4; @@ -101,7 +102,7 @@ this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Miriam Mono CLM", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177))); this.label3.ForeColor = System.Drawing.Color.Black; - this.label3.Location = new System.Drawing.Point(116, 75); + this.label3.Location = new System.Drawing.Point(112, 72); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(40, 42); this.label3.TabIndex = 5; @@ -109,7 +110,7 @@ // // WinBut // - this.WinBut.Location = new System.Drawing.Point(12, 87); + this.WinBut.Location = new System.Drawing.Point(67, 132); this.WinBut.Name = "WinBut"; this.WinBut.Size = new System.Drawing.Size(52, 26); this.WinBut.TabIndex = 6; @@ -119,7 +120,7 @@ // // button2 // - this.button2.Location = new System.Drawing.Point(199, 89); + this.button2.Location = new System.Drawing.Point(125, 132); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(52, 26); this.button2.TabIndex = 6; @@ -127,22 +128,36 @@ this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Miriam Mono CLM", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177))); + this.label2.ForeColor = System.Drawing.Color.Black; + this.label2.Location = new System.Drawing.Point(103, 73); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(40, 42); + this.label2.TabIndex = 5; + this.label2.Text = ":"; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(263, 170); + this.Controls.Add(this.Wins); + this.Controls.Add(this.Losses); this.Controls.Add(this.button2); this.Controls.Add(this.WinBut); + this.Controls.Add(this.label2); this.Controls.Add(this.label3); - this.Controls.Add(this.Losses); - this.Controls.Add(this.Wins); this.Controls.Add(this.Time); this.Controls.Add(this.status); this.Controls.Add(this.label1); + this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Name = "Form1"; - this.Text = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "OWTrack"; this.ResumeLayout(false); this.PerformLayout(); @@ -159,6 +174,7 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.Button WinBut; private System.Windows.Forms.Button button2; + private System.Windows.Forms.Label label2; } } diff --git a/OWTrack/Form1.cs b/OWTrack/Form1.cs index d231084..1e654ec 100644 --- a/OWTrack/Form1.cs +++ b/OWTrack/Form1.cs @@ -31,17 +31,24 @@ namespace OWTrack private void checkStatus() { - Time.Text = DateTime.Now.ToString("h:mm tt"); - if (tr.owRunning()) - { - status.Text = IS_RUNNING; - status.ForeColor = Color.FromArgb(128, 255, 128); - } - else - { - status.Text = NOT_RUNNING; - status.ForeColor = Color.Red; - } + try + { + Time.Text = DateTime.Now.ToString("h:mm tt"); + 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) + { + MessageBox.Show(e.Message); + } } private void button1_Click(object sender, EventArgs e) diff --git a/OWTrack/OWTrack.csproj b/OWTrack/OWTrack.csproj index a849ff4..a21b8d3 100644 --- a/OWTrack/OWTrack.csproj +++ b/OWTrack/OWTrack.csproj @@ -11,6 +11,21 @@ v4.6.1 512 true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true AnyCPU @@ -40,11 +55,12 @@ prompt MinimumRecommendedRules.ruleset true + false bin\x64\Release\ TRACE - true + false pdbonly x64 prompt @@ -99,5 +115,17 @@ + + + False + Microsoft .NET Framework 4.6.1 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + \ No newline at end of file diff --git a/OWTrack/Properties/AssemblyInfo.cs b/OWTrack/Properties/AssemblyInfo.cs index 2d9b1a4..b13bdd9 100644 --- a/OWTrack/Properties/AssemblyInfo.cs +++ b/OWTrack/Properties/AssemblyInfo.cs @@ -1,4 +1,5 @@ -using System.Reflection; +using System.Resources; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -34,3 +35,5 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: NeutralResourcesLanguage("")] + diff --git a/OWTrack/Tracker.cs b/OWTrack/Tracker.cs index a4baa49..8e89b18 100644 --- a/OWTrack/Tracker.cs +++ b/OWTrack/Tracker.cs @@ -15,12 +15,20 @@ namespace OWTrack { } - + public bool owRunning() - { - bool isRunning = Process.GetProcessesByName("Overwatch") - .FirstOrDefault(p => p.MainModule.FileName.StartsWith(@"D:\Hesham\installed Games\Overwatch")) != default(Process); - return isRunning; + { + try + { + bool isRunning = Process.GetProcessesByName("Overwatch") + .FirstOrDefault(p => p.MainModule.FileName.StartsWith(@"D:\Hesham\installed Games\Overwatch")) != default(Process); + return isRunning; + } + catch (Exception e) + { + Exception ex = new Exception("Error in tracking Overwatch.exe"); + throw ex; + } } public void addWin() { wins++; }