Merge branch 'Dev' of Hesham/OWtrack into master
This commit is contained in:
commit
88ddbc2a4e
26
OWTrack/Form1.Designer.cs
generated
26
OWTrack/Form1.Designer.cs
generated
@ -47,6 +47,7 @@
|
||||
this.srBut = new System.Windows.Forms.Button();
|
||||
this.srLabel = new System.Windows.Forms.Label();
|
||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
@ -139,21 +140,21 @@
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("Monospac821 BT", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label2.ForeColor = System.Drawing.Color.Black;
|
||||
this.label2.Location = new System.Drawing.Point(142, 76);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(42, 45);
|
||||
this.label2.Size = new System.Drawing.Size(31, 42);
|
||||
this.label2.TabIndex = 5;
|
||||
this.label2.Text = "-";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Font = new System.Drawing.Font("Monospac821 BT", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label4.Location = new System.Drawing.Point(12, 217);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(35, 11);
|
||||
this.label4.Size = new System.Drawing.Size(29, 12);
|
||||
this.label4.TabIndex = 7;
|
||||
this.label4.Text = "label4";
|
||||
//
|
||||
@ -210,11 +211,11 @@
|
||||
this.srLabel.AutoSize = true;
|
||||
this.srLabel.Font = new System.Drawing.Font("Noto Mono", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.srLabel.ForeColor = System.Drawing.Color.DarkOrchid;
|
||||
this.srLabel.Location = new System.Drawing.Point(183, 26);
|
||||
this.srLabel.Location = new System.Drawing.Point(189, 36);
|
||||
this.srLabel.Name = "srLabel";
|
||||
this.srLabel.Size = new System.Drawing.Size(21, 23);
|
||||
this.srLabel.Size = new System.Drawing.Size(65, 23);
|
||||
this.srLabel.TabIndex = 13;
|
||||
this.srLabel.Text = "0";
|
||||
this.srLabel.Text = "0 - 0";
|
||||
//
|
||||
// openFileDialog1
|
||||
//
|
||||
@ -222,11 +223,21 @@
|
||||
this.openFileDialog1.InitialDirectory = "C:\\";
|
||||
this.openFileDialog1.RestoreDirectory = true;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(190, 13);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(87, 13);
|
||||
this.label5.TabIndex = 14;
|
||||
this.label5.Text = "Start - Gain/Loss";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(332, 237);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.srLabel);
|
||||
this.Controls.Add(this.srBut);
|
||||
this.Controls.Add(this.srTextBox);
|
||||
@ -273,6 +284,7 @@
|
||||
private System.Windows.Forms.Button srBut;
|
||||
private System.Windows.Forms.Label srLabel;
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
||||
private System.Windows.Forms.Label label5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace OWTrack
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
@ -15,12 +16,13 @@ namespace OWTrack
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeComponent();
|
||||
loadSave();
|
||||
checkStatus();
|
||||
update();
|
||||
label4.Text = Program.Version.ToString();
|
||||
Text = "OWTrack " + Program.Version.ToString();
|
||||
Text = "OWTrack " + Program.Version.ToString();
|
||||
|
||||
}
|
||||
|
||||
private void checkStatus()
|
||||
@ -50,19 +52,42 @@ namespace OWTrack
|
||||
tr.losses = savedTracker().losses;
|
||||
tr.newSR = savedTracker().newSR;
|
||||
tr.startSR = savedTracker().startSR;
|
||||
tr.gamePath = savedTracker().gamePath;
|
||||
update();
|
||||
}
|
||||
else MessageBox.Show("no save");
|
||||
}
|
||||
}
|
||||
|
||||
private bool saveExist()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(Directory.GetCurrentDirectory() + "/data.json")) { return true; }
|
||||
if (File.Exists(Directory.GetCurrentDirectory() + "/data.json"))
|
||||
{
|
||||
using (StreamReader st = new StreamReader(Directory.GetCurrentDirectory() + "/data.json"))
|
||||
{
|
||||
string line = st.ReadLine();
|
||||
if (line.Contains("Overwatch.exe"))
|
||||
{
|
||||
st.Close();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!tr.LoacteOW())
|
||||
{
|
||||
st.Close();
|
||||
getGamePath();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getGamePath();
|
||||
if (!tr.LoacteOW())
|
||||
{
|
||||
getGamePath();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -81,10 +106,18 @@ namespace OWTrack
|
||||
openFileDialog1.CheckFileExists = true;
|
||||
openFileDialog1.CheckPathExists = true;
|
||||
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
DialogResult result = openFileDialog1.ShowDialog();
|
||||
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
tr.gamePath = openFileDialog1.FileName;
|
||||
}
|
||||
else if (result == DialogResult.Cancel)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
FindForm();
|
||||
update();
|
||||
}
|
||||
|
||||
private Tracker savedTracker()
|
||||
|
@ -75,11 +75,17 @@
|
||||
<ManifestKeyFile>OWTrack_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>true</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</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>
|
||||
@ -118,6 +124,7 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="app.manifest" />
|
||||
<None Include="OWTrack_TemporaryKey.pfx" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
|
@ -22,7 +22,7 @@ namespace OWTrack
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
|
||||
public static string Version = "1.2.4";
|
||||
public static string Version = "1.3.0";
|
||||
//public static string Version = Application.ProductVersion;
|
||||
//public static Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
|
||||
|
@ -2,13 +2,15 @@
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OWTrack
|
||||
{
|
||||
class Tracker
|
||||
{
|
||||
public int wins, losses, startSR, newSR = 0;
|
||||
public string gamePath;
|
||||
public string gamePath;
|
||||
|
||||
public void Track() { }
|
||||
public void reset() { wins = 0; losses = 0; startSR = 0; newSR = 0; }
|
||||
@ -21,7 +23,6 @@ namespace OWTrack
|
||||
public void setNewSR(int SR) { newSR = SR; }
|
||||
public int srDiff() { return newSR - startSR; }
|
||||
|
||||
|
||||
public bool owRunning()
|
||||
{
|
||||
try
|
||||
@ -35,6 +36,70 @@ namespace OWTrack
|
||||
Exception ex = new Exception("Error in tracking Overwatch.exe");
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not Working!
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool LoacteOW()
|
||||
{
|
||||
try
|
||||
{
|
||||
List<string> paths = new List<string>();
|
||||
string[] filesC = null;
|
||||
string[] filesD = null;
|
||||
|
||||
if (ProgramFilesExist('c')) { filesC = Directory.GetFiles("C:\\Program Files", "Overwatch.exe", SearchOption.AllDirectories); }
|
||||
if (ProgramFilesExist('d')) { filesD = Directory.GetFiles("D:\\Program Files", "Overwatch.exe", SearchOption.AllDirectories); }
|
||||
|
||||
if (filesC != null)
|
||||
{
|
||||
for (int i = 0; i < filesC.Length; i++)
|
||||
{
|
||||
if (filesC[i].Contains("Overwatch.exe"))
|
||||
{
|
||||
paths.Add(filesC[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (filesD != null)
|
||||
{
|
||||
for (int i = 0; i < filesD.Length - 1; i++)
|
||||
{
|
||||
if (filesD[i].Contains("Overwatch.exe"))
|
||||
{
|
||||
paths.Add(filesD[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (paths.Count > 1)
|
||||
{
|
||||
//TODO: ask about correct path
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (paths.Count == 1)
|
||||
{
|
||||
gamePath = paths[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
else return false;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool ProgramFilesExist(char drive)
|
||||
{
|
||||
return Directory.Exists(drive+":\\Program Files");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
70
OWTrack/app.manifest
Normal file
70
OWTrack/app.manifest
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel element will disable file and registry virtualization.
|
||||
Remove this element if your application requires this virtualization for backwards
|
||||
compatibility.
|
||||
-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
<applicationRequestMinimum>
|
||||
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
</applicationRequestMinimum>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on and is
|
||||
is designed to work with. Uncomment the appropriate elements and Windows will
|
||||
automatically selected the most compatible environment. -->
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
|
||||
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
|
||||
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
</assembly>
|
Loading…
Reference in New Issue
Block a user