Skip to content

Commit 44c6495

Browse files
committed
v1.0.3
1 parent 68cc33d commit 44c6495

6 files changed

Lines changed: 151 additions & 95 deletions

File tree

Architecture/Path.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@ public string GetPath()
3838

3939
public string GetFolderPath()
4040
{
41-
if (IsFile())
42-
{
43-
return System.IO.Path.GetDirectoryName(IndirectPath);
44-
}
45-
46-
return IndirectPath;
41+
return System.IO.Path.GetDirectoryName(IndirectPath);
4742
}
4843

4944
public bool IsFile()

Forms/MainFrm.cs

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -627,56 +627,70 @@ private async void StartupRoutine(bool bInvalidate = false)
627627
Retrievers.Invalidate();
628628
}
629629

630-
Logger.CheckInitialized(); // Create and initialize the log file for the launcher.
631-
632-
if (Configuration.CheckInitialized())
630+
if (!Storage.GetModulePath().Exists())
633631
{
634-
if (Configuration.ShouldMinimizeOnStartup())
635-
{
636-
TitleBar_OnMinimized(null, null);
637-
}
638-
639632
if (await Retrievers.CheckInitialized())
640633
{
641-
string pingUrl = await Retrievers.GetModuleUrl();
642-
643-
if ((await Downloaders.WebsiteOnline(pingUrl)) == false)
644-
{
645-
OfflinePopupCtrl.Show();
646-
}
647-
else
648-
{
649-
ContinueStartup();
650-
}
634+
InstallPopupCtrl.Show();
651635
}
652636
else
653637
{
654-
OfflinePopupCtrl.Show();
638+
InstallOfflinePopupCtrl.Show();
655639
}
656-
657-
NewsCtrl.ParseArticles(await Retrievers.GetNewsUrl());
658640
}
659641
else
660642
{
661-
if (!Storage.GetModulePath().Exists())
643+
Logger.CheckInitialized(); // Create and initialize the log file for the launcher.
644+
645+
if (Configuration.CheckInitialized())
662646
{
647+
if (Configuration.ShouldMinimizeOnStartup())
648+
{
649+
TitleBar_OnMinimized(null, null);
650+
}
651+
663652
if (await Retrievers.CheckInitialized())
664653
{
665-
InstallPopupCtrl.Show();
654+
string pingUrl = await Retrievers.GetModuleUrl();
655+
656+
if ((await Downloaders.WebsiteOnline(pingUrl)) == false)
657+
{
658+
OfflinePopupCtrl.Show();
659+
}
660+
else
661+
{
662+
ContinueStartup();
663+
}
666664
}
667665
else
668666
{
669-
InstallOfflinePopupCtrl.Show();
667+
OfflinePopupCtrl.Show();
670668
}
671-
}
672-
else if (!Storage.GetLibraryFile().Exists())
673-
{
674-
await Installer.DownloadModule();
675-
StartupRoutine(true);
669+
670+
NewsCtrl.ParseArticles(await Retrievers.GetNewsUrl());
676671
}
677672
else
678673
{
679-
ContinueStartup();
674+
if (!Storage.GetModulePath().Exists())
675+
{
676+
if (await Retrievers.CheckInitialized())
677+
{
678+
InstallPopupCtrl.Show();
679+
}
680+
else
681+
{
682+
InstallOfflinePopupCtrl.Show();
683+
}
684+
}
685+
else if (!Storage.GetLibraryFile().Exists())
686+
{
687+
await Installer.DownloadModule();
688+
StartupRoutine(true);
689+
}
690+
else
691+
{
692+
ContinueStartup();
693+
}
680694
}
681695
}
682696

Framework/Assembly.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static class Assembly
1111
private static readonly string Product = "CodeRedLauncher";
1212
private static readonly string Copyright = "Copyright © CodeRedModding 2022";
1313
private static readonly string License = "MIT License";
14-
private static readonly string Version = "1.0.0";
14+
private static readonly string Version = "1.0.3";
1515

1616
public static string GetTitle() { return Title; }
1717
public static string GetDescription() { return Description; }

Framework/Storage.cs

Lines changed: 91 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,12 @@ private static void ParseLogFile()
113113

114114
if (baseDirectory.Contains("steamapps"))
115115
{
116+
SteamFolder.SetValue(baseDirectory);
116117
CurrentPlatform.SetValue(PlatformTypes.TYPE_STEAM.ToString());
117118
}
118119
else if (baseDirectory.Contains("Epic Games"))
119120
{
121+
EpicFolder.SetValue(baseDirectory);
120122
CurrentPlatform.SetValue(PlatformTypes.TYPE_EPIC.ToString());
121123
}
122124
else
@@ -171,6 +173,7 @@ private static void ParseVersionFile()
171173
private static bool ParseRegistryKeys()
172174
{
173175
bool foundAtLeastOnePath = false;
176+
bool foundInstallDir = false;
174177
RegistryKey coderedKey = Registry.CurrentUser.OpenSubKey("CodeRedModding");
175178

176179
if (coderedKey != null)
@@ -185,77 +188,111 @@ private static bool ParseRegistryKeys()
185188
{
186189
ModuleFolder.SetValue(moduleFolder);
187190
LibraryFile.SetValue(moduleFolder / "DLL" / "CodeRed.dll");
191+
foundInstallDir = true;
188192
}
189193
}
190194

191195
coderedKey.Close();
192196
}
193197

194-
RegistryKey epicKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\WOW6432Node\\EpicGames\\Unreal Engine");
195-
196-
if (epicKey != null)
198+
if (SteamFolder.IsNull())
197199
{
198-
Object epicObj = epicKey.GetValue("INSTALLDIR");
199-
200-
if (epicObj != null)
200+
try
201201
{
202-
Architecture.Path epicFolder = (new Architecture.Path(epicObj.ToString()) / "rocketleague" / "Binaries" / "Win64");
202+
RegistryKey steamKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\WOW6432Node\\Valve\\Steam");
203203

204-
if (epicFolder.Exists())
205-
{
206-
EpicFolder.SetValue(epicFolder);
207-
foundAtLeastOnePath = true;
208-
}
209-
else
204+
if (steamKey != null)
210205
{
211-
EpicFolder.SetValue("");
206+
Object steamObj = steamKey.GetValue("InstallPath");
207+
208+
if (steamObj != null)
209+
{
210+
// We are phrasing the "libraryfolders.vdf" file here because it's possibe to have Steam installed on one drive, but have the "steamapps" folder on a different drive/location.
211+
// This is not stored in the registry and this file is the only place that I could find where it has path/drive info like this.
212+
// If anyone has a better solution or suggestion please do create an issue in the repo, or submit your own pull request.
213+
214+
Architecture.Path libraryFile = new Architecture.Path(steamObj.ToString()).Append("steamapps").Append("libraryfolders.vdf");
215+
216+
if (libraryFile.Exists())
217+
{
218+
string libraryContents = File.ReadAllText(libraryFile.GetPath());
219+
MatchCollection pathMatches = Regex.Matches(libraryContents, "\"path\"\t\t\"(.*)\"", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
220+
221+
foreach (Match match in pathMatches)
222+
{
223+
if (match.Success && match.Groups[1].Success)
224+
{
225+
Architecture.Path steamFolder = (new Architecture.Path(match.Groups[1].Value) / "steamapps" / "common" / "rocketleague" / "Binaries" / "Win64");
226+
227+
if (steamFolder.Exists())
228+
{
229+
SteamFolder.SetValue(steamFolder);
230+
foundAtLeastOnePath = true;
231+
break;
232+
}
233+
else
234+
{
235+
SteamFolder.SetValue("");
236+
continue;
237+
}
238+
}
239+
}
240+
}
241+
}
212242
}
213243
}
214-
}
215-
216-
RegistryKey steamKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\WOW6432Node\\Valve\\Steam");
244+
catch (Exception ex)
245+
{
217246

218-
if (steamKey != null)
247+
}
248+
}
249+
else
219250
{
220-
Object steamObj = steamKey.GetValue("InstallPath");
251+
foundAtLeastOnePath = true;
252+
}
221253

222-
if (steamObj != null)
254+
if (EpicFolder.IsNull())
255+
{
256+
try
223257
{
224-
// We are phrasing the "libraryfolders.vdf" file here because it's possibe to have Steam installed on one drive, but have the "steamapps" folder on a different drive/location.
225-
// This is not stored in the registry and this file is the only place that I could find where it has path/drive info like this.
226-
// If anyone has a better solution or suggestion please do create an issue in the repo, or submit your own pull request.
227-
228-
Architecture.Path libraryFile = new Architecture.Path(steamObj.ToString()).Append("steamapps").Append("libraryfolders.vdf");
258+
RegistryKey epicKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\WOW6432Node\\EpicGames\\Unreal Engine");
229259

230-
if (libraryFile.Exists())
260+
if (epicKey != null)
231261
{
232-
string libraryContents = File.ReadAllText(libraryFile.GetPath());
233-
MatchCollection pathMatches = Regex.Matches(libraryContents, "\"path\"\t\t\"(.*)\"", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
262+
Object epicObj = epicKey.GetValue("INSTALLDIR");
234263

235-
foreach (Match match in pathMatches)
264+
if (epicObj != null)
236265
{
237-
if (match.Success && match.Groups[1].Success)
238-
{
239-
Architecture.Path steamFolder = (new Architecture.Path(match.Groups[1].Value) / "steamapps" / "common" / "rocketleague" / "Binaries" / "Win64");
266+
Architecture.Path epicFolder = (new Architecture.Path(epicObj.ToString()) / "rocketleague" / "Binaries" / "Win64");
240267

241-
if (steamFolder.Exists())
242-
{
243-
SteamFolder.SetValue(steamFolder);
244-
foundAtLeastOnePath = true;
245-
break;
246-
}
247-
else
248-
{
249-
SteamFolder.SetValue("");
250-
continue;
251-
}
268+
if (epicFolder.Exists())
269+
{
270+
EpicFolder.SetValue(epicFolder);
271+
foundAtLeastOnePath = true;
272+
}
273+
else
274+
{
275+
EpicFolder.SetValue("");
252276
}
253277
}
254278
}
255279
}
280+
catch (Exception ex)
281+
{
282+
283+
}
284+
}
285+
else
286+
{
287+
foundAtLeastOnePath = true;
288+
}
289+
290+
if (!foundInstallDir && !foundAtLeastOnePath)
291+
{
292+
return false;
256293
}
257294

258-
return foundAtLeastOnePath;
295+
return foundInstallDir;
259296
}
260297

261298
public static bool FindDirectories()
@@ -270,13 +307,20 @@ public static bool FindDirectories()
270307
ParseLogFile();
271308
ParseVersionFile();
272309

273-
if (ParseRegistryKeys())
310+
if (!ParseRegistryKeys())
274311
{
275-
Initialized = true;
312+
if (!ModuleFolder.IsNull())
313+
{
314+
MessageBox.Show("Error: Failed to locate the needed registry keys!", Assembly.GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Error);
315+
}
316+
else
317+
{
318+
Initialized = true;
319+
}
276320
}
277321
else
278322
{
279-
MessageBox.Show("Error: Failed to locate the needed registry keys!", Assembly.GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Error);
323+
Initialized = true;
280324
}
281325
}
282326
else

Framework/Updator.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,26 +122,29 @@ private static async Task<Result> InstallModule(bool bForceInstall)
122122
{
123123
Architecture.Path fullPath = (modulePath / archiveEntry.FullName);
124124

125-
if ( !fullPath.IsFile())
125+
if (!Directory.Exists(fullPath.GetFolderPath()))
126126
{
127-
if (!fullPath.Exists())
128-
{
129-
Directory.CreateDirectory(fullPath.GetFolderPath());
130-
}
127+
Directory.CreateDirectory(fullPath.GetFolderPath());
128+
}
131129

130+
if (!fullPath.IsFile())
131+
{
132132
continue;
133133
}
134134

135135
string fileFilter = fullPath.GetPath().ToLower();
136136
bool shouldSkip = false;
137137

138-
// Skip overriding existing files that may be user-specific, such as settings or scripts.
139-
foreach (string file in ExcludedFiles)
138+
if (!bForceInstall)
140139
{
141-
if (fileFilter.EndsWith(file))
140+
// Skip overriding existing files that may be user-specific, such as settings or scripts.
141+
foreach (string file in ExcludedFiles)
142142
{
143-
shouldSkip = true;
144-
break;
143+
if (fileFilter.EndsWith(file))
144+
{
145+
shouldSkip = true;
146+
break;
147+
}
145148
}
146149
}
147150

Properties/PublishProfiles/FolderProfile.pubxml.user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
44
-->
55
<Project>
66
<PropertyGroup>
7-
<History>True|2022-12-22T23:02:42.2130135Z;</History>
7+
<History>True|2022-12-23T01:46:31.3667454Z;True|2022-12-22T20:36:59.8978942-05:00;True|2022-12-22T20:32:40.9627042-05:00;True|2022-12-22T20:27:45.7845417-05:00;True|2022-12-22T20:08:26.4442830-05:00;True|2022-12-22T20:07:06.2254198-05:00;True|2022-12-22T20:01:04.3986967-05:00;True|2022-12-22T19:57:34.6741553-05:00;True|2022-12-22T19:46:09.3566048-05:00;True|2022-12-22T19:45:03.2884935-05:00;True|2022-12-22T19:36:42.2434776-05:00;True|2022-12-22T19:31:21.4738973-05:00;True|2022-12-22T19:27:34.9406205-05:00;False|2022-12-22T19:27:27.7152676-05:00;True|2022-12-22T19:14:05.9421852-05:00;True|2022-12-22T18:02:42.2130135-05:00;</History>
88
<LastFailureDetails />
99
</PropertyGroup>
1010
</Project>

0 commit comments

Comments
 (0)