mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Several more fixes
This commit is contained in:
parent
c3d1815e3c
commit
4031faf6e0
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib;
|
||||
using Wabbajack.Compiler;
|
||||
using Wabbajack.DTOs;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
|
@ -10,12 +10,18 @@ using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using DynamicData;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Compiler;
|
||||
using Wabbajack.DTOs;
|
||||
using Wabbajack.DTOs.GitHub;
|
||||
using Wabbajack.Lib;
|
||||
using Wabbajack.Lib.AuthorApi;
|
||||
using Wabbajack.Lib.Extensions;
|
||||
using Wabbajack.Lib.FileUploader;
|
||||
using Wabbajack.Lib.GitHub;
|
||||
using Wabbajack.Paths;
|
||||
using Wabbajack.Paths.IO;
|
||||
using WebSocketSharp;
|
||||
using Consts = Wabbajack.Lib.Consts;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
@ -112,7 +118,7 @@ namespace Wabbajack
|
||||
ModListLocation.AdditionalError = this.WhenAny(x => x.Mo2Folder)
|
||||
.Select<AbsolutePath, IErrorResponse>(moFolder =>
|
||||
{
|
||||
if (moFolder.IsDirectory) return ErrorResponse.Success;
|
||||
if (moFolder.DirectoryExists()) return ErrorResponse.Success;
|
||||
return ErrorResponse.Fail($"MO2 folder could not be located from the given ModList location.{Environment.NewLine}Make sure your ModList is inside a valid MO2 distribution.");
|
||||
});
|
||||
|
||||
@ -167,7 +173,7 @@ namespace Wabbajack
|
||||
// If Mo2 folder changes and download location is empty, set it for convenience
|
||||
this.WhenAny(x => x.Mo2Folder)
|
||||
.DelayInitial(TimeSpan.FromMilliseconds(100), RxApp.MainThreadScheduler)
|
||||
.Where(x => x.IsDirectory)
|
||||
.Where(x => x.DirectoryExists())
|
||||
.FlowSwitch(
|
||||
(this).WhenAny(x => x.DownloadLocation.Exists)
|
||||
.Invert())
|
||||
@ -197,11 +203,11 @@ namespace Wabbajack
|
||||
|
||||
if (Parent.OutputLocation.TargetPath == default)
|
||||
{
|
||||
outputFile = (profileName + Consts.ModListExtension).RelativeTo(AbsolutePath.EntryPoint);
|
||||
outputFile = (profileName.ToRelativePath().WithExtension(Ext.Wabbajack)).RelativeTo(KnownFolders.EntryPoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
outputFile = Parent.OutputLocation.TargetPath.Combine(profileName + Consts.ModListExtension);
|
||||
outputFile = Parent.OutputLocation.TargetPath.Combine(profileName).WithExtension(Ext.Wabbajack);
|
||||
}
|
||||
|
||||
try
|
||||
@ -216,7 +222,7 @@ namespace Wabbajack
|
||||
Version = ModlistSettings.Version,
|
||||
};
|
||||
}
|
||||
|
||||
/* TODO
|
||||
if (ModListLocation.TargetPath.FileName == Consts.NativeSettingsJson)
|
||||
{
|
||||
var settings = ModListLocation.TargetPath.FromJson<NativeCompilerSettings>();
|
||||
@ -258,6 +264,8 @@ namespace Wabbajack
|
||||
var success = await ActiveCompilation.Begin();
|
||||
return GetResponse<ModList>.Create(success, ActiveCompilation.ModList);
|
||||
}
|
||||
*/
|
||||
return GetResponse<ModList>.Create(true, ActiveCompilation.ModList);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Installer;
|
||||
using Wabbajack.Lib;
|
||||
using Wabbajack.Lib.Interventions;
|
||||
|
||||
@ -13,7 +14,7 @@ namespace Wabbajack
|
||||
public interface ISubInstallerVM
|
||||
{
|
||||
InstallerVM Parent { get; }
|
||||
AInstaller ActiveInstallation { get; }
|
||||
IInstaller ActiveInstallation { get; }
|
||||
void Unload();
|
||||
bool SupportsAfterInstallNavigation { get; }
|
||||
void AfterInstallNavigation();
|
||||
|
@ -1,36 +1,33 @@
|
||||
using System;
|
||||
using ReactiveUI;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Windows.Media;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using System.Reactive;
|
||||
using System.Collections.Generic;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||
using Microsoft.WindowsAPICodePack.Shell;
|
||||
using Wabbajack.Common.IO;
|
||||
using Wabbajack.Installer;
|
||||
using Wabbajack.Lib.Extensions;
|
||||
using Wabbajack.Lib.Interventions;
|
||||
using Wabbajack.Paths;
|
||||
using Wabbajack.RateLimiter;
|
||||
using Wabbajack.View_Models;
|
||||
using Consts = Wabbajack.Lib.Consts;
|
||||
|
||||
namespace Wabbajack
|
||||
namespace Wabbajack;
|
||||
|
||||
enum ModManager
|
||||
{
|
||||
Standard
|
||||
}
|
||||
|
||||
public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
||||
{
|
||||
public SlideShow Slideshow { get; }
|
||||
@ -88,6 +85,7 @@ namespace Wabbajack
|
||||
public (int CurrentCPUs, int DesiredCPUs) CurrentCpuCount => _CurrentCpuCount.Value;
|
||||
|
||||
private readonly ObservableAsPropertyHelper<bool> _LoadingModlist;
|
||||
private readonly ILogger<InstallerVM> _logger;
|
||||
public bool LoadingModlist => _LoadingModlist.Value;
|
||||
|
||||
// Command properties
|
||||
@ -100,14 +98,16 @@ namespace Wabbajack
|
||||
public ReactiveCommand<Unit, Unit> GoToInstallCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> BeginCommand { get; }
|
||||
|
||||
public InstallerVM(MainWindowVM mainWindowVM) : base(mainWindowVM)
|
||||
public InstallerVM(ILogger<InstallerVM> logger, MainWindowVM mainWindowVM) : base(logger, mainWindowVM)
|
||||
{
|
||||
_logger = logger;
|
||||
var downloadsPath = KnownFolders.Downloads.Path;
|
||||
/* TODO
|
||||
var skyDrivePath = KnownFolders.SkyDrive.Path;
|
||||
|
||||
if (downloadsPath != null && AbsolutePath.EntryPoint.IsChildOf(new AbsolutePath(downloadsPath)))
|
||||
{
|
||||
Utils.Error(new CriticalFailureIntervention(
|
||||
logger.LogError(Error(new CriticalFailureIntervention(
|
||||
"Wabbajack is running inside your Downloads folder. This folder is often highly monitored by antivirus software and these can often " +
|
||||
"conflict with the operations Wabbajack needs to perform. Please move Wabbajack outside of your Downloads folder and then restart the app.",
|
||||
"Cannot run inside Downloads", true));
|
||||
@ -119,7 +119,7 @@ namespace Wabbajack
|
||||
$"Wabbajack is running inside a OneDrive folder \"{skyDrivePath}\". This folder is known to cause issues with Wabbajack. " +
|
||||
"Please move Wabbajack outside of your OneDrive folder and then restart the app.",
|
||||
"Cannot run inside OneDrive", true));
|
||||
}
|
||||
}*/
|
||||
|
||||
MWVM = mainWindowVM;
|
||||
|
||||
@ -139,7 +139,7 @@ namespace Wabbajack
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ModManager.MO2:
|
||||
case ModManager.Standard:
|
||||
return new MO2InstallerVM(this);
|
||||
default:
|
||||
return null;
|
||||
@ -187,7 +187,7 @@ namespace Wabbajack
|
||||
.Select(modListPath =>
|
||||
{
|
||||
if (modListPath == default) return default;
|
||||
if (!modListPath.Exists) return default;
|
||||
if (!modListPath.FileExists()) return default;
|
||||
return new ModListVM(modListPath);
|
||||
})
|
||||
.DisposeOld()
|
||||
@ -215,7 +215,7 @@ namespace Wabbajack
|
||||
.Select(i => i != null)
|
||||
.ToGuiProperty(this, nameof(Installing));
|
||||
_TargetManager = this.WhenAny(x => x.ModList)
|
||||
.Select(modList => modList?.ModManager)
|
||||
.Select(modList => ModManager.Standard)
|
||||
.ToGuiProperty(this, nameof(TargetManager));
|
||||
|
||||
// Add additional error check on ModList
|
||||
@ -244,7 +244,7 @@ namespace Wabbajack
|
||||
.ObserveOnGuiThread());
|
||||
|
||||
_percentCompleted = this.WhenAny(x => x.Installer.ActiveInstallation)
|
||||
.StartWith(default(AInstaller))
|
||||
.StartWith(default(IInstaller))
|
||||
.CombineLatest(
|
||||
this.WhenAny(x => x.Completed),
|
||||
(installer, completed) =>
|
||||
@ -325,7 +325,7 @@ namespace Wabbajack
|
||||
|
||||
ShowManifestCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
Utils.OpenWebsite(new Uri("https://www.wabbajack.org/#/modlists/manifest"));
|
||||
UIUtils.OpenWebsite(new Uri("https://www.wabbajack.org/#/modlists/manifest"));
|
||||
}, this.WhenAny(x => x.ModList)
|
||||
.Select(x => x?.SourceModList != null)
|
||||
.ObserveOnGuiThread());
|
||||
@ -337,11 +337,11 @@ namespace Wabbajack
|
||||
.ObserveOnGuiThread());
|
||||
|
||||
OpenLogsCommand = ReactiveCommand.Create(
|
||||
execute: () => Utils.OpenFolder(Consts.LogsFolder));
|
||||
execute: () => UIUtils.OpenFolder(Consts.LogsFolder));
|
||||
VisitModListWebsiteCommand = ReactiveCommand.Create(
|
||||
execute: () =>
|
||||
{
|
||||
Utils.OpenWebsite(ModList.Website);
|
||||
UIUtils.OpenWebsite(ModList.Website);
|
||||
return Unit.Default;
|
||||
},
|
||||
canExecute: this.WhenAny(x => x.ModList.Website)
|
||||
@ -383,7 +383,7 @@ namespace Wabbajack
|
||||
{
|
||||
try
|
||||
{
|
||||
Utils.Log($"Starting to install {ModList.Name}");
|
||||
UIUtils.Log($"Starting to install {ModList.Name}");
|
||||
IsBackEnabledSubject.OnNext(false);
|
||||
var success = await this.Installer.Install();
|
||||
Completed = ErrorResponse.Create(success);
|
||||
@ -393,7 +393,7 @@ namespace Wabbajack
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.Error(ex);
|
||||
UIUtils.Error(ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -463,4 +463,3 @@ namespace Wabbajack
|
||||
.ToGuiProperty(this, nameof(CurrentCpuCount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,4 +6,5 @@ public static class Consts
|
||||
{
|
||||
public static string AppName = "Wabbajack";
|
||||
public static Uri WabbajackBuildServerUri => new("https://build.wabbajack.org");
|
||||
public static Version CurrentMinimumWabbajackVersion { get; set; } = Version.Parse("2.3.0.0");
|
||||
}
|
Loading…
Reference in New Issue
Block a user