@@ -565,9 +565,7 @@ private void RestartProgram(string location)
565
565
566
566
private async void Updater ( )
567
567
{
568
- await Task . Delay ( 1 ) ;
569
- string NewExeLocations = AppDomain . CurrentDomain . BaseDirectory + "Brightness Controller.exe" ;
570
- MessageBox . Show ( NewExeLocations ) ;
568
+ await Task . Delay ( 60000 ) ;
571
569
try
572
570
{
573
571
using ( WebClient client = new WebClient ( ) )
@@ -577,24 +575,23 @@ private async void Updater()
577
575
if ( CheckVersion . Contains ( "." ) & Application . ProductVersion != CheckVersion )
578
576
{
579
577
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";
581
579
try
582
580
{
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" ) )
586
583
{
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 ) ;
591
588
}
592
589
}
593
590
catch ( Exception )
594
591
{
595
592
try
596
593
{
597
- File . Delete ( ExeLocation + ".new" ) ;
594
+ File . Delete ( NewExeLocation + ".new" ) ;
598
595
}
599
596
catch ( Exception ) { }
600
597
}
@@ -603,6 +600,7 @@ private async void Updater()
603
600
}
604
601
catch ( Exception ) { }
605
602
}
603
+
606
604
}
607
605
608
606
public class BrightnessController : IDisposable
0 commit comments