mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Can install SMEFT and get a "complete screen" and a log at the end
This commit is contained in:
parent
8930db2a81
commit
7443a0b3f3
@ -11,6 +11,7 @@ using ReactiveUI;
|
|||||||
using Splat;
|
using Splat;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack;
|
using Wabbajack;
|
||||||
|
using Wabbajack.DTOs;
|
||||||
using Wabbajack.Models;
|
using Wabbajack.Models;
|
||||||
using Wabbajack.Services.OSIntegrated;
|
using Wabbajack.Services.OSIntegrated;
|
||||||
using Wabbajack.Util;
|
using Wabbajack.Util;
|
||||||
@ -40,7 +41,7 @@ namespace Wabbajack
|
|||||||
|
|
||||||
_serviceProvider = _host.Services;
|
_serviceProvider = _host.Services;
|
||||||
}
|
}
|
||||||
private IServiceCollection ConfigureServices(IServiceCollection services)
|
private static IServiceCollection ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
RxApp.MainThreadScheduler = new DispatcherScheduler(Dispatcher.CurrentDispatcher);
|
RxApp.MainThreadScheduler = new DispatcherScheduler(Dispatcher.CurrentDispatcher);
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ namespace Wabbajack
|
|||||||
services.AddSingleton<SystemParametersConstructor>();
|
services.AddSingleton<SystemParametersConstructor>();
|
||||||
services.AddSingleton<LauncherUpdater>();
|
services.AddSingleton<LauncherUpdater>();
|
||||||
services.AddSingleton<ResourceMonitor>();
|
services.AddSingleton<ResourceMonitor>();
|
||||||
|
services.AddAllSingleton<ILoggerProvider, LoggerProvider>();
|
||||||
|
|
||||||
services.AddSingleton<MainSettings>();
|
services.AddSingleton<MainSettings>();
|
||||||
services.AddTransient<CompilerVM>();
|
services.AddTransient<CompilerVM>();
|
||||||
|
@ -5,7 +5,7 @@ namespace Wabbajack
|
|||||||
public struct ErrorResponse : IErrorResponse
|
public struct ErrorResponse : IErrorResponse
|
||||||
{
|
{
|
||||||
public static readonly ErrorResponse Success = Succeed();
|
public static readonly ErrorResponse Success = Succeed();
|
||||||
public static readonly ErrorResponse Failure = new ErrorResponse();
|
public static readonly ErrorResponse Failure = new();
|
||||||
|
|
||||||
public bool Succeeded { get; }
|
public bool Succeeded { get; }
|
||||||
public Exception? Exception { get; }
|
public Exception? Exception { get; }
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reactive.Disposables;
|
using System.Reactive.Disposables;
|
||||||
|
using System.Reactive.Linq;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using ReactiveUI.Fody.Helpers;
|
using ReactiveUI.Fody.Helpers;
|
||||||
|
|
||||||
@ -9,6 +10,7 @@ public class LoadingLock : ReactiveObject, IDisposable
|
|||||||
{
|
{
|
||||||
private readonly CompositeDisposable _disposable;
|
private readonly CompositeDisposable _disposable;
|
||||||
|
|
||||||
|
[Reactive]
|
||||||
public ErrorResponse? ErrorState { get; set; }
|
public ErrorResponse? ErrorState { get; set; }
|
||||||
|
|
||||||
public LoadingLock()
|
public LoadingLock()
|
||||||
@ -16,10 +18,12 @@ public class LoadingLock : ReactiveObject, IDisposable
|
|||||||
_disposable = new CompositeDisposable();
|
_disposable = new CompositeDisposable();
|
||||||
|
|
||||||
this.WhenAnyValue(vm => vm.LoadLevel)
|
this.WhenAnyValue(vm => vm.LoadLevel)
|
||||||
|
.StartWith(0)
|
||||||
.Subscribe(v => IsLoading = v > 0)
|
.Subscribe(v => IsLoading = v > 0)
|
||||||
.DisposeWith(_disposable);
|
.DisposeWith(_disposable);
|
||||||
|
|
||||||
this.WhenAnyValue(vm => vm.LoadLevel)
|
this.WhenAnyValue(vm => vm.LoadLevel)
|
||||||
|
.StartWith(0)
|
||||||
.Subscribe(v => IsNotLoading = v == 0)
|
.Subscribe(v => IsNotLoading = v == 0)
|
||||||
.DisposeWith(_disposable);
|
.DisposeWith(_disposable);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
using Wabbajack.DTOs;
|
||||||
using Wabbajack.Paths;
|
using Wabbajack.Paths;
|
||||||
|
|
||||||
namespace Wabbajack.Messages;
|
namespace Wabbajack.Messages;
|
||||||
@ -7,13 +8,16 @@ public class LoadModlistForInstalling
|
|||||||
{
|
{
|
||||||
public AbsolutePath Path { get; }
|
public AbsolutePath Path { get; }
|
||||||
|
|
||||||
public LoadModlistForInstalling(AbsolutePath path)
|
public ModlistMetadata Metadata { get; }
|
||||||
|
|
||||||
|
public LoadModlistForInstalling(AbsolutePath path, ModlistMetadata metadata)
|
||||||
{
|
{
|
||||||
Path = path;
|
Path = path;
|
||||||
|
Metadata = metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Send(AbsolutePath path)
|
public static void Send(AbsolutePath path, ModlistMetadata metadata)
|
||||||
{
|
{
|
||||||
MessageBus.Current.SendMessage(new LoadModlistForInstalling(path));
|
MessageBus.Current.SendMessage(new LoadModlistForInstalling(path, metadata));
|
||||||
}
|
}
|
||||||
}
|
}
|
151
Wabbajack.App.Wpf/Models/LoggerProvider.cs
Normal file
151
Wabbajack.App.Wpf/Models/LoggerProvider.cs
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reactive.Disposables;
|
||||||
|
using System.Reactive.Subjects;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using DynamicData;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Wabbajack.Paths;
|
||||||
|
using Wabbajack.Paths.IO;
|
||||||
|
using Wabbajack.Services.OSIntegrated;
|
||||||
|
|
||||||
|
namespace Wabbajack.Models;
|
||||||
|
|
||||||
|
public class LoggerProvider : ILoggerProvider
|
||||||
|
{
|
||||||
|
private readonly RelativePath _appName;
|
||||||
|
private readonly Configuration _configuration;
|
||||||
|
private readonly CompositeDisposable _disposables;
|
||||||
|
private readonly Stream _logFile;
|
||||||
|
private readonly StreamWriter _logStream;
|
||||||
|
|
||||||
|
public readonly ReadOnlyObservableCollection<ILogMessage> _messagesFiltered;
|
||||||
|
private readonly DateTime _startupTime;
|
||||||
|
|
||||||
|
private long _messageId;
|
||||||
|
private readonly SourceCache<ILogMessage, long> _messageLog = new(m => m.MessageId);
|
||||||
|
private readonly Subject<ILogMessage> _messages = new();
|
||||||
|
|
||||||
|
public LoggerProvider(Configuration configuration)
|
||||||
|
{
|
||||||
|
_startupTime = DateTime.UtcNow;
|
||||||
|
_configuration = configuration;
|
||||||
|
_configuration.LogLocation.CreateDirectory();
|
||||||
|
|
||||||
|
_disposables = new CompositeDisposable();
|
||||||
|
|
||||||
|
Messages.Subscribe(m => _messageLog.AddOrUpdate(m))
|
||||||
|
.DisposeWith(_disposables);
|
||||||
|
|
||||||
|
Messages.Subscribe(m => LogToFile(m))
|
||||||
|
.DisposeWith(_disposables);
|
||||||
|
|
||||||
|
_messageLog.Connect()
|
||||||
|
.Bind(out _messagesFiltered)
|
||||||
|
.Subscribe()
|
||||||
|
.DisposeWith(_disposables);
|
||||||
|
|
||||||
|
_messages.DisposeWith(_disposables);
|
||||||
|
|
||||||
|
_appName = typeof(LoggerProvider).Assembly.Location.ToAbsolutePath().FileName;
|
||||||
|
LogPath = _configuration.LogLocation.Combine($"{_appName}.current.log");
|
||||||
|
_logFile = LogPath.Open(FileMode.Append, FileAccess.Write);
|
||||||
|
_logFile.DisposeWith(_disposables);
|
||||||
|
|
||||||
|
_logStream = new StreamWriter(_logFile, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IObservable<ILogMessage> Messages => _messages;
|
||||||
|
public AbsolutePath LogPath { get; }
|
||||||
|
public ReadOnlyObservableCollection<ILogMessage> MessageLog => _messagesFiltered;
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_disposables.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ILogger CreateLogger(string categoryName)
|
||||||
|
{
|
||||||
|
return new Logger(this, categoryName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogToFile(ILogMessage logMessage)
|
||||||
|
{
|
||||||
|
var line = $"[{logMessage.TimeStamp - _startupTime}] {logMessage.LongMessage}";
|
||||||
|
lock (_logStream)
|
||||||
|
{
|
||||||
|
_logStream.Write(line);
|
||||||
|
_logStream.Flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private long NextMessageId()
|
||||||
|
{
|
||||||
|
return Interlocked.Increment(ref _messageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Logger : ILogger
|
||||||
|
{
|
||||||
|
private readonly string _categoryName;
|
||||||
|
private readonly LoggerProvider _provider;
|
||||||
|
private ImmutableList<object> Scopes = ImmutableList<object>.Empty;
|
||||||
|
|
||||||
|
public Logger(LoggerProvider provider, string categoryName)
|
||||||
|
{
|
||||||
|
_categoryName = categoryName;
|
||||||
|
_provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception,
|
||||||
|
Func<TState, Exception?, string> formatter)
|
||||||
|
{
|
||||||
|
_provider._messages.OnNext(new LogMessage<TState>(DateTime.UtcNow, _provider.NextMessageId(), logLevel,
|
||||||
|
eventId, state, exception, formatter));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsEnabled(LogLevel logLevel)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDisposable BeginScope<TState>(TState state)
|
||||||
|
{
|
||||||
|
Scopes = Scopes.Add(state);
|
||||||
|
return Disposable.Create(() => Scopes = Scopes.Remove(state));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ILogMessage
|
||||||
|
{
|
||||||
|
long MessageId { get; }
|
||||||
|
|
||||||
|
string ShortMessage { get; }
|
||||||
|
DateTime TimeStamp { get; }
|
||||||
|
string LongMessage { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private record LogMessage<TState>(DateTime TimeStamp, long MessageId, LogLevel LogLevel, EventId EventId,
|
||||||
|
TState State, Exception? Exception, Func<TState, Exception?, string> Formatter) : ILogMessage
|
||||||
|
{
|
||||||
|
public string ShortMessage => Formatter(State, Exception);
|
||||||
|
|
||||||
|
public string LongMessage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.AppendLine(ShortMessage);
|
||||||
|
if (Exception != null)
|
||||||
|
{
|
||||||
|
sb.Append("Exception: ");
|
||||||
|
sb.Append(Exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -147,7 +147,7 @@ namespace Wabbajack
|
|||||||
{
|
{
|
||||||
if (await _maintainer.HaveModList(Metadata))
|
if (await _maintainer.HaveModList(Metadata))
|
||||||
{
|
{
|
||||||
LoadModlistForInstalling.Send(_maintainer.ModListPath(Metadata));
|
LoadModlistForInstalling.Send(_maintainer.ModListPath(Metadata), Metadata);
|
||||||
NavigateToGlobal.Send(NavigateToGlobal.ScreenType.Installer);
|
NavigateToGlobal.Send(NavigateToGlobal.ScreenType.Installer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -9,12 +9,14 @@ using DynamicData;
|
|||||||
using DynamicData.Binding;
|
using DynamicData.Binding;
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.WindowsAPICodePack.Dialogs;
|
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||||
using Microsoft.WindowsAPICodePack.Shell;
|
using Microsoft.WindowsAPICodePack.Shell;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
|
using Wabbajack.Downloaders.GameFile;
|
||||||
using Wabbajack.DTOs;
|
using Wabbajack.DTOs;
|
||||||
using Wabbajack.DTOs.JsonConverters;
|
using Wabbajack.DTOs.JsonConverters;
|
||||||
using Wabbajack.Extensions;
|
using Wabbajack.Extensions;
|
||||||
@ -22,11 +24,13 @@ using Wabbajack.Hashing.xxHash64;
|
|||||||
using Wabbajack.Installer;
|
using Wabbajack.Installer;
|
||||||
using Wabbajack.Interventions;
|
using Wabbajack.Interventions;
|
||||||
using Wabbajack.Messages;
|
using Wabbajack.Messages;
|
||||||
|
using Wabbajack.Models;
|
||||||
using Wabbajack.Paths;
|
using Wabbajack.Paths;
|
||||||
using Wabbajack.RateLimiter;
|
using Wabbajack.RateLimiter;
|
||||||
using Wabbajack.View_Models;
|
using Wabbajack.View_Models;
|
||||||
using Wabbajack.Paths.IO;
|
using Wabbajack.Paths.IO;
|
||||||
using Wabbajack.Services.OSIntegrated;
|
using Wabbajack.Services.OSIntegrated;
|
||||||
|
using Wabbajack.Util;
|
||||||
using Consts = Wabbajack.Consts;
|
using Consts = Wabbajack.Consts;
|
||||||
using KnownFolders = Wabbajack.Paths.IO.KnownFolders;
|
using KnownFolders = Wabbajack.Paths.IO.KnownFolders;
|
||||||
|
|
||||||
@ -37,6 +41,14 @@ public enum ModManager
|
|||||||
Standard
|
Standard
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum InstallState
|
||||||
|
{
|
||||||
|
Configuration,
|
||||||
|
Installing,
|
||||||
|
Success,
|
||||||
|
Failure
|
||||||
|
}
|
||||||
|
|
||||||
public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
||||||
{
|
{
|
||||||
private const string LastLoadedModlist = "last-loaded-modlist";
|
private const string LastLoadedModlist = "last-loaded-modlist";
|
||||||
@ -45,6 +57,9 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
|||||||
[Reactive]
|
[Reactive]
|
||||||
public ModList ModList { get; set; }
|
public ModList ModList { get; set; }
|
||||||
|
|
||||||
|
[Reactive]
|
||||||
|
public ModlistMetadata ModlistMetadata { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public ErrorResponse? Completed { get; set; }
|
public ErrorResponse? Completed { get; set; }
|
||||||
|
|
||||||
@ -62,6 +77,9 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
|||||||
public BitmapFrame SlideShowImage { get; set; }
|
public BitmapFrame SlideShowImage { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[Reactive]
|
||||||
|
public InstallState InstallState { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Slideshow Data
|
/// Slideshow Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -79,10 +97,17 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
|||||||
private readonly DTOSerializer _dtos;
|
private readonly DTOSerializer _dtos;
|
||||||
private readonly ILogger<InstallerVM> _logger;
|
private readonly ILogger<InstallerVM> _logger;
|
||||||
private readonly SettingsManager _settingsManager;
|
private readonly SettingsManager _settingsManager;
|
||||||
|
private readonly IServiceProvider _serviceProvider;
|
||||||
|
private readonly SystemParametersConstructor _parametersConstructor;
|
||||||
|
private readonly IGameLocator _gameLocator;
|
||||||
|
private readonly LoggerProvider _loggerProvider;
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool Installing { get; set; }
|
public bool Installing { get; set; }
|
||||||
|
|
||||||
|
[Reactive]
|
||||||
|
public LoggerProvider LoggerProvider { get; set; }
|
||||||
|
|
||||||
|
|
||||||
// Command properties
|
// Command properties
|
||||||
public ReactiveCommand<Unit, Unit> ShowManifestCommand { get; }
|
public ReactiveCommand<Unit, Unit> ShowManifestCommand { get; }
|
||||||
@ -96,11 +121,17 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
|||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> BackCommand { get; }
|
public ReactiveCommand<Unit, Unit> BackCommand { get; }
|
||||||
|
|
||||||
public InstallerVM(ILogger<InstallerVM> logger, DTOSerializer dtos, SettingsManager settingsManager) : base(logger)
|
public InstallerVM(ILogger<InstallerVM> logger, DTOSerializer dtos, SettingsManager settingsManager, IServiceProvider serviceProvider,
|
||||||
|
SystemParametersConstructor parametersConstructor, IGameLocator gameLocator, LoggerProvider loggerProvider) : base(logger)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
LoggerProvider = loggerProvider;
|
||||||
_settingsManager = settingsManager;
|
_settingsManager = settingsManager;
|
||||||
_dtos = dtos;
|
_dtos = dtos;
|
||||||
|
_serviceProvider = serviceProvider;
|
||||||
|
_parametersConstructor = parametersConstructor;
|
||||||
|
_gameLocator = gameLocator;
|
||||||
|
|
||||||
Installer = new MO2InstallerVM(this);
|
Installer = new MO2InstallerVM(this);
|
||||||
|
|
||||||
BackCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.ModeSelectionView));
|
BackCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.ModeSelectionView));
|
||||||
@ -126,7 +157,7 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
|||||||
ModListLocation.Filters.Add(new CommonFileDialogFilter("Wabbajack Modlist", "*.wabbajack"));
|
ModListLocation.Filters.Add(new CommonFileDialogFilter("Wabbajack Modlist", "*.wabbajack"));
|
||||||
|
|
||||||
MessageBus.Current.Listen<LoadModlistForInstalling>()
|
MessageBus.Current.Listen<LoadModlistForInstalling>()
|
||||||
.Subscribe(msg => LoadModlist(msg.Path).FireAndForget())
|
.Subscribe(msg => LoadModlist(msg.Path, msg.Metadata).FireAndForget())
|
||||||
.DisposeWith(CompositeDisposable);
|
.DisposeWith(CompositeDisposable);
|
||||||
|
|
||||||
MessageBus.Current.Listen<LoadLastLoadedModlist>()
|
MessageBus.Current.Listen<LoadLastLoadedModlist>()
|
||||||
@ -137,8 +168,10 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
|||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
ModListLocation.WhenAnyValue(l => l.TargetPath)
|
ModListLocation.WhenAnyValue(l => l.TargetPath)
|
||||||
.Subscribe(p => LoadModlist(p).FireAndForget())
|
.Subscribe(p => LoadModlist(p, null).FireAndForget())
|
||||||
.DisposeWith(disposables);
|
.DisposeWith(disposables);
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -149,12 +182,13 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
|||||||
{
|
{
|
||||||
var lst = await _settingsManager.Load<AbsolutePath>(LastLoadedModlist);
|
var lst = await _settingsManager.Load<AbsolutePath>(LastLoadedModlist);
|
||||||
if (lst.FileExists())
|
if (lst.FileExists())
|
||||||
await LoadModlist(lst);
|
await LoadModlist(lst, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadModlist(AbsolutePath path)
|
private async Task LoadModlist(AbsolutePath path, ModlistMetadata? metadata)
|
||||||
{
|
{
|
||||||
using var ll = LoadingLock.WithLoading();
|
using var ll = LoadingLock.WithLoading();
|
||||||
|
InstallState = InstallState.Configuration;
|
||||||
ModListLocation.TargetPath = path;
|
ModListLocation.TargetPath = path;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -169,6 +203,7 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
|||||||
ModListLocation.TargetPath = prevSettings.ModListLocation;
|
ModListLocation.TargetPath = prevSettings.ModListLocation;
|
||||||
Installer.Location.TargetPath = prevSettings.InstallLocation;
|
Installer.Location.TargetPath = prevSettings.InstallLocation;
|
||||||
Installer.DownloadLocation.TargetPath = prevSettings.DownloadLoadction;
|
Installer.DownloadLocation.TargetPath = prevSettings.DownloadLoadction;
|
||||||
|
ModlistMetadata = metadata ?? prevSettings.Metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
PopulateSlideShow(ModList);
|
PopulateSlideShow(ModList);
|
||||||
@ -183,16 +218,40 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task BeginInstall()
|
private async Task BeginInstall()
|
||||||
{
|
{
|
||||||
|
InstallState = InstallState.Installing;
|
||||||
var postfix = (await ModListLocation.TargetPath.ToString().Hash()).ToHex();
|
var postfix = (await ModListLocation.TargetPath.ToString().Hash()).ToHex();
|
||||||
await _settingsManager.Save(InstallSettingsPrefix + postfix, new SavedInstallSettings
|
await _settingsManager.Save(InstallSettingsPrefix + postfix, new SavedInstallSettings
|
||||||
{
|
{
|
||||||
ModListLocation = ModListLocation.TargetPath,
|
ModListLocation = ModListLocation.TargetPath,
|
||||||
InstallLocation = Installer.Location.TargetPath,
|
InstallLocation = Installer.Location.TargetPath,
|
||||||
DownloadLoadction = Installer.DownloadLocation.TargetPath
|
DownloadLoadction = Installer.DownloadLocation.TargetPath,
|
||||||
|
Metadata = ModlistMetadata
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var installer = StandardInstaller.Create(_serviceProvider, new InstallerConfiguration
|
||||||
|
{
|
||||||
|
Game = ModList.GameType,
|
||||||
|
Downloads = Installer.DownloadLocation.TargetPath,
|
||||||
|
Install = Installer.Location.TargetPath,
|
||||||
|
ModList = ModList,
|
||||||
|
ModlistArchive = ModListLocation.TargetPath,
|
||||||
|
SystemParameters = _parametersConstructor.Create(),
|
||||||
|
GameFolder = _gameLocator.GameLocation(ModList.GameType)
|
||||||
|
});
|
||||||
|
|
||||||
|
await installer.Begin(CancellationToken.None);
|
||||||
|
|
||||||
|
InstallState = InstallState.Success;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
InstallState = InstallState.Failure;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SavedInstallSettings
|
class SavedInstallSettings
|
||||||
@ -200,6 +259,8 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
|||||||
public AbsolutePath ModListLocation { get; set; }
|
public AbsolutePath ModListLocation { get; set; }
|
||||||
public AbsolutePath InstallLocation { get; set; }
|
public AbsolutePath InstallLocation { get; set; }
|
||||||
public AbsolutePath DownloadLoadction { get; set; }
|
public AbsolutePath DownloadLoadction { get; set; }
|
||||||
|
|
||||||
|
public ModlistMetadata Metadata { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PopulateSlideShow(ModList modList)
|
private void PopulateSlideShow(ModList modList)
|
||||||
|
@ -134,7 +134,7 @@ namespace Wabbajack
|
|||||||
|
|
||||||
if (IsStartingFromModlist(out var path))
|
if (IsStartingFromModlist(out var path))
|
||||||
{
|
{
|
||||||
LoadModlistForInstalling.Send(path);
|
LoadModlistForInstalling.Send(path, null);
|
||||||
NavigateToGlobal.Send(NavigateToGlobal.ScreenType.Installer);
|
NavigateToGlobal.Send(NavigateToGlobal.ScreenType.Installer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
local:AutoScrollBehavior.ScrollOnNewItem="True"
|
local:AutoScrollBehavior.ScrollOnNewItem="True"
|
||||||
BorderBrush="Transparent"
|
BorderBrush="Transparent"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
ItemsSource="{Binding Log}"
|
ItemsSource="{Binding LoggerProvider.MessageLog}"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding ShortDescription}" TextWrapping="WrapWithOverflow" />
|
<TextBlock Text="{Binding ShortMessage}" TextWrapping="WrapWithOverflow" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
|
@ -16,9 +16,24 @@ namespace Wabbajack
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
MidInstallDisplayGrid.Visibility = Visibility.Collapsed;
|
//MidInstallDisplayGrid.Visibility = Visibility.Collapsed;
|
||||||
LogView.Visibility = Visibility.Collapsed;
|
//LogView.Visibility = Visibility.Collapsed;
|
||||||
CpuView.Visibility = Visibility.Collapsed;
|
//CpuView.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
|
ViewModel.WhenAnyValue(vm => vm.InstallState)
|
||||||
|
.Select(v => v != InstallState.Configuration ? Visibility.Visible : Visibility.Collapsed)
|
||||||
|
.BindToStrict(this, view => view.MidInstallDisplayGrid.Visibility)
|
||||||
|
.DisposeWith(disposables);
|
||||||
|
|
||||||
|
ViewModel.WhenAnyValue(vm => vm.InstallState)
|
||||||
|
.Select(v => v == InstallState.Configuration ? Visibility.Visible : Visibility.Collapsed)
|
||||||
|
.BindToStrict(this, view => view.BottomButtonInputGrid.Visibility)
|
||||||
|
.DisposeWith(disposables);
|
||||||
|
|
||||||
|
ViewModel.WhenAnyValue(vm => vm.InstallState)
|
||||||
|
.Select(es => es == InstallState.Success ? Visibility.Visible : Visibility.Collapsed)
|
||||||
|
.BindToStrict(this, view => view.InstallComplete.Visibility)
|
||||||
|
.DisposeWith(disposables);
|
||||||
|
|
||||||
//ViewModel.WhenAnyValue(vm => vm.ModList.Name)
|
//ViewModel.WhenAnyValue(vm => vm.ModList.Name)
|
||||||
// .BindToStrict(this, view => view.Name)
|
// .BindToStrict(this, view => view.Name)
|
||||||
|
@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
|||||||
using IniParser;
|
using IniParser;
|
||||||
using IniParser.Model.Configuration;
|
using IniParser.Model.Configuration;
|
||||||
using IniParser.Parser;
|
using IniParser.Parser;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
using Wabbajack.Compression.BSA;
|
using Wabbajack.Compression.BSA;
|
||||||
@ -41,6 +42,20 @@ public class StandardInstaller : AInstaller<StandardInstaller>
|
|||||||
MaxSteps = 14;
|
MaxSteps = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static StandardInstaller Create(IServiceProvider provider, InstallerConfiguration configuration)
|
||||||
|
{
|
||||||
|
return new StandardInstaller(provider.GetRequiredService<ILogger<StandardInstaller>>(),
|
||||||
|
configuration,
|
||||||
|
provider.GetRequiredService<IGameLocator>(),
|
||||||
|
provider.GetRequiredService<FileExtractor.FileExtractor>(),
|
||||||
|
provider.GetRequiredService<DTOSerializer>(),
|
||||||
|
provider.GetRequiredService<Context>(),
|
||||||
|
provider.GetRequiredService<FileHashCache>(),
|
||||||
|
provider.GetRequiredService<DownloadDispatcher>(),
|
||||||
|
provider.GetRequiredService<ParallelOptions>(),
|
||||||
|
provider.GetRequiredService<Client>());
|
||||||
|
}
|
||||||
|
|
||||||
public override async Task<bool> Begin(CancellationToken token)
|
public override async Task<bool> Begin(CancellationToken token)
|
||||||
{
|
{
|
||||||
if (token.IsCancellationRequested) return false;
|
if (token.IsCancellationRequested) return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user