diff --git a/Wabbajack.App.Wpf/View Models/GameVM.cs b/Wabbajack.App.Wpf/View Models/GameVM.cs index aa084228..602b0c4d 100644 --- a/Wabbajack.App.Wpf/View Models/GameVM.cs +++ b/Wabbajack.App.Wpf/View Models/GameVM.cs @@ -10,7 +10,7 @@ namespace Wabbajack public GameVM(Game game) { Game = game; - DisplayName = game.ToDescriptionString(); + DisplayName = game.MetaData().HumanFriendlyGameName; } } } diff --git a/Wabbajack.App.Wpf/View Models/MainWindowVM.cs b/Wabbajack.App.Wpf/View Models/MainWindowVM.cs index 8c72be72..4556bed7 100644 --- a/Wabbajack.App.Wpf/View Models/MainWindowVM.cs +++ b/Wabbajack.App.Wpf/View Models/MainWindowVM.cs @@ -1,23 +1,18 @@ -using DynamicData; -using DynamicData.Binding; +using DynamicData.Binding; using ReactiveUI; using ReactiveUI.Fody.Helpers; using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Reactive; -using System.Reactive.Disposables; using System.Reactive.Linq; using System.Reflection; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; -using System.Windows.Threading; -using Alphaleonis.Win32.Filesystem; using Wabbajack.Common; using Wabbajack.Lib; using Wabbajack.Lib.Interventions; +using Wabbajack.Paths; +using Wabbajack.View_Models; namespace Wabbajack { diff --git a/Wabbajack.App.Wpf/View Models/ModListContentsVM.cs b/Wabbajack.App.Wpf/View Models/ModListContentsVM.cs index aa4ab74d..fc338f4d 100644 --- a/Wabbajack.App.Wpf/View Models/ModListContentsVM.cs +++ b/Wabbajack.App.Wpf/View Models/ModListContentsVM.cs @@ -3,12 +3,13 @@ using System.Collections.ObjectModel; using System.Reactive.Disposables; using System.Reactive.Linq; using System.Text.RegularExpressions; -using ReactiveUI.Fody.Helpers; -using Wabbajack.Lib; using DynamicData; using DynamicData.Binding; +using ReactiveUI.Fody.Helpers; +using Wabbajack.Common; +using Wabbajack.DTOs; -namespace Wabbajack +namespace Wabbajack.View_Models { public class ModListContentsVM : BackNavigatingVM { diff --git a/Wabbajack.App.Wpf/View Models/ModVM.cs b/Wabbajack.App.Wpf/View Models/ModVM.cs index ce31c451..fd73cf2b 100644 --- a/Wabbajack.App.Wpf/View Models/ModVM.cs +++ b/Wabbajack.App.Wpf/View Models/ModVM.cs @@ -2,14 +2,15 @@ using System; using System.Reactive.Linq; using System.Windows.Media.Imaging; -using Wabbajack.Common; +using Microsoft.Extensions.Logging; +using Wabbajack.DTOs.DownloadStates; using Wabbajack.Lib; -using Wabbajack.Lib.Downloaders; namespace Wabbajack { public class ModVM : ViewModel { + private readonly ILogger _logger; public IMetaState State { get; } // Image isn't exposed as a direct property, but as an observable. @@ -17,13 +18,14 @@ namespace Wabbajack // and the cached image will automatically be released when the last interested party is gone. public IObservable ImageObservable { get; } - public ModVM(IMetaState state) + public ModVM(ILogger logger, IMetaState state) { + _logger = logger; State = state; - ImageObservable = Observable.Return(State.ImageURL.ToString()) + ImageObservable = Observable.Return(State.ImageURL?.ToString()) .ObserveOn(RxApp.TaskpoolScheduler) - .DownloadBitmapImage((ex) => Utils.Log($"Skipping slide for mod {State.Name}")) + .DownloadBitmapImage(ex => _logger.LogError(ex, "Skipping slide for mod {Name}", State.Name)) .Replay(1) .RefCount(TimeSpan.FromMilliseconds(5000)); } diff --git a/Wabbajack.App.Wpf/View Models/ModeSelectionVM.cs b/Wabbajack.App.Wpf/View Models/ModeSelectionVM.cs index cfd18d6d..a7077bb4 100644 --- a/Wabbajack.App.Wpf/View Models/ModeSelectionVM.cs +++ b/Wabbajack.App.Wpf/View Models/ModeSelectionVM.cs @@ -8,6 +8,7 @@ using System.Reactive.Linq; using System.Windows.Input; using Wabbajack.Common; using Wabbajack.Lib; +using Wabbajack.Paths.IO; namespace Wabbajack { @@ -27,9 +28,9 @@ namespace Wabbajack execute: () => { var path = mainVM.Settings.Installer.LastInstalledListLocation; - if (path == default || !path.Exists) + if (path == default || !path.FileExists()) { - path = UIUtils.OpenFileDialog($"*{Consts.ModListExtension}|*{Consts.ModListExtension}"); + path = UIUtils.OpenFileDialog($"*{Ext.Wabbajack}|*{Ext.Wabbajack}"); } _mainVM.OpenInstaller(path); }); diff --git a/Wabbajack.App.Wpf/Views/MainWindow.xaml b/Wabbajack.App.Wpf/Views/MainWindow.xaml index 05234e87..1bf8d618 100644 --- a/Wabbajack.App.Wpf/Views/MainWindow.xaml +++ b/Wabbajack.App.Wpf/Views/MainWindow.xaml @@ -7,6 +7,7 @@ xmlns:local="clr-namespace:Wabbajack" xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:viewModels="clr-namespace:Wabbajack.View_Models" Title="Wabbajack" Width="1280" Height="960" @@ -40,7 +41,7 @@ - + diff --git a/Wabbajack.App.Wpf/Views/ModListContentsView.xaml b/Wabbajack.App.Wpf/Views/ModListContentsView.xaml index cb7a3b38..6d20a6d7 100644 --- a/Wabbajack.App.Wpf/Views/ModListContentsView.xaml +++ b/Wabbajack.App.Wpf/Views/ModListContentsView.xaml @@ -7,7 +7,8 @@ xmlns:local="clr-namespace:Wabbajack" xmlns:rxui="http://reactiveui.net" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks" - x:TypeArguments="local:ModListContentsVM" + xmlns:viewModels="clr-namespace:Wabbajack.View_Models" + x:TypeArguments="viewModels:ModListContentsVM" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> diff --git a/Wabbajack.Common/StringExtensions.cs b/Wabbajack.Common/StringExtensions.cs index 54283c80..489beec2 100644 --- a/Wabbajack.Common/StringExtensions.cs +++ b/Wabbajack.Common/StringExtensions.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using System.Security.Cryptography; using System.Text; @@ -18,4 +19,9 @@ public static class StringExtensions return sha.Hash!.ToHex(); } + + public static bool ContainsCaseInsensitive(this string src, string contains) + { + return src.Contains(contains, StringComparison.InvariantCultureIgnoreCase); + } } \ No newline at end of file