36 errors

This commit is contained in:
Timothy Baldridge
2021-12-28 12:18:37 -07:00
parent 4a22f4a739
commit f49083f0c2
10 changed files with 58 additions and 63 deletions

View File

@ -159,6 +159,7 @@ namespace Wabbajack
/*
public void SetProcessorSettings(ABatchProcessor processor) public void SetProcessorSettings(ABatchProcessor processor)
{ {
processor.DownloadThreads = DownloadThreads; processor.DownloadThreads = DownloadThreads;
@ -168,7 +169,7 @@ namespace Wabbajack
if (processor is MO2Compiler mo2c) if (processor is MO2Compiler mo2c)
mo2c.DisableTextureResizing = DisableTextureResizing; mo2c.DisableTextureResizing = DisableTextureResizing;
} }*/
} }
[JsonName("CompilationModlistSettings")] [JsonName("CompilationModlistSettings")]

View File

@ -0,0 +1,6 @@
namespace Wabbajack;
public interface INeedsLogin
{
}

View File

@ -0,0 +1,6 @@
namespace Wabbajack;
public interface INeedsLoginCredentials
{
}

View File

@ -5,9 +5,8 @@ using System.Security;
using System.Threading.Tasks; using System.Threading.Tasks;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Common; using Wabbajack.Downloaders.Interfaces;
using Wabbajack.Lib; using Wabbajack.Lib;
using Wabbajack.Lib.Downloaders;
namespace Wabbajack namespace Wabbajack
{ {
@ -19,8 +18,9 @@ namespace Wabbajack
[Reactive] [Reactive]
public string MFAKey { get; set; } public string MFAKey { get; set; }
[Reactive] [Reactive]
public LoginReturnMessage ReturnMessage { get; set; } public object ReturnMessage { get; set; }
[Reactive] [Reactive]
public bool LoggingIn { get; private set; } public bool LoggingIn { get; private set; }
@ -31,7 +31,7 @@ namespace Wabbajack
private readonly ObservableAsPropertyHelper<bool> _mfaVisible; private readonly ObservableAsPropertyHelper<bool> _mfaVisible;
public bool MFAVisible => _mfaVisible.Value; public bool MFAVisible => _mfaVisible.Value;
private readonly INeedsLoginCredentials _downloader; private readonly object _downloader;
public CredentialsLoginVM(INeedsLoginCredentials downloader) public CredentialsLoginVM(INeedsLoginCredentials downloader)
{ {
@ -48,13 +48,16 @@ namespace Wabbajack
.ToGuiProperty(this, .ToGuiProperty(this,
nameof(LoginEnabled)); nameof(LoginEnabled));
/*
_mfaVisible = this.WhenAny(x => x.ReturnMessage) _mfaVisible = this.WhenAny(x => x.ReturnMessage)
.Select(x => x.ReturnCode == LoginReturnCode.NeedsMFA) .Select(x => x.ReturnCode == LoginReturnCode.NeedsMFA)
.ToGuiProperty(this, nameof(MFAVisible)); .ToGuiProperty(this, nameof(MFAVisible));
*/
} }
public async Task Login(SecureString password) public async Task Login(SecureString password)
{ {
/*
try try
{ {
LoggingIn = true; LoggingIn = true;
@ -77,6 +80,7 @@ namespace Wabbajack
{ {
LoggingIn = false; LoggingIn = false;
} }
*/
} }
private static bool IsValidAddress(string s) private static bool IsValidAddress(string s)

View File

@ -3,21 +3,14 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq;
using System.Reactive; using System.Reactive;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Threading; using Microsoft.Extensions.Logging;
using Microsoft.WindowsAPICodePack.Shell.PropertySystem;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using Wabbajack.Common;
using Wabbajack.Lib; using Wabbajack.Lib;
using Wabbajack.Lib.Downloaders;
namespace Wabbajack namespace Wabbajack
{ {
@ -26,8 +19,8 @@ namespace Wabbajack
{ {
public List<LoginTargetVM> Downloaders { get; } public List<LoginTargetVM> Downloaders { get; }
public LoginManagerVM(SettingsVM settingsVM) public LoginManagerVM(ILogger<LoginManagerVM> logger, SettingsVM settingsVM)
: base(settingsVM.MWVM) : base(logger, settingsVM.MWVM)
{ {
/* /*
Downloaders = DownloadDispatcher.Downloaders Downloaders = DownloadDispatcher.Downloaders
@ -148,5 +141,5 @@ namespace Wabbajack
}); });
} }
} }
*/
} }

View File

@ -1,17 +1,14 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
using MahApps.Metro.Controls; using MahApps.Metro.Controls;
using Newtonsoft.Json; using Microsoft.Extensions.Logging;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Common.StoreHandlers;
using Wabbajack.Lib; using Wabbajack.Lib;
using Wabbajack.Lib.LibCefHelpers; using Wabbajack.Lib.LibCefHelpers;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
using Wabbajack.Util; using Wabbajack.Util;
using Application = System.Windows.Application;
using Utils = Wabbajack.Common.Utils;
namespace Wabbajack namespace Wabbajack
{ {
@ -22,47 +19,46 @@ namespace Wabbajack
{ {
private MainWindowVM _mwvm; private MainWindowVM _mwvm;
private MainSettings _settings; private MainSettings _settings;
private readonly ILogger<MainWindow> _logger;
private readonly SystemParametersConstructor _systemParams;
public MainWindow() public MainWindow(ILogger<MainWindow> logger, SystemParametersConstructor systemParams, LauncherUpdater updater)
{ {
_logger = logger;
_systemParams = systemParams;
try try
{ {
// Wire any unhandled crashing exceptions to log before exiting // Wire any unhandled crashing exceptions to log before exiting
AppDomain.CurrentDomain.UnhandledException += (sender, e) => AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
{ {
// Don't do any special logging side effects // Don't do any special logging side effects
Utils.LogStraightToFile("Error."); _logger.LogError((Exception)e.ExceptionObject, "Uncaught error");
Utils.LogStraightToFile(((Exception)e.ExceptionObject).ToString());
Environment.Exit(-1); Environment.Exit(-1);
}; };
Utils.Log($"Wabbajack Build - {ThisAssembly.Git.Sha}"); _logger.LogInformation("Wabbajack Build - {Sha}",ThisAssembly.Git.Sha);
Utils.Log($"Running in {AbsolutePath.EntryPoint}"); _logger.LogInformation("Running in {EntryPoint}", KnownFolders.EntryPoint);
var p = SystemParametersConstructor.Create(); var p = _systemParams.Create();
Utils.Log($"Detected Windows Version: {p.WindowsVersion}"); _logger.LogInformation("Detected Windows Version: {Version}", Environment.OSVersion.VersionString);
_logger.LogInformation(
"System settings - ({MemorySize} RAM) ({PageSize} Page), Display: {ScreenWidth} x {ScreenHeight} ({Vram} VRAM - VideoMemorySizeMb={ENBVRam})",
if (!(p.WindowsVersion > Consts.MaximumUnsupportedWindowsVersion)) p.SystemMemorySize.ToFileSizeString(), p.SystemPageSize.ToFileSizeString(), p.ScreenWidth, p.ScreenHeight, p.VideoMemorySize.ToFileSizeString(), p.EnbLEVRAMSize);
Utils.Log(
$"You are not running a recent version of Windows ({p.WindowsVersion}), Wabbajack is only supported on Windows versions greater than {Consts.MaximumUnsupportedWindowsVersion}.");
Utils.Log(
$"System settings - ({p.SystemMemorySize.ToFileSizeString()} RAM) ({p.SystemPageSize.ToFileSizeString()} Page), Display: {p.ScreenWidth} x {p.ScreenHeight} ({p.VideoMemorySize.ToFileSizeString()} VRAM - VideoMemorySizeMb={p.EnbLEVRAMSize})");
if (p.SystemPageSize == 0) if (p.SystemPageSize == 0)
Utils.Log("Pagefile is disabled! Consider increasing to 20000MB. A disabled pagefile can cause crashes and poor in-game performance."); _logger.LogInformation("Pagefile is disabled! Consider increasing to 20000MB. A disabled pagefile can cause crashes and poor in-game performance");
else if (p.SystemPageSize < 2e+10) else if (p.SystemPageSize < 2e+10)
Utils.Log("Pagefile below recommended! Consider increasing to 20000MB. A suboptimal pagefile can cause crashes and poor in-game performance."); _logger.LogInformation("Pagefile below recommended! Consider increasing to 20000MB. A suboptimal pagefile can cause crashes and poor in-game performance");
Warmup(); Warmup();
var _ = LauncherUpdater.Run(); var _ = updater.Run();
var (settings, loadedSettings) = MainSettings.TryLoadTypicalSettings().AsTask().Result; var (settings, loadedSettings) = MainSettings.TryLoadTypicalSettings().AsTask().Result;
// Load settings // Load settings
/*
if (CLIArguments.NoSettings || !loadedSettings) if (CLIArguments.NoSettings || !loadedSettings)
{ {
_settings = new MainSettings {Version = Consts.SettingsVersion}; _settings = new MainSettings {Version = Consts.SettingsVersion};
@ -72,7 +68,7 @@ namespace Wabbajack
{ {
_settings = settings; _settings = settings;
RunWhenLoaded(LoadSettings); RunWhenLoaded(LoadSettings);
} }*/
// Set datacontext // Set datacontext
_mwvm = new MainWindowVM(this, _settings); _mwvm = new MainWindowVM(this, _settings);
@ -92,8 +88,7 @@ namespace Wabbajack
} }
catch (Exception ex) catch (Exception ex)
{ {
Utils.LogStraightToFile("Error"); _logger.LogError(ex, "During Main Window Startup");
Utils.LogStraightToFile(ex.ToString());
Environment.Exit(-1); Environment.Exit(-1);
} }
} }
@ -110,13 +105,6 @@ namespace Wabbajack
/// </summary> /// </summary>
private void Warmup() private void Warmup()
{ {
TempFolder.Warmup();
// ToDo
// Currently this is a blocking call. Perhaps upgrade to be run in a background task.
// Would first need to ensure users of CEF properly await the background initialization before use
Helpers.Init();
StoreHandler.Warmup();
Task.Run(AssociateListsWithWabbajack).FireAndForget(); Task.Run(AssociateListsWithWabbajack).FireAndForget();
} }
@ -125,6 +113,7 @@ namespace Wabbajack
/// </summary> /// </summary>
private void AssociateListsWithWabbajack() private void AssociateListsWithWabbajack()
{ {
/* TODO
var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location; var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
try try
{ {
@ -136,7 +125,7 @@ namespace Wabbajack
catch (Exception e) catch (Exception e)
{ {
Utils.Log($"ExtensionManager had an exception:\n{e}"); Utils.Log($"ExtensionManager had an exception:\n{e}");
} }*/
} }
private void RunWhenLoaded(Action a) private void RunWhenLoaded(Action a)

View File

@ -1,12 +1,7 @@
using System; using System.Reactive.Disposables;
using System.Diagnostics;
using System.Reactive.Disposables;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using MahApps.Metro.Controls;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Lib.ModListRegistry;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -1,8 +1,6 @@
using System.Reactive.Disposables; using System.Reactive.Disposables;
using System.Windows; using System.Windows;
using MahApps.Metro.Controls;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Lib.Downloaders;
namespace Wabbajack namespace Wabbajack
{ {
@ -38,7 +36,7 @@ namespace Wabbajack
private async void LoginButton_OnClick(object sender, RoutedEventArgs e) private async void LoginButton_OnClick(object sender, RoutedEventArgs e)
{ {
ViewModel.Login(Password.SecurePassword).FireAndForget(); //ViewModel.Login(Password.SecurePassword).FireAndForget();
} }
} }
} }

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Reactive.Disposables; using System.Reactive.Disposables;
using System.Reactive.Linq;
using ReactiveUI; using ReactiveUI;
namespace Wabbajack namespace Wabbajack
@ -20,7 +19,7 @@ namespace Wabbajack
this.OneWayBindStrict(ViewModel, x => x.Login.SiteName, x => x.SiteNameText.Text) this.OneWayBindStrict(ViewModel, x => x.Login.SiteName, x => x.SiteNameText.Text)
.DisposeWith(disposable); .DisposeWith(disposable);
if (!ViewModel.UsesCredentials) if (!ViewModel!.UsesCredentials)
{ {
this.OneWayBindStrict(ViewModel, x => x.Login.TriggerLogin, x => x.LoginButton.Command) this.OneWayBindStrict(ViewModel, x => x.Login.TriggerLogin, x => x.LoginButton.Command)
.DisposeWith(disposable); .DisposeWith(disposable);
@ -36,6 +35,7 @@ namespace Wabbajack
this.OneWayBindStrict(ViewModel, x => x.MetaInfo, x => x.MetaText.Text) this.OneWayBindStrict(ViewModel, x => x.MetaInfo, x => x.MetaText.Text)
.DisposeWith(disposable); .DisposeWith(disposable);
/* TODO
// Modify label state // Modify label state
this.WhenAny(x => x.ViewModel.Login.TriggerLogin.CanExecute) this.WhenAny(x => x.ViewModel.Login.TriggerLogin.CanExecute)
.Switch() .Switch()
@ -50,6 +50,7 @@ namespace Wabbajack
{ {
LogoutButton.Content = x ? "Logout" : "Logged Out"; LogoutButton.Content = x ? "Logout" : "Logged Out";
}); });
*/
}); });
} }
} }

View File

@ -1,9 +1,10 @@
using Wabbajack.Lib.Downloaders; 
namespace Wabbajack namespace Wabbajack
{ {
public partial class LoginWindowView public partial class LoginWindowView
{ {
/*
public INeedsLoginCredentials Downloader { get; set; } public INeedsLoginCredentials Downloader { get; set; }
public LoginWindowView(INeedsLoginCredentials downloader) public LoginWindowView(INeedsLoginCredentials downloader)
@ -16,5 +17,6 @@ namespace Wabbajack
Grid.Children.Add(loginView); Grid.Children.Add(loginView);
} }
*/
} }
} }