Skip to content
This repository was archived by the owner on Dec 24, 2020. It is now read-only.

Commit 7581d1f

Browse files
committed
Brightness Controller 2.0.0.4
- Improve update fuction.
1 parent bb5e93f commit 7581d1f

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

Brightness Controller/Main.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,7 @@ private void RestartProgram(string location)
565565

566566
private async void Updater()
567567
{
568-
await Task.Delay(1);
569-
string NewExeLocations = AppDomain.CurrentDomain.BaseDirectory + "Brightness Controller.exe";
570-
MessageBox.Show(NewExeLocations);
568+
await Task.Delay(60000);
571569
try
572570
{
573571
using (WebClient client = new WebClient())
@@ -577,24 +575,23 @@ private async void Updater()
577575
if (CheckVersion.Contains(".") & Application.ProductVersion != CheckVersion)
578576
{
579577
string ExeLocation = System.Reflection.Assembly.GetEntryAssembly().Location;
580-
string NewExeLocation = AppDomain.CurrentDomain.BaseDirectory + @"\Brightness Controller.exe";
578+
string NewExeLocation = AppDomain.CurrentDomain.BaseDirectory + "Brightness Controller.exe";
581579
try
582580
{
583-
client.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
584-
client.DownloadFile("https://minormole.github.io/Brightness_Controller/update/Brightness%20Controller.zip", ExeLocation + ".new");
585-
if (File.Exists(ExeLocation + ".new"))
581+
client.DownloadFile("https://minormole.github.io/Brightness_Controller/update/Brightness%20Controller.zip", NewExeLocation + ".new");
582+
if (File.Exists(NewExeLocation + ".new"))
586583
{
587-
File.Move(ExeLocation, ExeLocation + ".old");
588-
ZipFile.ExtractToDirectory(ExeLocation + ".new", AppDomain.CurrentDomain.BaseDirectory);
589-
File.Delete(ExeLocation + ".new");
590-
RestartProgram(ExeLocation);
584+
File.Move(ExeLocation, NewExeLocation + ".old");
585+
ZipFile.ExtractToDirectory(NewExeLocation + ".new", AppDomain.CurrentDomain.BaseDirectory);
586+
File.Delete(NewExeLocation + ".new");
587+
RestartProgram(NewExeLocation);
591588
}
592589
}
593590
catch (Exception)
594591
{
595592
try
596593
{
597-
File.Delete(ExeLocation + ".new");
594+
File.Delete(NewExeLocation + ".new");
598595
}
599596
catch (Exception) { }
600597
}
@@ -603,6 +600,7 @@ private async void Updater()
603600
}
604601
catch (Exception) { }
605602
}
603+
606604
}
607605

608606
public class BrightnessController : IDisposable

update/Brightness Controller.exe

1.5 KB
Binary file not shown.

update/Brightness Controller.zip

139 Bytes
Binary file not shown.

update/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.0.3
1+
2.0.0.4

0 commit comments

Comments
 (0)