Merge branch 'feature/exeTrack' of Hesham/OWtrack into Dev
This commit is contained in:
		
						commit
						3ac7799719
					
				
							
								
								
									
										8
									
								
								OWTrack/Form1.Designer.cs
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								OWTrack/Form1.Designer.cs
									
									
									
										generated
									
									
									
								
							@ -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
 | 
			
		||||
@ -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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,17 +18,18 @@ namespace OWTrack
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
            loadSave();
 | 
			
		||||
            checkStatus();
 | 
			
		||||
            label4.Text = Program.version.ToString();
 | 
			
		||||
            Text = "OWTrack " + Program.version.ToString();           
 | 
			
		||||
            update();
 | 
			
		||||
            label4.Text = Program.Version.ToString();
 | 
			
		||||
            Text = "OWTrack " + Program.Version.ToString();           
 | 
			
		||||
        }
 | 
			
		||||
                
 | 
			
		||||
        private void checkStatus()
 | 
			
		||||
        {                                   
 | 
			
		||||
            Time.Text = DateTime.Now.ToString("h:mm tt");
 | 
			
		||||
            status.Text = NOT_RUNNING;
 | 
			
		||||
            status.ForeColor = Color.Red;
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                Time.Text = DateTime.Now.ToString("h:mm tt");
 | 
			
		||||
                status.Text = NOT_RUNNING;
 | 
			
		||||
                status.ForeColor = Color.Red;
 | 
			
		||||
                if (tr.owRunning())
 | 
			
		||||
                {
 | 
			
		||||
                    status.Text = IS_RUNNING;
 | 
			
		||||
@ -47,6 +48,11 @@ namespace OWTrack
 | 
			
		||||
            {
 | 
			
		||||
                tr.wins = savedTracker().wins;
 | 
			
		||||
                tr.losses = savedTracker().losses;
 | 
			
		||||
                tr.gamePath = savedTracker().gamePath;
 | 
			
		||||
                //if (tr.gamePath == "" || tr.gamePath == null)
 | 
			
		||||
                //{
 | 
			
		||||
                   
 | 
			
		||||
                //}
 | 
			
		||||
                update();
 | 
			
		||||
            }
 | 
			
		||||
            else MessageBox.Show("no save");
 | 
			
		||||
@ -57,7 +63,11 @@ namespace OWTrack
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                if (File.Exists(Directory.GetCurrentDirectory() + "/data.json")) { return true; }
 | 
			
		||||
                else return false;
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    getGamePath();
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception e)
 | 
			
		||||
            {
 | 
			
		||||
@ -66,6 +76,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
 | 
			
		||||
 | 
			
		||||
@ -120,4 +120,7 @@
 | 
			
		||||
  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
 | 
			
		||||
    <value>17, 17</value>
 | 
			
		||||
  </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>
 | 
			
		||||
@ -22,7 +22,7 @@
 | 
			
		||||
    <UpdatePeriodically>false</UpdatePeriodically>
 | 
			
		||||
    <UpdateRequired>false</UpdateRequired>
 | 
			
		||||
    <MapFileExtensions>true</MapFileExtensions>
 | 
			
		||||
    <ApplicationRevision>12</ApplicationRevision>
 | 
			
		||||
    <ApplicationRevision>13</ApplicationRevision>
 | 
			
		||||
    <ApplicationVersion>1.2.3.%2a</ApplicationVersion>
 | 
			
		||||
    <UseApplicationTrust>false</UseApplicationTrust>
 | 
			
		||||
    <PublishWizardCompleted>true</PublishWizardCompleted>
 | 
			
		||||
 | 
			
		||||
@ -11,7 +11,6 @@ namespace OWTrack
 | 
			
		||||
{
 | 
			
		||||
    static class Program
 | 
			
		||||
    {        
 | 
			
		||||
        //public static string Version = Application.ProductVersion;
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The main entry point for the application.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
@ -22,6 +21,10 @@ namespace OWTrack
 | 
			
		||||
            Application.SetCompatibleTextRenderingDefault(false);
 | 
			
		||||
            Application.Run(new Form1());
 | 
			
		||||
        }
 | 
			
		||||
       public static Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
 | 
			
		||||
 | 
			
		||||
        public static string Version = "1.2.3";
 | 
			
		||||
        //public static string Version = Application.ProductVersion;
 | 
			
		||||
        //public static Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user