@@ -64,7 +64,7 @@ public RushInterface() {
6464 if ( Paths . IsDirectoryEmpty ( Program . Patches ) ) {
6565 Properties . Settings . Default . General_LastPatchUpdate = DateTime . Now . Ticks ;
6666 // Update patches synchronously
67- Task . Run ( ( ) => UpdatePatches ( ) ) . GetAwaiter ( ) . GetResult ( ) ;
67+ if ( Client . CheckNetworkConnection ( ) . Result ) Task . Run ( ( ) => UpdatePatches ( ) ) . GetAwaiter ( ) . GetResult ( ) ;
6868
6969 // Reset update button for future checking
7070 SectionButton_FetchPatches . Enabled = true ;
@@ -449,25 +449,31 @@ private async void CheckForUpdates(string versionURI, string changelogsURI) {
449449 SectionButton_CheckForSoftwareUpdates . Enabled = false ;
450450
451451 try {
452- string latestVersion = await Client . RequestString ( versionURI ) , // Request version number
453- changelogs = await Client . RequestString ( changelogsURI ) ;
454-
455- // New update available!
456- if ( Program . VersionNumber != latestVersion && latestVersion . StartsWith ( "Version" ) )
457- if ( InvokeRequired )
458- Invoke ( new MethodInvoker ( delegate { OnCheckForUpdates ( latestVersion , changelogs ) ; } ) ) ;
459- else
460- OnCheckForUpdates ( latestVersion , changelogs ) ;
452+ if ( Client . CheckNetworkConnection ( ) . Result ) {
453+ string latestVersion = await Client . RequestString ( versionURI ) , // Request version number
454+ changelogs = await Client . RequestString ( changelogsURI ) ; // Request changelogs
455+
456+ // New update available!
457+ if ( Program . VersionNumber != latestVersion && latestVersion . StartsWith ( "Version" ) )
458+ if ( InvokeRequired )
459+ Invoke ( new MethodInvoker ( delegate { OnCheckForUpdates ( latestVersion , changelogs ) ; } ) ) ;
460+ else
461+ OnCheckForUpdates ( latestVersion , changelogs ) ;
461462
462- // String was downloaded, but invalid
463- else if ( ! latestVersion . StartsWith ( "Version" ) )
464- throw new WebException ( ) ;
463+ // String was downloaded, but invalid
464+ else if ( ! latestVersion . StartsWith ( "Version" ) )
465+ throw new WebException ( "Invalid version number - server might be down..." ) ;
466+ } else
467+ throw new WebException ( "Could not establish a connection..." ) ;
465468 } catch {
466469 try {
467470 // Check for updates via SEGA Carnival
468- CheckForUpdates ( Properties . Resources . VersionURI_SEGACarnival , Properties . Resources . ChangelogsURI_SEGACarnival ) ;
469- Properties . Settings . Default . General_LastSoftwareUpdate = DateTime . Now . Ticks ;
470- _useBackupServer = true ;
471+ if ( Client . CheckNetworkConnection ( ) . Result ) {
472+ CheckForUpdates ( Properties . Resources . VersionURI_SEGACarnival , Properties . Resources . ChangelogsURI_SEGACarnival ) ;
473+ Properties . Settings . Default . General_LastSoftwareUpdate = DateTime . Now . Ticks ;
474+ _useBackupServer = true ;
475+ } else
476+ throw new WebException ( "Could not establish a connection..." ) ;
471477 } catch ( Exception ex ) {
472478 Label_UpdaterStatus . Text = "Connection error" ;
473479 PictureBox_UpdaterIcon . BackgroundImage = Properties . Resources . Exception_Logo ;
0 commit comments