From 1b9b0d1c8e9e9557d45142c197aca2836a82bad4 Mon Sep 17 00:00:00 2001 From: Daniel Winter Date: Mon, 11 Jun 2018 19:47:44 +0200 Subject: [PATCH] Fixed #5, thanks to @kumitom and @gmgru1204 Refactored Form1 into MainScreen --- PraiseTheSave/App.config | 8 ++-- ...rm1.Designer.cs => MainScreen.Designer.cs} | 10 ++--- PraiseTheSave/{Form1.cs => MainScreen.cs} | 20 +++++++-- PraiseTheSave/{Form1.resx => MainScreen.resx} | 0 PraiseTheSave/PraiseTheSave.csproj | 21 +++++---- PraiseTheSave/Program.cs | 2 +- PraiseTheSave/Properties/Settings.Designer.cs | 44 ++++++++++++------- PraiseTheSave/Properties/Settings.settings | 6 +-- PraiseTheSave/packages.config | 3 +- 9 files changed, 71 insertions(+), 43 deletions(-) rename PraiseTheSave/{Form1.Designer.cs => MainScreen.Designer.cs} (99%) rename PraiseTheSave/{Form1.cs => MainScreen.cs} (94%) rename PraiseTheSave/{Form1.resx => MainScreen.resx} (100%) diff --git a/PraiseTheSave/App.config b/PraiseTheSave/App.config index 1e01681..ac6e251 100644 --- a/PraiseTheSave/App.config +++ b/PraiseTheSave/App.config @@ -25,15 +25,15 @@ ds1 + + ds1_remastered + - ds3 + ds2 ds3 - - ds1_remastered - \ No newline at end of file diff --git a/PraiseTheSave/Form1.Designer.cs b/PraiseTheSave/MainScreen.Designer.cs similarity index 99% rename from PraiseTheSave/Form1.Designer.cs rename to PraiseTheSave/MainScreen.Designer.cs index a7ffc6c..a5e79d7 100644 --- a/PraiseTheSave/Form1.Designer.cs +++ b/PraiseTheSave/MainScreen.Designer.cs @@ -1,6 +1,6 @@ namespace PraiseTheSave { - partial class Form1 + partial class MainScreen { /// /// Required designer variable. @@ -29,7 +29,7 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainScreen)); this.label1 = new System.Windows.Forms.Label(); this.ds3link = new System.Windows.Forms.Label(); this.ds3_found_folder = new System.Windows.Forms.Label(); @@ -372,7 +372,7 @@ private void InitializeComponent() this.ds1Rlink.Text = "Dark Souls I Remastered"; this.ds1Rlink.Click += new System.EventHandler(this.Ds1Rlink_Click); // - // Form1 + // MainScreen // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -408,9 +408,9 @@ private void InitializeComponent() this.ForeColor = System.Drawing.Color.White; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Name = "Form1"; + this.Name = "MainScreen"; this.Text = "Praise The Save"; - this.Load += new System.EventHandler(this.Form1_Load); + this.Load += new System.EventHandler(this.MainScreen_Load); ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.saveAmountInput)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.saveIntervalInput)).EndInit(); diff --git a/PraiseTheSave/Form1.cs b/PraiseTheSave/MainScreen.cs similarity index 94% rename from PraiseTheSave/Form1.cs rename to PraiseTheSave/MainScreen.cs index 75f6344..6306947 100644 --- a/PraiseTheSave/Form1.cs +++ b/PraiseTheSave/MainScreen.cs @@ -9,10 +9,11 @@ using System.Windows.Forms; using System.IO; using Ionic.Zip; +using AutoUpdaterDotNET; namespace PraiseTheSave { - public partial class Form1 : Form + public partial class MainScreen : Form { private class Game { @@ -101,7 +102,7 @@ public void Backup() private readonly Dictionary games; - public Form1() + public MainScreen() { backupTimer = new Timer(); backupTimer.Tick += new EventHandler(DoBackup); @@ -190,9 +191,20 @@ private static FileInfo GetOldestFileInDir(DirectoryInfo dir, bool checkSubdirs) (current, next) => next.LastWriteTime < current.LastWriteTime ? next : current); } - private void Form1_Load(object sender, EventArgs e) + private void MainScreen_Load(object sender, EventArgs e) { - + AutoUpdater.Start("https://lucidlemon.github.io/PraiseTheSave/AutoUpdater.xml"); + + System.Timers.Timer timer = new System.Timers.Timer + { + Interval = 2 * 60 * 1000, + SynchronizingObject = this + }; + timer.Elapsed += delegate + { + AutoUpdater.Start("https://lucidlemon.github.io/PraiseTheSave/AutoUpdater.xml"); + }; + timer.Start(); } public void RefreshInfo() diff --git a/PraiseTheSave/Form1.resx b/PraiseTheSave/MainScreen.resx similarity index 100% rename from PraiseTheSave/Form1.resx rename to PraiseTheSave/MainScreen.resx diff --git a/PraiseTheSave/PraiseTheSave.csproj b/PraiseTheSave/PraiseTheSave.csproj index 411026d..1bd0267 100644 --- a/PraiseTheSave/PraiseTheSave.csproj +++ b/PraiseTheSave/PraiseTheSave.csproj @@ -76,6 +76,9 @@ http://timestamp.digicert.com + + ..\packages\Autoupdater.NET.Official.1.4.10\lib\net452\AutoUpdater.NET.dll + ..\packages\Costura.Fody.2.0.1\lib\net452\Costura.dll @@ -95,11 +98,11 @@ - + Form - - Form1.cs + + MainScreen.cs @@ -108,8 +111,8 @@ True Resource1.resx - - Form1.cs + + MainScreen.cs ResXFileCodeGenerator @@ -138,7 +141,9 @@ - + + Designer + @@ -157,15 +162,15 @@ - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + +