-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Game finders overhaul #2053
Game finders overhaul #2053
Conversation
NitroxModel/Discovery/InstallationFinders/SteamGameRegistryFinder.cs
Outdated
Show resolved
Hide resolved
a709177
to
b67610b
Compare
NitroxModel/Discovery/InstallationFinders/EnvironmentGameFinder.cs
Outdated
Show resolved
Hide resolved
NitroxModel/Discovery/InstallationFinders/EpicGamesInstallationFinder.cs
Outdated
Show resolved
Hide resolved
NitroxModel/Discovery/InstallationFinders/EpicGamesInstallationFinder.cs
Outdated
Show resolved
Hide resolved
b67610b
to
44a6d95
Compare
82e50ce
to
174c608
Compare
Still need to untangle NitroxUser around game path managing, but it's getting there |
174c608
to
b6ffee2
Compare
NitroxModel/Discovery/InstallationFinders/EpicGamesInstallationFinder.cs
Show resolved
Hide resolved
using NitroxModel.Discovery.Models; | ||
using System; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong sorting
NitroxModel/Discovery/InstallationFinders/EpicGamesInstallationFinder.cs
Show resolved
Hide resolved
Log.Error(e.Exception.GetBaseException().ToString()); // Gets the exception that was unhandled, not the "dispatched unhandled" exception. | ||
MessageBox.Show(GetExceptionError(e.Exception), "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly); | ||
} | ||
MessageBox.Show(GetExceptionError(e.Exception), "Unexpected error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would keep the comment:
// Gets the exception that was unhandled, not the "dispatched unhandled" exception.
as .GetBaseException()
is usually a bad thing to do (except for niche case here)
|
||
using (StreamReader sr = new(response.GetResponseStream())) | ||
using (StreamReader sr = new(response.GetResponseStream())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using (StreamReader sr = new(response.GetResponseStream())) | |
using (StreamReader sr = new(response.GetResponseStream() ?? Stream.Null)) |
using (StreamReader sr = new(response.GetResponseStream())) | ||
using (StreamReader sr = new(response.GetResponseStream())) | ||
{ | ||
string json = sr.ReadToEnd(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string json = sr.ReadToEnd(); | |
string json = await sr.ReadToEndAsync(); |
{ | ||
Log.Info("Fetched nitrox changelogs from the local cache"); | ||
} | ||
public async static Task<IList<NitroxChangelog>> GetChangeLogsAsync(CancellationToken cancellationToken = default) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public async static Task<IList<NitroxChangelog>> GetChangeLogsAsync(CancellationToken cancellationToken = default) | |
public static async Task<IList<NitroxChangelog>> GetChangeLogsAsync(CancellationToken cancellationToken = default) |
using WebResponse response = await GetResponseFromCache(BLOGS_URL); | ||
try | ||
{ | ||
using WebResponse response = await GetResponseFromCacheAsync(BLOGS_URL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using WebResponse response = await GetResponseFromCacheAsync(BLOGS_URL); | |
using WebResponse response = await GetResponseFromCacheAsync(BLOGS_URL, cancellationToken); |
IsFolderPicker = true, | ||
Title = "Select Subnautica installation directory" | ||
}) | ||
GameInstallation currentInstallation = GameInstallations.Where(x => x.Path == NitroxUser.PreferredGamePath).FirstOrDefault(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GameInstallation currentInstallation = GameInstallations.Where(x => x.Path == NitroxUser.PreferredGamePath).FirstOrDefault(); | |
GameInstallation currentInstallation = GameInstallations.FirstOrDefault(x => x.Path == NitroxUser.PreferredGamePath); |
[Description("Pirated")] | ||
PIRATED = 255 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum is int
by default.
This enum is supposed to contain real game stores. I recommend just removing the "Pirated" flag, and infer it from the detection trigger instead.
Got an error trying to delete server save files via launcher:
|
Nitrox has always defined an order in the way it searches the Subnautica installation files. This works in most cases, since users generally have only one installation of the game. However, this approach raises questions when a user has the game on both Steam & Epic.
The aim of this PR is to do away with this automatic way of doing things, by providing an API that lets you search for one or more installations of a given game (GameInfo) via flags (GameLibraries).
i.e:
That will allow the launcher to display all the path, and let the user choose between them. Rather than imposing it.
Progression
Below zero will follow up in another Pull Request