Merge for 1.2.4 #8

Merged
Hesham merged 11 commits from Dev into master 2018-09-01 13:26:28 +02:00
7 changed files with 78 additions and 24 deletions

View File

@ -46,6 +46,7 @@
this.srTextBox = new System.Windows.Forms.TextBox(); this.srTextBox = new System.Windows.Forms.TextBox();
this.srBut = new System.Windows.Forms.Button(); this.srBut = new System.Windows.Forms.Button();
this.srLabel = new System.Windows.Forms.Label(); this.srLabel = new System.Windows.Forms.Label();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
@ -70,7 +71,7 @@
// timer1 // timer1
// //
this.timer1.Enabled = true; this.timer1.Enabled = true;
this.timer1.Interval = 3000; this.timer1.Interval = 6000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
// Time // Time
@ -215,6 +216,12 @@
this.srLabel.TabIndex = 13; this.srLabel.TabIndex = 13;
this.srLabel.Text = "0"; this.srLabel.Text = "0";
// //
// openFileDialog1
//
this.openFileDialog1.FileName = "Overwatch.exe";
this.openFileDialog1.InitialDirectory = "C:\\";
this.openFileDialog1.RestoreDirectory = true;
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -265,6 +272,7 @@
private System.Windows.Forms.TextBox srTextBox; private System.Windows.Forms.TextBox srTextBox;
private System.Windows.Forms.Button srBut; private System.Windows.Forms.Button srBut;
private System.Windows.Forms.Label srLabel; private System.Windows.Forms.Label srLabel;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
} }
} }

View File

@ -18,8 +18,9 @@ namespace OWTrack
InitializeComponent(); InitializeComponent();
loadSave(); loadSave();
checkStatus(); checkStatus();
label4.Text = Program.Version; update();
Text = "OWTrack " + Program.Version; label4.Text = Program.Version.ToString();
Text = "OWTrack " + Program.Version.ToString();
} }
private void checkStatus() private void checkStatus()
@ -27,16 +28,13 @@ namespace OWTrack
try try
{ {
Time.Text = DateTime.Now.ToString("h:mm tt"); Time.Text = DateTime.Now.ToString("h:mm tt");
status.Text = NOT_RUNNING;
status.ForeColor = Color.Red;
if (tr.owRunning()) if (tr.owRunning())
{ {
status.Text = IS_RUNNING; status.Text = IS_RUNNING;
status.ForeColor = Color.FromArgb(128, 255, 128); status.ForeColor = Color.FromArgb(128, 255, 128);
} }
else
{
status.Text = NOT_RUNNING;
status.ForeColor = Color.Red;
}
} }
catch (Exception e) catch (Exception e)
{ {
@ -50,6 +48,8 @@ namespace OWTrack
{ {
tr.wins = savedTracker().wins; tr.wins = savedTracker().wins;
tr.losses = savedTracker().losses; tr.losses = savedTracker().losses;
tr.newSR = savedTracker().newSR;
tr.startSR = savedTracker().startSR;
update(); update();
} }
else MessageBox.Show("no save"); else MessageBox.Show("no save");
@ -60,7 +60,11 @@ namespace OWTrack
try try
{ {
if (File.Exists(Directory.GetCurrentDirectory() + "/data.json")) { return true; } if (File.Exists(Directory.GetCurrentDirectory() + "/data.json")) { return true; }
else return false; else
{
getGamePath();
return false;
}
} }
catch (Exception e) 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() private Tracker savedTracker()
{ {
try try

View File

@ -120,4 +120,7 @@
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>104, 17</value>
</metadata>
</root> </root>

View File

@ -11,6 +11,7 @@
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Disk</InstallFrom> <InstallFrom>Disk</InstallFrom>
@ -21,10 +22,10 @@
<UpdatePeriodically>false</UpdatePeriodically> <UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired> <UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>13</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.2.3.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@ -67,6 +68,18 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>120F37EDC91FF77172D31673046260B265C70C5D</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>OWTrack_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <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> <HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
@ -105,6 +118,7 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<None Include="OWTrack_TemporaryKey.pfx" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>

View File

@ -1,14 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Deployment.Application;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Deployment.Application;
namespace OWTrack namespace OWTrack
{ {
static class Program static class Program
{ {
public static string Version = "1.2.3";
/// <summary> /// <summary>
/// The main entry point for the application. /// The main entry point for the application.
/// </summary> /// </summary>
@ -20,5 +22,9 @@ namespace OWTrack
Application.Run(new Form1()); 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;
} }
} }

View File

@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OWTrack")] [assembly: AssemblyTitle("OWTrack")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("Hesham Systems LLC")]
[assembly: AssemblyProduct("OWTrack")] [assembly: AssemblyProduct("OWTrack")]
[assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")] [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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] //[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("2.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]
[assembly: NeutralResourcesLanguage("")] [assembly: NeutralResourcesLanguage("")]

View File

@ -8,6 +8,7 @@ namespace OWTrack
class Tracker class Tracker
{ {
public int wins, losses, startSR, newSR = 0; public int wins, losses, startSR, newSR = 0;
public string gamePath;
public void Track() { } public void Track() { }
public void reset() { wins = 0; losses = 0; startSR = 0; newSR = 0; } 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 void setNewSR(int SR) { newSR = SR; }
public int srDiff() { return newSR - startSR; } public int srDiff() { return newSR - startSR; }
public bool owRunning() public bool owRunning()
{ {
try try
{ {
bool isRunning = Process.GetProcessesByName("Overwatch") 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; return isRunning;
} }
catch (Exception e) catch (Exception e)