diff --git a/Wabbajack.App.Wpf/LoginManagers/LoversLabLoginManager.cs b/Wabbajack.App.Wpf/LoginManagers/LoversLabLoginManager.cs index 1fd6e5d1..985fec98 100644 --- a/Wabbajack.App.Wpf/LoginManagers/LoversLabLoginManager.cs +++ b/Wabbajack.App.Wpf/LoginManagers/LoversLabLoginManager.cs @@ -14,7 +14,6 @@ using ReactiveUI; using ReactiveUI.Fody.Helpers; using Wabbajack.Common; using Wabbajack.Downloaders.IPS4OAuth2Downloader; -using Wabbajack.DTOs.Interventions; using Wabbajack.DTOs.Logins; using Wabbajack.Messages; using Wabbajack.Networking.Http.Interfaces; @@ -26,7 +25,6 @@ public class LoversLabLoginManager : ViewModel, ILoginFor { private readonly ILogger _logger; private readonly ITokenProvider _token; - private readonly IUserInterventionHandler _handler; private readonly IServiceProvider _serviceProvider; public string SiteName { get; } = "Lovers Lab"; diff --git a/Wabbajack.App.Wpf/LoginManagers/NexusLoginManager.cs b/Wabbajack.App.Wpf/LoginManagers/NexusLoginManager.cs index db4823d2..a7115a76 100644 --- a/Wabbajack.App.Wpf/LoginManagers/NexusLoginManager.cs +++ b/Wabbajack.App.Wpf/LoginManagers/NexusLoginManager.cs @@ -9,7 +9,6 @@ using Microsoft.Extensions.Logging; using ReactiveUI; using ReactiveUI.Fody.Helpers; using Wabbajack.Downloaders; -using Wabbajack.DTOs.Interventions; using Wabbajack.DTOs.Logins; using Wabbajack.Messages; using Wabbajack.Networking.Http.Interfaces; @@ -21,7 +20,6 @@ public class NexusLoginManager : ViewModel, ILoginFor { private readonly ILogger _logger; private readonly ITokenProvider _token; - private readonly IUserInterventionHandler _handler; private readonly IServiceProvider _serviceProvider; public string SiteName { get; } = "Nexus Mods"; diff --git a/Wabbajack.App.Wpf/LoginManagers/VectorPlexusLoginManager.cs b/Wabbajack.App.Wpf/LoginManagers/VectorPlexusLoginManager.cs index 07e6e703..9e8f691d 100644 --- a/Wabbajack.App.Wpf/LoginManagers/VectorPlexusLoginManager.cs +++ b/Wabbajack.App.Wpf/LoginManagers/VectorPlexusLoginManager.cs @@ -13,7 +13,6 @@ using ReactiveUI; using ReactiveUI.Fody.Helpers; using Wabbajack.Common; using Wabbajack.Downloaders.IPS4OAuth2Downloader; -using Wabbajack.DTOs.Interventions; using Wabbajack.DTOs.Logins; using Wabbajack.Messages; using Wabbajack.Networking.Http.Interfaces; @@ -25,7 +24,6 @@ public class VectorPlexusLoginManager : ViewModel, ILoginFor _logger; private readonly ITokenProvider _token; - private readonly IUserInterventionHandler _handler; private readonly IServiceProvider _serviceProvider; public string SiteName { get; } = "Vector Plexus"; diff --git a/Wabbajack.App.Wpf/UserIntervention/WebUserInterventionBase.cs b/Wabbajack.App.Wpf/UserIntervention/WebUserInterventionBase.cs index 28e764a5..7ca60497 100644 --- a/Wabbajack.App.Wpf/UserIntervention/WebUserInterventionBase.cs +++ b/Wabbajack.App.Wpf/UserIntervention/WebUserInterventionBase.cs @@ -5,16 +5,11 @@ using System.Threading; using System.Threading.Tasks; using System.Web; using HtmlAgilityPack; -using Microsoft.Extensions.Logging; using Microsoft.Web.WebView2.Core; -using Microsoft.Web.WebView2.Wpf; using ReactiveUI.Fody.Helpers; using Wabbajack.DTOs.Interventions; using Wabbajack.DTOs.Logins; -using Wabbajack.Interventions; -using Wabbajack.Models; using Wabbajack.Views; -using Wabbajack.WebAutomation; namespace Wabbajack.UserIntervention; diff --git a/Wabbajack.App.Wpf/View Models/BrowserWindowViewModel.cs b/Wabbajack.App.Wpf/View Models/BrowserWindowViewModel.cs index 55791505..b74cdd99 100644 --- a/Wabbajack.App.Wpf/View Models/BrowserWindowViewModel.cs +++ b/Wabbajack.App.Wpf/View Models/BrowserWindowViewModel.cs @@ -119,7 +119,7 @@ public abstract class BrowserWindowViewModel : ViewModel source.SetResult(new Uri(args.DownloadOperation.Uri)); } - catch (Exception ex) + catch (Exception) { source.SetCanceled(); } @@ -170,7 +170,7 @@ public abstract class BrowserWindowViewModel : ViewModel source.TrySetResult(); }; } - catch (Exception ex) + catch (Exception) { source.SetCanceled(); } diff --git a/Wabbajack.App.Wpf/View Models/Compilers/MO2CompilerVM.cs b/Wabbajack.App.Wpf/View Models/Compilers/MO2CompilerVM.cs index 0939db86..b9f708ae 100644 --- a/Wabbajack.App.Wpf/View Models/Compilers/MO2CompilerVM.cs +++ b/Wabbajack.App.Wpf/View Models/Compilers/MO2CompilerVM.cs @@ -1,5 +1,4 @@ using Microsoft.WindowsAPICodePack.Dialogs; -using ReactiveUI; using ReactiveUI.Fody.Helpers; using System; using System.Reactive.Disposables; @@ -12,7 +11,6 @@ using Wabbajack.DTOs; using Wabbajack.DTOs.GitHub; using Wabbajack; using Wabbajack.Extensions; -using Wabbajack.Paths; using Wabbajack.Paths.IO; using Consts = Wabbajack.Consts; @@ -22,14 +20,6 @@ namespace Wabbajack { public CompilerVM Parent { get; } - private readonly MO2CompilationSettings _settings; - - private readonly ObservableAsPropertyHelper _mo2Folder; - public AbsolutePath Mo2Folder => _mo2Folder.Value; - - private readonly ObservableAsPropertyHelper _moProfile; - public string MOProfile => _moProfile.Value; - public FilePickerVM DownloadLocation { get; } public FilePickerVM ModListLocation { get; } diff --git a/Wabbajack.App.Wpf/View Models/Gallery/ModListGalleryVM.cs b/Wabbajack.App.Wpf/View Models/Gallery/ModListGalleryVM.cs index 18eb2448..a625bb77 100644 --- a/Wabbajack.App.Wpf/View Models/Gallery/ModListGalleryVM.cs +++ b/Wabbajack.App.Wpf/View Models/Gallery/ModListGalleryVM.cs @@ -46,7 +46,6 @@ namespace Wabbajack public List GameTypeEntries => GetGameTypeEntries(); - private ObservableAsPropertyHelper _Loaded; private readonly Client _wjClient; private readonly ILogger _logger; private readonly GameLocator _locator; diff --git a/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs b/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs index eaccbfad..a74a6f81 100644 --- a/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs +++ b/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs @@ -108,14 +108,12 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM public string SlideShowDescription { get; set; } - private readonly ObservableAsPropertyHelper _installing; private readonly DTOSerializer _dtos; private readonly ILogger _logger; private readonly SettingsManager _settingsManager; private readonly IServiceProvider _serviceProvider; private readonly SystemParametersConstructor _parametersConstructor; private readonly IGameLocator _gameLocator; - private readonly LogStream _loggerProvider; private readonly ResourceMonitor _resourceMonitor; private readonly Services.OSIntegrated.Configuration _configuration; private readonly HttpClient _client; diff --git a/Wabbajack.App.Wpf/View Models/ModeSelectionVM.cs b/Wabbajack.App.Wpf/View Models/ModeSelectionVM.cs index 98fee019..77ca9085 100644 --- a/Wabbajack.App.Wpf/View Models/ModeSelectionVM.cs +++ b/Wabbajack.App.Wpf/View Models/ModeSelectionVM.cs @@ -15,7 +15,6 @@ namespace Wabbajack { public class ModeSelectionVM : ViewModel { - private MainWindowVM _mainVM; public ICommand BrowseCommand { get; } public ICommand InstallCommand { get; } public ICommand CompileCommand { get; } diff --git a/Wabbajack.App.Wpf/View Models/Settings/AuthorFilesVM.cs b/Wabbajack.App.Wpf/View Models/Settings/AuthorFilesVM.cs index 7294e15a..4b909dce 100644 --- a/Wabbajack.App.Wpf/View Models/Settings/AuthorFilesVM.cs +++ b/Wabbajack.App.Wpf/View Models/Settings/AuthorFilesVM.cs @@ -15,8 +15,6 @@ namespace Wabbajack.View_Models.Settings { public class AuthorFilesVM : BackNavigatingVM { - private readonly ObservableAsPropertyHelper _isVisible; - [Reactive] public Visibility IsVisible { get; set; } diff --git a/Wabbajack.App.Wpf/View Models/Settings/CredentialsLoginVM.cs b/Wabbajack.App.Wpf/View Models/Settings/CredentialsLoginVM.cs deleted file mode 100644 index 0139161f..00000000 --- a/Wabbajack.App.Wpf/View Models/Settings/CredentialsLoginVM.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Net.Mail; -using System.Reactive.Linq; -using System.Security; -using System.Threading.Tasks; -using ReactiveUI; -using ReactiveUI.Fody.Helpers; -using Wabbajack.Downloaders.Interfaces; -using Wabbajack; - -namespace Wabbajack -{ - public class CredentialsLoginVM : ViewModel - { - [Reactive] - public string Username { get; set; } - - [Reactive] - public string MFAKey { get; set; } - - - [Reactive] - public object ReturnMessage { get; set; } - - [Reactive] - public bool LoggingIn { get; private set; } - - private readonly ObservableAsPropertyHelper _loginEnabled; - public bool LoginEnabled => _loginEnabled.Value; - - private readonly ObservableAsPropertyHelper _mfaVisible; - public bool MFAVisible => _mfaVisible.Value; - - private readonly object _downloader; - - public CredentialsLoginVM(INeedsLoginCredentials downloader) - { - _downloader = downloader; - - _loginEnabled = this.WhenAny(x => x.Username) - .Select(IsValidAddress) - .CombineLatest( - this.WhenAny(x => x.LoggingIn), - (valid, loggingIn) => - { - return valid && !loggingIn; - }) - .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; - - if (password == null || password.Length == 0) - { - ReturnMessage = new LoginReturnMessage("You need to input a password!", LoginReturnCode.BadInput); - return; - } - - ReturnMessage = await _downloader.LoginWithCredentials(Username, password, string.IsNullOrWhiteSpace(MFAKey) ? null : MFAKey); - password.Clear(); - } - catch (Exception e) - { - Utils.Error(e, "Exception while trying to login"); - ReturnMessage = new LoginReturnMessage($"Unhandled exception: {e.Message}", LoginReturnCode.InternalError); - } - finally - { - LoggingIn = false; - } - */ - } - - private static bool IsValidAddress(string s) - { - if (string.IsNullOrWhiteSpace(s)) - return false; - - try - { - var _ = new MailAddress(s); - } - catch (Exception) - { - return false; - } - - return true; - } - } -} diff --git a/Wabbajack.App.Wpf/Views/MainWindow.xaml b/Wabbajack.App.Wpf/Views/MainWindow.xaml index ede00b87..6de5d198 100644 --- a/Wabbajack.App.Wpf/Views/MainWindow.xaml +++ b/Wabbajack.App.Wpf/Views/MainWindow.xaml @@ -97,6 +97,6 @@ - + \ No newline at end of file diff --git a/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs b/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs index 10abf269..3c7de123 100644 --- a/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs +++ b/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs @@ -66,9 +66,9 @@ namespace Wabbajack .ObserveOnGuiThread() .Subscribe(u => { - TaskbarItemInfo.Description = u.Description; - TaskbarItemInfo.ProgressValue = u.ProgressValue; - TaskbarItemInfo.ProgressState = u.State; + TaskbarItemInfoControl.Description = u.Description; + TaskbarItemInfoControl.ProgressValue = u.ProgressValue; + TaskbarItemInfoControl.ProgressState = u.State; }); @@ -84,7 +84,7 @@ namespace Wabbajack p.SystemMemorySize.ToFileSizeString(), p.SystemPageSize.ToFileSizeString(), p.ScreenWidth, p.ScreenHeight, p.VideoMemorySize.ToFileSizeString(), p.EnbLEVRAMSize); if (p.SystemPageSize == 0) - _logger.LogInformation("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) _logger.LogInformation("Pagefile below recommended! Consider increasing to 20000MB. A suboptimal pagefile can cause crashes and poor in-game performance"); diff --git a/Wabbajack.App.Wpf/Views/Settings/CredentialsLoginView.xaml b/Wabbajack.App.Wpf/Views/Settings/CredentialsLoginView.xaml deleted file mode 100644 index c069fbf7..00000000 --- a/Wabbajack.App.Wpf/Views/Settings/CredentialsLoginView.xaml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - Email: - - - - - Password: - - - - - MFA Key: - - - - - - - - diff --git a/Wabbajack.App.Wpf/Views/Settings/CredentialsLoginView.xaml.cs b/Wabbajack.App.Wpf/Views/Settings/CredentialsLoginView.xaml.cs deleted file mode 100644 index 16fcd701..00000000 --- a/Wabbajack.App.Wpf/Views/Settings/CredentialsLoginView.xaml.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Reactive.Disposables; -using System.Windows; -using ReactiveUI; - -namespace Wabbajack -{ - public partial class CredentialsLoginView - { - public INeedsLoginCredentials Downloader { get; set; } - - public CredentialsLoginView(INeedsLoginCredentials downloader) - { - Downloader = downloader; - - if (ViewModel == null) - ViewModel = new CredentialsLoginVM(downloader); - - InitializeComponent(); - - this.WhenActivated(disposable => - { - this.Bind(ViewModel, x => x.Username, x => x.Username.Text) - .DisposeWith(disposable); - this.Bind(ViewModel, x => x.LoginEnabled, x => x.LoginButton.IsEnabled) - .DisposeWith(disposable); - this.Bind(ViewModel, x => x.MFAKey, x => x.MFA.Text) - .DisposeWith(disposable); - this.OneWayBind(ViewModel, x => x.MFAVisible, x => x.MFA.Visibility) - .DisposeWith(disposable); - this.OneWayBind(ViewModel, x => x.MFAVisible, x => x.MFAText.Visibility) - .DisposeWith(disposable); - /* TODO - this.OneWayBind(ViewModel, x => x.ReturnMessage.Message, x => x.Message.Text) - .DisposeWith(disposable); - */ - }); - } - - private async void LoginButton_OnClick(object sender, RoutedEventArgs e) - { - //ViewModel.Login(Password.SecurePassword).FireAndForget(); - } - } -} diff --git a/Wabbajack.App.Wpf/Views/Settings/MiscSettingsView.xaml.cs b/Wabbajack.App.Wpf/Views/Settings/MiscSettingsView.xaml.cs index 1f0e5a88..298a195a 100644 --- a/Wabbajack.App.Wpf/Views/Settings/MiscSettingsView.xaml.cs +++ b/Wabbajack.App.Wpf/Views/Settings/MiscSettingsView.xaml.cs @@ -1,22 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reactive.Disposables; -using System.Reactive.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; +using System.Reactive.Disposables; using ReactiveUI; -using Wabbajack.Common; -using Wabbajack.WebAutomation; namespace Wabbajack { @@ -39,8 +22,6 @@ namespace Wabbajack this.WhenAnyValue(x => x.ViewModel.OpenTerminalCommand) .BindToStrict(this, x => x.OpenTerminal.Command) .DisposeWith(disposable); - - this.ClearCefCache.Click += (sender, args) => {Driver.ClearCache();}; }); } } diff --git a/Wabbajack.App.Wpf/WebAutomation/IWebDriver.cs b/Wabbajack.App.Wpf/WebAutomation/IWebDriver.cs deleted file mode 100644 index 94ad17e3..00000000 --- a/Wabbajack.App.Wpf/WebAutomation/IWebDriver.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Wabbajack.DTOs.Logins; - -namespace Wabbajack.WebAutomation -{ - public interface IWebDriver - { - Task NavigateTo(Uri uri, CancellationToken? token = null); - Task EvaluateJavaScript(string text); - Task GetCookies(string domainPrefix); - public Action? DownloadHandler { get; set; } - public Task WaitForInitialized(); - ISchemeHandler WithSchemeHandler(Predicate wabbajack); - } - - public interface ISchemeHandler : IDisposable - { - public Task Task { get; } - } -} diff --git a/Wabbajack.App.Wpf/WebAutomation/WebAutomation.cs b/Wabbajack.App.Wpf/WebAutomation/WebAutomation.cs deleted file mode 100644 index d7e5ad68..00000000 --- a/Wabbajack.App.Wpf/WebAutomation/WebAutomation.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using HtmlAgilityPack; -using Microsoft.Extensions.Logging; -using Wabbajack.Models; -using Wabbajack.Paths; -using Wabbajack.Paths.IO; - -namespace Wabbajack.WebAutomation -{ - public class Driver : IDisposable - { - //private readonly IWebBrowser _browser; - private readonly dynamic _driver; - - public Driver(ILogger logger, CefService service) - { - - //_browser = new ChromiumWebBrowser(); - //_driver = new CefSharpWrapper(logger, _browser, service); - } - public async Task NavigateTo(Uri uri, CancellationToken? token = null) - { - try - { - //await _driver.NavigateTo(uri, token); - return await GetLocation(); - } - catch (TaskCanceledException ex) - { - await DumpState(uri, ex); - throw; - } - } - - private async Task DumpState(Uri uri, Exception ex) - { - var file = KnownFolders.EntryPoint.Combine("CEFStates", DateTime.UtcNow.ToFileTimeUtc().ToString()) - .WithExtension(new Extension(".html")); - file.Parent.CreateDirectory(); - var source = await GetSourceAsync(); - //var cookies = await Helpers.GetCookies(); - //var cookiesString = string.Join('\n', cookies.Select(c => c.Name + " - " + c.Value)); - //await file.WriteAllTextAsync(uri + "\n " + source + "\n" + ex + "\n" + cookiesString); - } - - public async Task NavigateToAndDownload(Uri uri, AbsolutePath absolutePath, bool quickMode = false, CancellationToken? token = null) - { - try - { - //return await _driver.NavigateToAndDownload(uri, absolutePath, quickMode: quickMode, token: token); - return 0; - } - catch (TaskCanceledException ex) { - await DumpState(uri, ex); - throw; - } - } - - public async ValueTask GetLocation() - { - /* - try - { - return new Uri(_browser.Address); - } - catch (UriFormatException) - { - return null; - }*/ - return null; - } - - public async ValueTask GetSourceAsync() - { - //return await _browser.GetSourceAsync(); - return ""; - } - - public async ValueTask GetHtmlAsync() - { - var body = await GetSourceAsync(); - var doc = new HtmlDocument(); - doc.LoadHtml(body); - return doc; - } - - public Action DownloadHandler { - set => _driver.DownloadHandler = value; - } - - public Task GetAttr(string selector, string attr) - { - return _driver.EvaluateJavaScript($"document.querySelector(\"{selector}\").{attr}"); - } - - public Task EvalJavascript(string js) - { - return _driver.EvaluateJavaScript(js); - } - - public void Dispose() - { - //_browser.Dispose(); - } - - public static void ClearCache() - { - //Helpers.ClearCookies(); - } - - public async Task DeleteCookiesWhere(Func filter) - { - //await Helpers.DeleteCookiesWhere(filter); - } - } -} diff --git a/Wabbajack.Downloaders.Dispatcher.Test/DownloaderTests.cs b/Wabbajack.Downloaders.Dispatcher.Test/DownloaderTests.cs index 5eba9549..9f0598a9 100644 --- a/Wabbajack.Downloaders.Dispatcher.Test/DownloaderTests.cs +++ b/Wabbajack.Downloaders.Dispatcher.Test/DownloaderTests.cs @@ -10,7 +10,6 @@ using Wabbajack.DTOs.DownloadStates; using Wabbajack.Hashing.xxHash64; using Wabbajack.Installer; using Wabbajack.Paths.IO; -using Wabbajack.Services.OSIntegrated; using Xunit; namespace Wabbajack.Downloaders.Dispatcher.Test; diff --git a/Wabbajack.Services.OSIntegrated/ResourceSettingsManager.cs b/Wabbajack.Services.OSIntegrated/ResourceSettingsManager.cs index 72050732..ca61b33a 100644 --- a/Wabbajack.Services.OSIntegrated/ResourceSettingsManager.cs +++ b/Wabbajack.Services.OSIntegrated/ResourceSettingsManager.cs @@ -1,12 +1,9 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; -using Wabbajack.RateLimiter; -using Wabbajack.Services.OSIntegrated; -namespace Wabbajack.App.Models; +namespace Wabbajack.Services.OSIntegrated; public class ResourceSettingsManager { diff --git a/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs b/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs index 19e01ae6..0b2703e4 100644 --- a/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs +++ b/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs @@ -7,7 +7,6 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Wabbajack.App.Models; using Wabbajack.Compiler; using Wabbajack.Downloaders; using Wabbajack.Downloaders.GameFile;