From ec9def19c467547639c1e46e1ec896da06154987 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Fri, 21 Dec 2018 23:23:59 +0300 Subject: [PATCH] Fixed bug and organize #39 #33 #11 --- OWTrack/MainForm.cs | 15 +++-- OWTrack/OWTrack.csproj | 9 --- OWTrack/Splash.Designer.cs | 98 ----------------------------- OWTrack/Splash.cs | 20 ------ OWTrack/Splash.resx | 123 ------------------------------------- OWTrack/Tracker.cs | 28 ++++++--- 6 files changed, 26 insertions(+), 267 deletions(-) delete mode 100644 OWTrack/Splash.Designer.cs delete mode 100644 OWTrack/Splash.cs delete mode 100644 OWTrack/Splash.resx diff --git a/OWTrack/MainForm.cs b/OWTrack/MainForm.cs index 30b449f..28713ab 100644 --- a/OWTrack/MainForm.cs +++ b/OWTrack/MainForm.cs @@ -34,15 +34,14 @@ namespace OWTrack private string Version = Program.Version.ToString(); public MainForm() - { + { InitializeComponent(); - tr = new Tracker(); + tr = new Tracker(); loadSave(); - tr.StartNewSeission(); checkStatus(); update(); label4.Text = Version; - Text = "OWTrack " + Version; + Text = "OWTrack " + Version; } private void checkStatus() @@ -72,8 +71,7 @@ namespace OWTrack } } - //Move to saveManeger.cs ? - //Refactor!! + //Move to saveManeger.cs ? private void loadSave() { try @@ -109,6 +107,7 @@ namespace OWTrack } ExeTrackCheckBx.Checked = tr.settings.TrackOW; SRCheckBx.Checked = tr.settings.TrackSR; + tr.StartNewSeission(); } private string askForGamePath() @@ -152,10 +151,10 @@ namespace OWTrack { Match match = new Match { - oldSR = tr.startSR, + StartSR = tr.startSR, newSR = tr.newSR, ChangeInSR = tr.srDiff(), - dateTime = DateTime.Now + dateTime = DateTime.Now.Date }; tr.GetCurrentSession().AddMatch(match); } diff --git a/OWTrack/OWTrack.csproj b/OWTrack/OWTrack.csproj index 9a402fc..a6997e9 100644 --- a/OWTrack/OWTrack.csproj +++ b/OWTrack/OWTrack.csproj @@ -113,12 +113,6 @@ MainForm.cs - - Form - - - Splash.cs - @@ -134,9 +128,6 @@ True Resources.resx - - Splash.cs - diff --git a/OWTrack/Splash.Designer.cs b/OWTrack/Splash.Designer.cs deleted file mode 100644 index ca13c55..0000000 --- a/OWTrack/Splash.Designer.cs +++ /dev/null @@ -1,98 +0,0 @@ -namespace OWTrack -{ - partial class Splash - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.pageSetupDialog1 = new System.Windows.Forms.PageSetupDialog(); - this.progressBar1 = new System.Windows.Forms.ProgressBar(); - this.splashLabel = new System.Windows.Forms.Label(); - this.versionLabel = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // progressBar1 - // - this.progressBar1.Location = new System.Drawing.Point(95, 57); - this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(196, 12); - this.progressBar1.TabIndex = 0; - // - // splashLabel - // - this.splashLabel.AutoSize = true; - this.splashLabel.Location = new System.Drawing.Point(171, 31); - this.splashLabel.Name = "splashLabel"; - this.splashLabel.Size = new System.Drawing.Size(0, 13); - this.splashLabel.TabIndex = 1; - this.splashLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // versionLabel - // - this.versionLabel.AutoSize = true; - this.versionLabel.Location = new System.Drawing.Point(13, 91); - this.versionLabel.Name = "versionLabel"; - this.versionLabel.Size = new System.Drawing.Size(0, 13); - this.versionLabel.TabIndex = 2; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.Gray; - this.label1.Location = new System.Drawing.Point(13, 13); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(89, 24); - this.label1.TabIndex = 3; - this.label1.Text = "OWtrack"; - // - // Splash - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(402, 116); - this.Controls.Add(this.label1); - this.Controls.Add(this.versionLabel); - this.Controls.Add(this.splashLabel); - this.Controls.Add(this.progressBar1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.Name = "Splash"; - this.Text = "Splash"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PageSetupDialog pageSetupDialog1; - private System.Windows.Forms.ProgressBar progressBar1; - private System.Windows.Forms.Label splashLabel; - private System.Windows.Forms.Label versionLabel; - private System.Windows.Forms.Label label1; - } -} \ No newline at end of file diff --git a/OWTrack/Splash.cs b/OWTrack/Splash.cs deleted file mode 100644 index 84789ca..0000000 --- a/OWTrack/Splash.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace OWTrack -{ - public partial class Splash : Form - { - public Splash() - { - InitializeComponent(); - } - } -} diff --git a/OWTrack/Splash.resx b/OWTrack/Splash.resx deleted file mode 100644 index 6a68c91..0000000 --- a/OWTrack/Splash.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/OWTrack/Tracker.cs b/OWTrack/Tracker.cs index 26e7394..b7f56ea 100644 --- a/OWTrack/Tracker.cs +++ b/OWTrack/Tracker.cs @@ -30,13 +30,17 @@ namespace OWTrack class Tracker { public int wins, losses, startSR, newSR, totalMatches = 0; - public void reset() { wins = 0; losses = 0; startSR = 0; newSR = 0; settings.Reset(); } + public void addWin() => wins++; public void addLoss() => losses++; public void reduceWin() => wins--; public void rediceLoss() => losses--; public int GetWins() { return wins; } public int GetLosses() { return losses; } + public void setNewSR(int SR) { newSR = SR; } + public int srDiff() { return newSR - startSR; } + public Settings settings = new Settings(); + public List sessions = new List(); public int GetTotalMatches() { int number = 0; @@ -52,12 +56,17 @@ namespace OWTrack return sessions.Last().TotalMatches; } - public void setNewSR(int SR) { newSR = SR; } - public int srDiff() { return newSR - startSR; } - public Settings settings = new Settings(); - //public List matches = new List(); - public List sessions = new List(); - + public void reset() + { + wins = 0; + losses = 0; + startSR = 0; + newSR = 0; + settings.Reset(); + sessions.Clear(); + StartNewSeission(); + } + public void StartNewSeission() { Session ses = new Session(startSR); @@ -69,6 +78,7 @@ namespace OWTrack { return sessions.Last(); } + public bool owRunning() { if (settings.TrackOW) @@ -170,8 +180,8 @@ namespace OWTrack public int TotalMatches; public int SkillChange; public int StartSR; - public List Matches = new List(); public DateTime date; + public List Matches = new List(); /// /// Start a new session with a starting Skill Rating @@ -205,7 +215,7 @@ namespace OWTrack { public Match() { } public DateTime dateTime { get; set; } - public int oldSR; + public int StartSR; public int newSR; public int ChangeInSR; }