diff --git a/OWTrack/Form1.cs b/OWTrack/Form1.cs index ccf8ea5..bb128c1 100644 --- a/OWTrack/Form1.cs +++ b/OWTrack/Form1.cs @@ -16,6 +16,7 @@ namespace OWTrack public Form1() { + InitializeComponent(); loadSave(); checkStatus(); @@ -120,7 +121,7 @@ namespace OWTrack update(); } - private Tracker savedTracker() + private Tracker savedTracker()// { try { @@ -173,7 +174,7 @@ namespace OWTrack } else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff(); srTextBox.Text = null; - File.WriteAllText(Directory.GetCurrentDirectory() + "/data.json", JsonConvert.SerializeObject(tr)); + File.WriteAllText(Directory.GetCurrentDirectory() + "/data.json", JsonConvert.SerializeObject(tr));// } private void clearBut_Click(object sender, EventArgs e) diff --git a/OWTrack/Splash.Designer.cs b/OWTrack/Splash.Designer.cs new file mode 100644 index 0000000..ca13c55 --- /dev/null +++ b/OWTrack/Splash.Designer.cs @@ -0,0 +1,98 @@ +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 new file mode 100644 index 0000000..84789ca --- /dev/null +++ b/OWTrack/Splash.cs @@ -0,0 +1,20 @@ +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 new file mode 100644 index 0000000..6a68c91 --- /dev/null +++ b/OWTrack/Splash.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/saveManeger.cs b/OWTrack/saveManeger.cs new file mode 100644 index 0000000..7349658 --- /dev/null +++ b/OWTrack/saveManeger.cs @@ -0,0 +1,92 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OWTrack +{ + class saveManeger + { + public static Tracker GetSavedTracker() + { + try + { + return JsonConvert.DeserializeObject(File.ReadAllText(Directory.GetCurrentDirectory() + "/data.json")); + } + catch (Exception e) + { + throw e; + } + } + + //TODO: use para + public static Tracker GetSavedTracker(string customPath) + { + try + { + return JsonConvert.DeserializeObject(File.ReadAllText(Directory.GetCurrentDirectory() + "/data.json")); + } + catch (Exception e) + { + throw e; + } + } + + public static bool SaveJSON(Tracker tracker) + { + try + { + File.WriteAllText(Directory.GetCurrentDirectory() + "/data.json", JsonConvert.SerializeObject(tracker)); + return true; + } + catch (Exception) + { + return false; + } + } + + //private bool saveExist() + //{ + // try + // { + // 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 + // { + // if (!tr.LoacteOW()) + // { + // getGamePath(); + // } + // return false; + // } + // } + // catch (Exception e) + // { + // MessageBox.Show(e.Message); + // return false; + // } + //} + } +}