fixed some bugs, added ability to work without internet

This commit is contained in:
2025-05-21 13:50:10 +05:00
parent ab1aefd619
commit e915892fa2
7 changed files with 79 additions and 46 deletions

View File

@@ -29,7 +29,6 @@ public class InstalledVersionCatalog
}
catalog.CheckInstalledVersions();
catalog.Save();
return catalog;
}
@@ -44,6 +43,7 @@ public class InstalledVersionCatalog
/// <summary>
/// Check if any versions were installed or deleted manually.
/// Calls <see cref="Save"/>
/// </summary>
public void CheckInstalledVersions()
{
@@ -53,17 +53,16 @@ public class InstalledVersionCatalog
{
string id = subdir.LastName().ToString();
if (!File.Exists(PathHelper.GetVersionDescriptorPath(id)))
throw new Exception(
$"Can't find version descriptor file in directory '{subdir}'. Rename it as directory name.");
{
LauncherApp.Logger.LogWarn(nameof(CheckInstalledVersions),
$"Can't find version descriptor file in directory '{subdir}'. " +
$"Rename it as directory name.");
continue;
}
if (versions.TryGetValue(id, out var foundProps))
{
versionsUpdated.Add(foundProps);
}
else
{
versionsUpdated.Add(new InstalledGameVersionProps(id, null, null));
}
else versionsUpdated.Add(new InstalledGameVersionProps(id, null, null));
}
// reverse sort
@@ -73,5 +72,7 @@ public class InstalledVersionCatalog
versionsUpdated.Select(props =>
new KeyValuePair<string, InstalledGameVersionProps>(props.Id, props)
));
Save();
}
}