Lots of small launcher fixes

This commit is contained in:
Halgari 2022-10-01 07:02:47 -06:00
parent 84b46f36c5
commit ea9cd20c67
6 changed files with 22 additions and 4 deletions

View File

@ -10,6 +10,8 @@
* Errors when downloading modlists no longer cause the app to crash
* Only parse and edit screen sizes in INI files when installing MO2 lists
* Update the build to show source code names/numbers in exceptions in the logs
* Move logs back into the same folder as the launcher
* Update the launcher to once again load new versions from the Nexus when possible
#### Version - 3.0.1.7 - 9/27/2022
* HOTFIX: fix "Could not find part of path" bug related to the profiles folder

View File

@ -14,6 +14,7 @@ using Wabbajack.DTOs.Interventions;
using Wabbajack.Interventions;
using Wabbajack.LoginManagers;
using Wabbajack.Models;
using Wabbajack.Paths.IO;
using Wabbajack.Services.OSIntegrated;
using Wabbajack.UserIntervention;
using Wabbajack.Util;
@ -49,10 +50,11 @@ namespace Wabbajack
{
var config = new NLog.Config.LoggingConfiguration();
var logFolder = KnownFolders.LauncherAwarePath;
var fileTarget = new FileTarget("file")
{
FileName = "logs/Wabbajack.current.log",
ArchiveFileName = "logs/Wabbajack.{##}.log",
FileName = logFolder.Combine("Wabbajack.current.log").ToString(),
ArchiveFileName = logFolder.Combine("Wabbajack.{##}.log").ToString(),
ArchiveOldFileOnStartup = true,
MaxArchiveFiles = 10,
Layout = "${processtime} [${level:uppercase=true}] (${logger}) ${message:withexception=true}",

View File

@ -17,6 +17,7 @@ using Wabbajack.Networking.Http.Interfaces;
using Wabbajack.Networking.NexusApi;
using Wabbajack.Paths;
using Wabbajack.RateLimiter;
using Wabbajack.Services.OSIntegrated.TokenProviders;
namespace Wabbajack.Launcher;
@ -37,7 +38,7 @@ internal class Program
services.AddDTOSerializer();
services.AddSingleton<MainWindowViewModel>();
services.AddSingleton<HttpClient>();
services.AddSingleton<ITokenProvider<NexusApiState>, LegacyNexusApiKey>();
services.AddSingleton<ITokenProvider<NexusApiState>, NexusApiTokenProvider>();
services.AddSingleton<HttpDownloader>();
services.AddAllSingleton<IResource, IResource<HttpClient>>(s => new Resource<HttpClient>("Web Requests", 4));
services.AddAllSingleton<IHttpDownloader, SingleThreadedDownloader>();

View File

@ -321,7 +321,7 @@ public class MainWindowViewModel : ViewModelBase
Status = "Parsing Response";
//return JsonSerializer.Deserialize<Release[]>(data)!;
var found = data.info.Files.Where(f => f.CategoryId == 5)
var found = data.info.Files.Where(f => f.CategoryId == 5 || f.CategoryId == 3)
.Where(f => f.Name.EndsWith(".zip"))
.Select(f => Version.TryParse(f.Name[..^4], out var version) ? (version, f.SizeInBytes ?? f.Size, f.FileId) : default)
.FirstOrDefault(f => f != default);

View File

@ -31,5 +31,6 @@
<ProjectReference Include="..\Wabbajack.Downloaders.Nexus\Wabbajack.Downloaders.Nexus.csproj" />
<ProjectReference Include="..\Wabbajack.Paths.IO\Wabbajack.Paths.IO.csproj" />
<ProjectReference Include="..\Wabbajack.Paths\Wabbajack.Paths.csproj" />
<ProjectReference Include="..\Wabbajack.Services.OSIntegrated\Wabbajack.Services.OSIntegrated.csproj" />
</ItemGroup>
</Project>

View File

@ -31,6 +31,18 @@ public static class KnownFolders
}
}
public static AbsolutePath LauncherAwarePath
{
get
{
var path = EntryPoint;
if (path.Depth <= 2) return path;
if (Version.TryParse(path.Parent.FileName.ToString(), out var version) && version > new Version("1.0.0.0"))
return path.Parent;
return path;
}
}
public static AbsolutePath AppDataLocal =>
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).ToAbsolutePath();