diff --git a/Wabbajack.App/Controls/ResourceView.axaml b/Wabbajack.App/Controls/ResourceView.axaml index 3097a736..1fdc9cca 100644 --- a/Wabbajack.App/Controls/ResourceView.axaml +++ b/Wabbajack.App/Controls/ResourceView.axaml @@ -4,13 +4,14 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Wabbajack.App.Controls.ResourceView"> - - - - - - - - - + + + Total Throughput: + + Tasks: + + Throughput: + + + \ No newline at end of file diff --git a/Wabbajack.App/Controls/ResourceView.axaml.cs b/Wabbajack.App/Controls/ResourceView.axaml.cs index bcf518de..ffb29248 100644 --- a/Wabbajack.App/Controls/ResourceView.axaml.cs +++ b/Wabbajack.App/Controls/ResourceView.axaml.cs @@ -15,10 +15,20 @@ public partial class ResourceView : ReactiveUserControl, IAct this.OneWayBind(ViewModel, vm => vm.Name, view => view.ResourceName.Text) .DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.MaxTasks, view => view.MaxTasks.Text) - .DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.MaxThroughput, view => view.MaxThroughput.Text) - .DisposeWith(disposables); + //this.Bind(ViewModel, vm => vm.MaxTasks, view => view.MaxTasks.Text) + // .DisposeWith(disposables); + /*this.Bind(ViewModel, vm => vm.MaxThroughput, view => view.MaxThroughput.Text, + l => l is 0 or long.MaxValue ? "∞" : (l / 1024 / 1024).ToString(), + v => + { + v = v.Trim(); + if (v is "0" or "∞" || v == long.MaxValue.ToString()) + { + return long.MaxValue; + } + return long.TryParse(v, out var l) ? l * 1024 * 1024 : long.MaxValue; + }) + .DisposeWith(disposables);*/ this.OneWayBind(ViewModel, vm => vm.CurrentThroughput, view => view.CurrentThrougput.Text, val => val.FileSizeToString()) diff --git a/Wabbajack.App/Screens/LauncherView.axaml b/Wabbajack.App/Screens/LauncherView.axaml index b1dd6f62..1aadfd0e 100644 --- a/Wabbajack.App/Screens/LauncherView.axaml +++ b/Wabbajack.App/Screens/LauncherView.axaml @@ -24,9 +24,9 @@ - - - + + + .DisposeWith(disposables); }); } + + private void ShowWebsite(object? sender, RoutedEventArgs e) + { + OSUtil.OpenWebsite(ViewModel!.Setting!.StrippedModListData?.Website!); + } + + private void ShowReadme(object? sender, RoutedEventArgs e) + { + OSUtil.OpenWebsite(new Uri(ViewModel!.Setting!.StrippedModListData?.Readme!)); + } + + private void ShowLocalFiles(object? sender, RoutedEventArgs e) + { + OSUtil.OpenFolder(ViewModel!.Setting!.Install); + } } \ No newline at end of file diff --git a/Wabbajack.App/Screens/StandardInstallationViewModel.cs b/Wabbajack.App/Screens/StandardInstallationViewModel.cs index 72da3c17..855c8c80 100644 --- a/Wabbajack.App/Screens/StandardInstallationViewModel.cs +++ b/Wabbajack.App/Screens/StandardInstallationViewModel.cs @@ -225,7 +225,8 @@ public class StandardInstallationViewModel : ViewModelBase Install = config.Install, Metadata = config.Metadata, ModList = config.ModlistArchive, - Image = path + Image = path, + StrippedModListData = config.ModList.Strip() }); MessageBus.Current.SendMessage(new ConfigureLauncher(config.Install)); diff --git a/Wabbajack.App/Utilities/OSUtil.cs b/Wabbajack.App/Utilities/OSUtil.cs new file mode 100644 index 00000000..7c0777c4 --- /dev/null +++ b/Wabbajack.App/Utilities/OSUtil.cs @@ -0,0 +1,38 @@ +using System; +using System.Runtime.InteropServices; +using Microsoft.CodeAnalysis; +using Wabbajack.Common; +using Wabbajack.Paths; +using Wabbajack.Paths.IO; + +namespace Wabbajack.App.Utilities; + +public static class OSUtil +{ + public static void OpenWebsite(Uri uri) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + var helper = new ProcessHelper() + { + Path = "cmd.exe".ToRelativePath().RelativeTo(KnownFolders.WindowsSystem32), + Arguments = new[] {"/C", $"rundll32 url.dll,FileProtocolHandler {uri}"} + }; + helper.Start().FireAndForget(); + } + + } + + public static void OpenFolder(AbsolutePath path) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + var helper = new ProcessHelper() + { + Path = "explorer.exe".ToRelativePath().RelativeTo(KnownFolders.Windows), + Arguments = new object[] {path} + }; + helper.Start().FireAndForget(); + } + } +} \ No newline at end of file diff --git a/Wabbajack.App/ViewModels/InstallConfigurationViewModel.cs b/Wabbajack.App/ViewModels/InstallConfigurationViewModel.cs index 589ff0ab..8552b32c 100644 --- a/Wabbajack.App/ViewModels/InstallConfigurationViewModel.cs +++ b/Wabbajack.App/ViewModels/InstallConfigurationViewModel.cs @@ -124,7 +124,8 @@ public class InstallConfigurationViewModel : ViewModelBase, IActivatableViewMode ModList = ModListPath, Downloads = Download, Install = Install, - Metadata = metadata + Metadata = metadata, + StrippedModListData = ModList?.Strip() }); await _settingsManager.Save("last-install-path", ModListPath); diff --git a/Wabbajack.App/ViewModels/NexusLoginViewModel.cs b/Wabbajack.App/ViewModels/NexusLoginViewModel.cs index f5ec6ad4..a6cc7ee2 100644 --- a/Wabbajack.App/ViewModels/NexusLoginViewModel.cs +++ b/Wabbajack.App/ViewModels/NexusLoginViewModel.cs @@ -97,5 +97,7 @@ public class NexusLoginViewModel : GuidedWebViewModel Cookies = cookies, ApiKey = key }); + + MessageBus.Current.SendMessage(new NavigateBack()); } } \ No newline at end of file diff --git a/Wabbajack.App/ViewModels/OAuthLoginViewModel.cs b/Wabbajack.App/ViewModels/OAuthLoginViewModel.cs index f3b9d519..91ec3b3e 100644 --- a/Wabbajack.App/ViewModels/OAuthLoginViewModel.cs +++ b/Wabbajack.App/ViewModels/OAuthLoginViewModel.cs @@ -9,8 +9,11 @@ using System.Web; using CefNet; using Microsoft.Extensions.Logging; using Wabbajack.App.Extensions; +using Wabbajack.App.Messages; using Wabbajack.DTOs.Logins; using Wabbajack.Services.OSIntegrated; +using Xunit.Sdk; +using MessageBus = ReactiveUI.MessageBus; namespace Wabbajack.App.ViewModels; @@ -87,6 +90,8 @@ public abstract class OAuthLoginViewModel : GuidedWebViewModel Cookies = cookies, ResultState = data! }); + + MessageBus.Current.SendMessage(new NavigateBack()); } private class AsyncSchemeHandler : CefSchemeHandlerFactory diff --git a/Wabbajack.DTOs/ModList/ModList.cs b/Wabbajack.DTOs/ModList/ModList.cs index e8409cb1..3f95355d 100644 --- a/Wabbajack.DTOs/ModList/ModList.cs +++ b/Wabbajack.DTOs/ModList/ModList.cs @@ -66,4 +66,20 @@ public class ModList /// Whether the Modlist is NSFW or not /// public bool IsNSFW { get; set; } + + public ModList Strip() + { + return new ModList + { + Author = Author, + Description = Description, + GameType = GameType, + Name = Name, + Readme = Readme, + WabbajackVersion = WabbajackVersion, + Website = Website, + Version = Version, + IsNSFW = IsNSFW, + }; + } } \ No newline at end of file diff --git a/Wabbajack.DTOs/SavedSettings/InstallationSettings.cs b/Wabbajack.DTOs/SavedSettings/InstallationSettings.cs index 5c5f50de..eaeee715 100644 --- a/Wabbajack.DTOs/SavedSettings/InstallationSettings.cs +++ b/Wabbajack.DTOs/SavedSettings/InstallationSettings.cs @@ -20,5 +20,5 @@ public class InstallationConfigurationSetting public ModlistMetadata? Metadata { get; set; } public AbsolutePath Image { get; set; } - + public ModList? StrippedModListData { get; set; } } \ No newline at end of file diff --git a/Wabbajack.Paths.IO/KnownFolders.cs b/Wabbajack.Paths.IO/KnownFolders.cs index f91c71a8..dfe1ad84 100644 --- a/Wabbajack.Paths.IO/KnownFolders.cs +++ b/Wabbajack.Paths.IO/KnownFolders.cs @@ -11,6 +11,9 @@ public static class KnownFolders public static AbsolutePath AppDataLocal => Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).ToAbsolutePath(); + public static AbsolutePath WindowsSystem32 => Environment.GetFolderPath(Environment.SpecialFolder.System).ToAbsolutePath(); + public static AbsolutePath WabbajackAppLocal => AppDataLocal.Combine("Wabbajack"); public static AbsolutePath CurrentDirectory => Directory.GetCurrentDirectory().ToAbsolutePath(); + public static AbsolutePath Windows => Environment.GetFolderPath(Environment.SpecialFolder.Windows).ToAbsolutePath(); } \ No newline at end of file