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;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ReactiveUI;
|
using Wabbajack.Compiler;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.DTOs;
|
||||||
using Wabbajack.Lib;
|
|
||||||
|
|
||||||
namespace Wabbajack
|
namespace Wabbajack
|
||||||
{
|
{
|
||||||
|
@ -10,12 +10,18 @@ using System.Reactive.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using DynamicData;
|
using DynamicData;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
|
using Wabbajack.Compiler;
|
||||||
|
using Wabbajack.DTOs;
|
||||||
|
using Wabbajack.DTOs.GitHub;
|
||||||
using Wabbajack.Lib;
|
using Wabbajack.Lib;
|
||||||
using Wabbajack.Lib.AuthorApi;
|
using Wabbajack.Lib.AuthorApi;
|
||||||
using Wabbajack.Lib.Extensions;
|
using Wabbajack.Lib.Extensions;
|
||||||
using Wabbajack.Lib.FileUploader;
|
using Wabbajack.Lib.FileUploader;
|
||||||
using Wabbajack.Lib.GitHub;
|
using Wabbajack.Lib.GitHub;
|
||||||
|
using Wabbajack.Paths;
|
||||||
|
using Wabbajack.Paths.IO;
|
||||||
using WebSocketSharp;
|
using WebSocketSharp;
|
||||||
|
using Consts = Wabbajack.Lib.Consts;
|
||||||
|
|
||||||
namespace Wabbajack
|
namespace Wabbajack
|
||||||
{
|
{
|
||||||
@ -112,7 +118,7 @@ namespace Wabbajack
|
|||||||
ModListLocation.AdditionalError = this.WhenAny(x => x.Mo2Folder)
|
ModListLocation.AdditionalError = this.WhenAny(x => x.Mo2Folder)
|
||||||
.Select<AbsolutePath, IErrorResponse>(moFolder =>
|
.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.");
|
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
|
// If Mo2 folder changes and download location is empty, set it for convenience
|
||||||
this.WhenAny(x => x.Mo2Folder)
|
this.WhenAny(x => x.Mo2Folder)
|
||||||
.DelayInitial(TimeSpan.FromMilliseconds(100), RxApp.MainThreadScheduler)
|
.DelayInitial(TimeSpan.FromMilliseconds(100), RxApp.MainThreadScheduler)
|
||||||
.Where(x => x.IsDirectory)
|
.Where(x => x.DirectoryExists())
|
||||||
.FlowSwitch(
|
.FlowSwitch(
|
||||||
(this).WhenAny(x => x.DownloadLocation.Exists)
|
(this).WhenAny(x => x.DownloadLocation.Exists)
|
||||||
.Invert())
|
.Invert())
|
||||||
@ -197,11 +203,11 @@ namespace Wabbajack
|
|||||||
|
|
||||||
if (Parent.OutputLocation.TargetPath == default)
|
if (Parent.OutputLocation.TargetPath == default)
|
||||||
{
|
{
|
||||||
outputFile = (profileName + Consts.ModListExtension).RelativeTo(AbsolutePath.EntryPoint);
|
outputFile = (profileName.ToRelativePath().WithExtension(Ext.Wabbajack)).RelativeTo(KnownFolders.EntryPoint);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
outputFile = Parent.OutputLocation.TargetPath.Combine(profileName + Consts.ModListExtension);
|
outputFile = Parent.OutputLocation.TargetPath.Combine(profileName).WithExtension(Ext.Wabbajack);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -216,7 +222,7 @@ namespace Wabbajack
|
|||||||
Version = ModlistSettings.Version,
|
Version = ModlistSettings.Version,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
/* TODO
|
||||||
if (ModListLocation.TargetPath.FileName == Consts.NativeSettingsJson)
|
if (ModListLocation.TargetPath.FileName == Consts.NativeSettingsJson)
|
||||||
{
|
{
|
||||||
var settings = ModListLocation.TargetPath.FromJson<NativeCompilerSettings>();
|
var settings = ModListLocation.TargetPath.FromJson<NativeCompilerSettings>();
|
||||||
@ -258,6 +264,8 @@ namespace Wabbajack
|
|||||||
var success = await ActiveCompilation.Begin();
|
var success = await ActiveCompilation.Begin();
|
||||||
return GetResponse<ModList>.Create(success, ActiveCompilation.ModList);
|
return GetResponse<ModList>.Create(success, ActiveCompilation.ModList);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
return GetResponse<ModList>.Create(true, ActiveCompilation.ModList);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
|
using Wabbajack.Installer;
|
||||||
using Wabbajack.Lib;
|
using Wabbajack.Lib;
|
||||||
using Wabbajack.Lib.Interventions;
|
using Wabbajack.Lib.Interventions;
|
||||||
|
|
||||||
@ -13,7 +14,7 @@ namespace Wabbajack
|
|||||||
public interface ISubInstallerVM
|
public interface ISubInstallerVM
|
||||||
{
|
{
|
||||||
InstallerVM Parent { get; }
|
InstallerVM Parent { get; }
|
||||||
AInstaller ActiveInstallation { get; }
|
IInstaller ActiveInstallation { get; }
|
||||||
void Unload();
|
void Unload();
|
||||||
bool SupportsAfterInstallNavigation { get; }
|
bool SupportsAfterInstallNavigation { get; }
|
||||||
void AfterInstallNavigation();
|
void AfterInstallNavigation();
|
||||||
|
@ -1,36 +1,33 @@
|
|||||||
using System;
|
using System;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reactive.Disposables;
|
using System.Reactive.Disposables;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using Wabbajack.Common;
|
|
||||||
using Wabbajack.Lib;
|
using Wabbajack.Lib;
|
||||||
using ReactiveUI.Fody.Helpers;
|
using ReactiveUI.Fody.Helpers;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using DynamicData;
|
using DynamicData;
|
||||||
using DynamicData.Binding;
|
using DynamicData.Binding;
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
using System.Collections.Generic;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Reactive.Subjects;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using Microsoft.WindowsAPICodePack.Dialogs;
|
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||||
using Microsoft.WindowsAPICodePack.Shell;
|
using Microsoft.WindowsAPICodePack.Shell;
|
||||||
using Wabbajack.Common.IO;
|
using Wabbajack.Installer;
|
||||||
using Wabbajack.Lib.Extensions;
|
using Wabbajack.Lib.Extensions;
|
||||||
using Wabbajack.Lib.Interventions;
|
using Wabbajack.Lib.Interventions;
|
||||||
using Wabbajack.Paths;
|
using Wabbajack.Paths;
|
||||||
using Wabbajack.RateLimiter;
|
using Wabbajack.RateLimiter;
|
||||||
using Wabbajack.View_Models;
|
using Wabbajack.View_Models;
|
||||||
|
using Consts = Wabbajack.Lib.Consts;
|
||||||
|
|
||||||
namespace Wabbajack
|
namespace Wabbajack;
|
||||||
|
|
||||||
|
enum ModManager
|
||||||
{
|
{
|
||||||
|
Standard
|
||||||
|
}
|
||||||
|
|
||||||
public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
||||||
{
|
{
|
||||||
public SlideShow Slideshow { get; }
|
public SlideShow Slideshow { get; }
|
||||||
@ -88,6 +85,7 @@ namespace Wabbajack
|
|||||||
public (int CurrentCPUs, int DesiredCPUs) CurrentCpuCount => _CurrentCpuCount.Value;
|
public (int CurrentCPUs, int DesiredCPUs) CurrentCpuCount => _CurrentCpuCount.Value;
|
||||||
|
|
||||||
private readonly ObservableAsPropertyHelper<bool> _LoadingModlist;
|
private readonly ObservableAsPropertyHelper<bool> _LoadingModlist;
|
||||||
|
private readonly ILogger<InstallerVM> _logger;
|
||||||
public bool LoadingModlist => _LoadingModlist.Value;
|
public bool LoadingModlist => _LoadingModlist.Value;
|
||||||
|
|
||||||
// Command properties
|
// Command properties
|
||||||
@ -100,14 +98,16 @@ namespace Wabbajack
|
|||||||
public ReactiveCommand<Unit, Unit> GoToInstallCommand { get; }
|
public ReactiveCommand<Unit, Unit> GoToInstallCommand { get; }
|
||||||
public ReactiveCommand<Unit, Unit> BeginCommand { 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;
|
var downloadsPath = KnownFolders.Downloads.Path;
|
||||||
|
/* TODO
|
||||||
var skyDrivePath = KnownFolders.SkyDrive.Path;
|
var skyDrivePath = KnownFolders.SkyDrive.Path;
|
||||||
|
|
||||||
if (downloadsPath != null && AbsolutePath.EntryPoint.IsChildOf(new AbsolutePath(downloadsPath)))
|
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 " +
|
"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.",
|
"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));
|
"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. " +
|
$"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.",
|
"Please move Wabbajack outside of your OneDrive folder and then restart the app.",
|
||||||
"Cannot run inside OneDrive", true));
|
"Cannot run inside OneDrive", true));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
MWVM = mainWindowVM;
|
MWVM = mainWindowVM;
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ namespace Wabbajack
|
|||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ModManager.MO2:
|
case ModManager.Standard:
|
||||||
return new MO2InstallerVM(this);
|
return new MO2InstallerVM(this);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@ -187,7 +187,7 @@ namespace Wabbajack
|
|||||||
.Select(modListPath =>
|
.Select(modListPath =>
|
||||||
{
|
{
|
||||||
if (modListPath == default) return default;
|
if (modListPath == default) return default;
|
||||||
if (!modListPath.Exists) return default;
|
if (!modListPath.FileExists()) return default;
|
||||||
return new ModListVM(modListPath);
|
return new ModListVM(modListPath);
|
||||||
})
|
})
|
||||||
.DisposeOld()
|
.DisposeOld()
|
||||||
@ -215,7 +215,7 @@ namespace Wabbajack
|
|||||||
.Select(i => i != null)
|
.Select(i => i != null)
|
||||||
.ToGuiProperty(this, nameof(Installing));
|
.ToGuiProperty(this, nameof(Installing));
|
||||||
_TargetManager = this.WhenAny(x => x.ModList)
|
_TargetManager = this.WhenAny(x => x.ModList)
|
||||||
.Select(modList => modList?.ModManager)
|
.Select(modList => ModManager.Standard)
|
||||||
.ToGuiProperty(this, nameof(TargetManager));
|
.ToGuiProperty(this, nameof(TargetManager));
|
||||||
|
|
||||||
// Add additional error check on ModList
|
// Add additional error check on ModList
|
||||||
@ -244,7 +244,7 @@ namespace Wabbajack
|
|||||||
.ObserveOnGuiThread());
|
.ObserveOnGuiThread());
|
||||||
|
|
||||||
_percentCompleted = this.WhenAny(x => x.Installer.ActiveInstallation)
|
_percentCompleted = this.WhenAny(x => x.Installer.ActiveInstallation)
|
||||||
.StartWith(default(AInstaller))
|
.StartWith(default(IInstaller))
|
||||||
.CombineLatest(
|
.CombineLatest(
|
||||||
this.WhenAny(x => x.Completed),
|
this.WhenAny(x => x.Completed),
|
||||||
(installer, completed) =>
|
(installer, completed) =>
|
||||||
@ -325,7 +325,7 @@ namespace Wabbajack
|
|||||||
|
|
||||||
ShowManifestCommand = ReactiveCommand.Create(() =>
|
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)
|
}, this.WhenAny(x => x.ModList)
|
||||||
.Select(x => x?.SourceModList != null)
|
.Select(x => x?.SourceModList != null)
|
||||||
.ObserveOnGuiThread());
|
.ObserveOnGuiThread());
|
||||||
@ -337,11 +337,11 @@ namespace Wabbajack
|
|||||||
.ObserveOnGuiThread());
|
.ObserveOnGuiThread());
|
||||||
|
|
||||||
OpenLogsCommand = ReactiveCommand.Create(
|
OpenLogsCommand = ReactiveCommand.Create(
|
||||||
execute: () => Utils.OpenFolder(Consts.LogsFolder));
|
execute: () => UIUtils.OpenFolder(Consts.LogsFolder));
|
||||||
VisitModListWebsiteCommand = ReactiveCommand.Create(
|
VisitModListWebsiteCommand = ReactiveCommand.Create(
|
||||||
execute: () =>
|
execute: () =>
|
||||||
{
|
{
|
||||||
Utils.OpenWebsite(ModList.Website);
|
UIUtils.OpenWebsite(ModList.Website);
|
||||||
return Unit.Default;
|
return Unit.Default;
|
||||||
},
|
},
|
||||||
canExecute: this.WhenAny(x => x.ModList.Website)
|
canExecute: this.WhenAny(x => x.ModList.Website)
|
||||||
@ -383,7 +383,7 @@ namespace Wabbajack
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Utils.Log($"Starting to install {ModList.Name}");
|
UIUtils.Log($"Starting to install {ModList.Name}");
|
||||||
IsBackEnabledSubject.OnNext(false);
|
IsBackEnabledSubject.OnNext(false);
|
||||||
var success = await this.Installer.Install();
|
var success = await this.Installer.Install();
|
||||||
Completed = ErrorResponse.Create(success);
|
Completed = ErrorResponse.Create(success);
|
||||||
@ -393,7 +393,7 @@ namespace Wabbajack
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Utils.Error(ex);
|
UIUtils.Error(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -463,4 +463,3 @@ namespace Wabbajack
|
|||||||
.ToGuiProperty(this, nameof(CurrentCpuCount));
|
.ToGuiProperty(this, nameof(CurrentCpuCount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -6,4 +6,5 @@ public static class Consts
|
|||||||
{
|
{
|
||||||
public static string AppName = "Wabbajack";
|
public static string AppName = "Wabbajack";
|
||||||
public static Uri WabbajackBuildServerUri => new("https://build.wabbajack.org");
|
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