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

View File

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

View File

@ -1,17 +1,14 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
using MahApps.Metro.Controls;
using Newtonsoft.Json;
using Microsoft.Extensions.Logging;
using Wabbajack.Common;
using Wabbajack.Common.StoreHandlers;
using Wabbajack.Lib;
using Wabbajack.Lib.LibCefHelpers;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
using Wabbajack.Util;
using Application = System.Windows.Application;
using Utils = Wabbajack.Common.Utils;
namespace Wabbajack
{
@ -22,47 +19,46 @@ namespace Wabbajack
{
private MainWindowVM _mwvm;
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
{
// Wire any unhandled crashing exceptions to log before exiting
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
{
// Don't do any special logging side effects
Utils.LogStraightToFile("Error.");
Utils.LogStraightToFile(((Exception)e.ExceptionObject).ToString());
_logger.LogError((Exception)e.ExceptionObject, "Uncaught error");
Environment.Exit(-1);
};
Utils.Log($"Wabbajack Build - {ThisAssembly.Git.Sha}");
Utils.Log($"Running in {AbsolutePath.EntryPoint}");
_logger.LogInformation("Wabbajack Build - {Sha}",ThisAssembly.Git.Sha);
_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);
if (!(p.WindowsVersion > Consts.MaximumUnsupportedWindowsVersion))
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})");
_logger.LogInformation(
"System settings - ({MemorySize} RAM) ({PageSize} Page), Display: {ScreenWidth} x {ScreenHeight} ({Vram} VRAM - VideoMemorySizeMb={ENBVRam})",
p.SystemMemorySize.ToFileSizeString(), p.SystemPageSize.ToFileSizeString(), p.ScreenWidth, p.ScreenHeight, p.VideoMemorySize.ToFileSizeString(), p.EnbLEVRAMSize);
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)
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();
var _ = LauncherUpdater.Run();
var _ = updater.Run();
var (settings, loadedSettings) = MainSettings.TryLoadTypicalSettings().AsTask().Result;
// Load settings
/*
if (CLIArguments.NoSettings || !loadedSettings)
{
_settings = new MainSettings {Version = Consts.SettingsVersion};
@ -72,7 +68,7 @@ namespace Wabbajack
{
_settings = settings;
RunWhenLoaded(LoadSettings);
}
}*/
// Set datacontext
_mwvm = new MainWindowVM(this, _settings);
@ -92,8 +88,7 @@ namespace Wabbajack
}
catch (Exception ex)
{
Utils.LogStraightToFile("Error");
Utils.LogStraightToFile(ex.ToString());
_logger.LogError(ex, "During Main Window Startup");
Environment.Exit(-1);
}
}
@ -110,13 +105,6 @@ namespace Wabbajack
/// </summary>
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();
}
@ -125,6 +113,7 @@ namespace Wabbajack
/// </summary>
private void AssociateListsWithWabbajack()
{
/* TODO
var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
try
{
@ -136,7 +125,7 @@ namespace Wabbajack
catch (Exception e)
{
Utils.Log($"ExtensionManager had an exception:\n{e}");
}
}*/
}
private void RunWhenLoaded(Action a)

View File

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

View File

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

View File

@ -1,9 +1,10 @@
using Wabbajack.Lib.Downloaders;

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