@@ -1040,132 +1040,153 @@ private void UpdateTheme()
10401040 // If "bInvalidate" is set to true it forces the application to retrieve all local and remote information.
10411041 private async Task < bool > CheckForUpdates ( bool bInvalidate , bool bShowPrompt )
10421042 {
1043- if ( ! Configuration . OfflineMode . GetBoolValue ( ) || bInvalidate )
1043+ if ( ! Updator . IsUpdating ( ) )
10441044 {
1045- Logger . Write ( "Checking for updates..." ) ;
1046- UpdateStatusCtrl . DisplayType = StatusTypes . Version_Checking ;
1047- UpdateStatusCtrl . ViewType = StatusViews . One ;
1048-
1049- if ( await Retrievers . CheckInitialized ( ) )
1045+ if ( ! Configuration . OfflineMode . GetBoolValue ( ) || bInvalidate )
10501046 {
1051- bool moduleOutdated = await Updator . IsModuleOutdated ( bInvalidate ) ;
1052- bool launcherOutdated = await Updator . IsLauncherOutdated ( bInvalidate ) ;
1053-
1054- UInt32 localVersion = Storage . GetPsyonixDate ( ) ;
1055- UInt32 remoteVersion = await Retrievers . GetPsyonixDate ( ) ;
1056- bool ignoreModule = ( localVersion > remoteVersion ) ;
1047+ Logger . Write ( "Checking for updates..." ) ;
1048+ UpdateStatusCtrl . DisplayType = StatusTypes . Version_Checking ;
1049+ UpdateStatusCtrl . ViewType = StatusViews . One ;
10571050
1058- // If the installed Rocket League version is greater than the one retrieved remotely, an update for the module is not out yet.
1059-
1060- if ( ignoreModule && ! launcherOutdated )
1051+ if ( await Retrievers . CheckInitialized ( ) )
10611052 {
1062- Logger . Write ( "CodeRed is out of date, no new module version has been released yet!" ) ;
1063- Updator . OverrideStatus ( UpdatorStatus . Override ) ;
1064- UpdateStatusCtrl . DisplayType = StatusTypes . Version_Unsafe ;
1065- UpdateStatusCtrl . ViewType = StatusViews . Three ;
1053+ bool moduleOutdated = await Updator . IsModuleOutdated ( bInvalidate ) ;
1054+ bool launcherOutdated = await Updator . IsLauncherOutdated ( bInvalidate ) ;
1055+
1056+ UInt32 localVersion = Storage . GetPsyonixDate ( ) ;
1057+ UInt32 remoteVersion = await Retrievers . GetPsyonixDate ( ) ;
1058+ bool ignoreModule = ( localVersion > remoteVersion ) ;
10661059
1067- // Every sixty seconds this timer automatically checks for updates .
1060+ // If the installed Rocket League version is greater than the one retrieved remotely, an update for the module is not out yet .
10681061
1069- if ( ! UpdateTmr . Enabled )
1062+ if ( ignoreModule && ! launcherOutdated )
10701063 {
1071- UpdateTmr . Start ( ) ;
1072- }
1073- }
1074- else if ( Updator . IsOutdated ( ) )
1075- {
1076- UpdateTmr . Stop ( ) ;
1064+ Logger . Write ( "CodeRed is out of date, no new module version has been released yet!" ) ;
1065+ Updator . OverrideModule ( ) ;
1066+ UpdateStatusCtrl . DisplayType = StatusTypes . Version_Unsafe ;
1067+ UpdateStatusCtrl . ViewType = StatusViews . Three ;
10771068
1078- // Prioritize updating the module first, then the launcher .
1069+ // Every sixty seconds this timer automatically checks for updates .
10791070
1080- if ( ! ignoreModule && moduleOutdated && launcherOutdated )
1071+ if ( ! UpdateTmr . Enabled )
1072+ {
1073+ UpdateTmr . Start ( ) ;
1074+ }
1075+ }
1076+ else if ( Updator . IsOutdated ( ) )
10811077 {
1082- UpdateStatusCtrl . DisplayType = StatusTypes . Version_Both ;
1083- UpdateStatusCtrl . ViewType = StatusViews . Three ;
1078+ UpdateTmr . Stop ( ) ;
1079+
1080+ // Prioritize updating the module first, then the launcher.
10841081
1085- if ( LibraryManager . AnyProcessRunning ( ) )
1082+ if ( ! ignoreModule && moduleOutdated && launcherOutdated )
10861083 {
1087- List < Process > processes = ProcessManager . GetFilteredProcesses ( LibraryManager . Settings . ProcessName ) ;
1084+ UpdateStatusCtrl . DisplayType = StatusTypes . Version_Both ;
1085+ UpdateStatusCtrl . ViewType = StatusViews . Three ;
10881086
1089- if ( processes . Count > 0 && LibraryManager . IsModuleLoaded ( processes [ 0 ] , true ) )
1087+ if ( LibraryManager . AnyProcessRunning ( ) )
10901088 {
1091- UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Running ;
1089+ List < Process > processes = ProcessManager . GetFilteredProcesses ( LibraryManager . Settings . ProcessName ) ;
1090+
1091+ if ( processes . Count > 0 && LibraryManager . IsModuleLoaded ( processes [ 0 ] , true ) )
1092+ {
1093+ UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Running ;
1094+ }
1095+ else
1096+ {
1097+ UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Both ;
1098+ }
10921099 }
10931100 else
10941101 {
10951102 UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Both ;
10961103 }
1097- }
1098- else
1099- {
1100- UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Both ;
1101- }
11021104
1103- if ( bShowPrompt )
1104- {
1105- if ( Configuration . ShouldAutoInstall ( ) && ( UpdatePopup . UpdateType != CRUpdate . UpdateLayouts . Running ) )
1105+ if ( bShowPrompt )
11061106 {
1107- UpdatePopup_ButtonClickAccept ( null , null ) ;
1107+ if ( Configuration . ShouldAutoInstall ( ) && ( UpdatePopup . UpdateType != CRUpdate . UpdateLayouts . Running ) )
1108+ {
1109+ UpdatePopup_ButtonClickAccept ( null , null ) ;
1110+ }
1111+ else
1112+ {
1113+ UpdatePopup . ShowPopup ( ) ;
1114+ }
11081115 }
11091116 else
11101117 {
1111- UpdatePopup . ShowPopup ( ) ;
1118+ NewsCtrl . ParseArticles ( await Retrievers . GetNewsUrl ( ) ) ;
11121119 }
11131120 }
1114- else
1121+ else if ( ! ignoreModule && moduleOutdated )
11151122 {
1116- NewsCtrl . ParseArticles ( await Retrievers . GetNewsUrl ( ) ) ;
1117- }
1118- }
1119- else if ( ! ignoreModule && moduleOutdated )
1120- {
1121- UpdateStatusCtrl . DisplayType = StatusTypes . Version_Module ;
1122- UpdateStatusCtrl . ViewType = StatusViews . Three ;
1123+ UpdateStatusCtrl . DisplayType = StatusTypes . Version_Module ;
1124+ UpdateStatusCtrl . ViewType = StatusViews . Three ;
11231125
1124- if ( LibraryManager . AnyProcessRunning ( ) )
1125- {
1126- List < Process > processes = ProcessManager . GetFilteredProcesses ( LibraryManager . Settings . ProcessName ) ;
1127-
1128- if ( ( processes . Count > 0 ) && LibraryManager . IsModuleLoaded ( processes [ 0 ] , true ) )
1126+ if ( LibraryManager . AnyProcessRunning ( ) )
11291127 {
1130- Logger . Write ( "Process found!" ) ;
1131- UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Running ;
1128+ List < Process > processes = ProcessManager . GetFilteredProcesses ( LibraryManager . Settings . ProcessName ) ;
1129+
1130+ if ( ( processes . Count > 0 ) && LibraryManager . IsModuleLoaded ( processes [ 0 ] , true ) )
1131+ {
1132+ Logger . Write ( "Process found!" ) ;
1133+ UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Running ;
1134+ }
1135+ else
1136+ {
1137+ UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Module ;
1138+ }
11321139 }
11331140 else
11341141 {
11351142 UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Module ;
11361143 }
1137- }
1138- else
1139- {
1140- UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Module ;
1141- }
11421144
1143- if ( bShowPrompt )
1144- {
1145- if ( Configuration . ShouldAutoInstall ( ) && ( UpdatePopup . UpdateType != CRUpdate . UpdateLayouts . Running ) )
1145+ if ( bShowPrompt )
11461146 {
1147- UpdatePopup_ButtonClickAccept ( null , null ) ;
1147+ if ( Configuration . ShouldAutoInstall ( ) && ( UpdatePopup . UpdateType != CRUpdate . UpdateLayouts . Running ) )
1148+ {
1149+ UpdatePopup_ButtonClickAccept ( null , null ) ;
1150+ }
1151+ else
1152+ {
1153+ UpdatePopup . ShowPopup ( ) ;
1154+ }
11481155 }
11491156 else
11501157 {
1151- UpdatePopup . ShowPopup ( ) ;
1158+ NewsCtrl . ParseArticles ( await Retrievers . GetNewsUrl ( ) ) ;
11521159 }
11531160 }
1154- else
1161+ else if ( launcherOutdated )
11551162 {
1156- NewsCtrl . ParseArticles ( await Retrievers . GetNewsUrl ( ) ) ;
1157- }
1158- }
1159- else if ( launcherOutdated )
1160- {
1161- UpdateStatusCtrl . DisplayType = StatusTypes . Version_Launcher ;
1162- UpdateStatusCtrl . ViewType = StatusViews . Three ;
1163+ UpdateStatusCtrl . DisplayType = StatusTypes . Version_Launcher ;
1164+ UpdateStatusCtrl . ViewType = StatusViews . Three ;
1165+
1166+ // Doesn't matter if Rocket League is open or not when updating the launcher, so no need to check if any processes are running.
11631167
1164- // Doesn't matter if Rocket League is open or not when updating the launcher, so no need to check if any processes are running.
1168+ if ( bShowPrompt )
1169+ {
1170+ UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Launcher ;
11651171
1166- if ( bShowPrompt )
1172+ if ( Configuration . ShouldAutoInstall ( ) )
1173+ {
1174+ UpdatePopup_ButtonClickAccept ( null , null ) ;
1175+ }
1176+ else
1177+ {
1178+ UpdatePopup . ShowPopup ( ) ;
1179+ }
1180+ }
1181+ else
1182+ {
1183+ NewsCtrl . ParseArticles ( await Retrievers . GetNewsUrl ( ) ) ;
1184+ }
1185+ }
1186+ else
11671187 {
1168- UpdatePopup . UpdateType = CRUpdate . UpdateLayouts . Launcher ;
1188+ UpdateStatusCtrl . DisplayType = StatusTypes . Version_Safe ;
1189+ UpdateStatusCtrl . ViewType = StatusViews . Two ;
11691190
11701191 if ( Configuration . ShouldAutoInstall ( ) )
11711192 {
@@ -1175,40 +1196,23 @@ private async Task<bool> CheckForUpdates(bool bInvalidate, bool bShowPrompt)
11751196 {
11761197 UpdatePopup . ShowPopup ( ) ;
11771198 }
1178- }
1179- else
1180- {
1181- NewsCtrl . ParseArticles ( await Retrievers . GetNewsUrl ( ) ) ;
1199+
1200+ ProcessTmr . Start ( ) ;
11821201 }
11831202 }
11841203 else
11851204 {
1186- UpdateStatusCtrl . DisplayType = StatusTypes . Version_Safe ;
1205+ Logger . Write ( "No updates found!" ) ;
11871206 UpdateStatusCtrl . ViewType = StatusViews . Two ;
1188-
1189- if ( Configuration . ShouldAutoInstall ( ) )
1190- {
1191- UpdatePopup_ButtonClickAccept ( null , null ) ;
1192- }
1193- else
1194- {
1195- UpdatePopup . ShowPopup ( ) ;
1196- }
1197-
1198- ProcessTmr . Start ( ) ;
1207+ UpdateStatusCtrl . DisplayType = StatusTypes . Version_Safe ;
1208+ NewsCtrl . ParseArticles ( await Retrievers . GetNewsUrl ( ) ) ;
11991209 }
12001210 }
1201- else
1202- {
1203- Logger . Write ( "No updates found!" ) ;
1204- UpdateStatusCtrl . ViewType = StatusViews . Two ;
1205- UpdateStatusCtrl . DisplayType = StatusTypes . Version_Safe ;
1206- }
12071211 }
1208- }
1209- else
1210- {
1211- Logger . Write ( "Could not check for updates, launcher is running in offline mode!" ) ;
1212+ else
1213+ {
1214+ Logger . Write ( "Could not check for updates, launcher is running in offline mode!" ) ;
1215+ }
12121216 }
12131217
12141218 RetrieversToInterface ( ) ;
@@ -1311,6 +1315,8 @@ private async void UpdatePopup_ButtonClickAccept(object sender, EventArgs e)
13111315 {
13121316 Logger . Write ( report . FailReason , LogLevel . LEVEL_ERROR ) ;
13131317 }
1318+
1319+ NewsCtrl . ParseArticles ( await Retrievers . GetNewsUrl ( ) ) ;
13141320 }
13151321
13161322 private async void UpdatePopup_ButtonClickDeny ( object sender , EventArgs e )
0 commit comments