Merge Wabbajack.Lib into Wabbajack

This commit is contained in:
Timothy Baldridge 2021-12-29 17:15:37 -07:00
parent a9de61dc9f
commit cc8c40f803
84 changed files with 250 additions and 338 deletions

View File

@ -4,7 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Services.OSIntegrated; using Wabbajack.Services.OSIntegrated;
using Wabbajack.Util; using Wabbajack.Util;

View File

@ -1,7 +1,7 @@
using System; using System;
using Wabbajack.Paths; using Wabbajack.Paths;
namespace Wabbajack.Lib; namespace Wabbajack;
public static class Consts public static class Consts
{ {

View File

@ -9,8 +9,8 @@ using System.Threading.Tasks;
using DynamicData; using DynamicData;
using DynamicData.Kernel; using DynamicData.Kernel;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Lib.Extensions; using Wabbajack.Extensions;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -5,7 +5,7 @@ using System.Reactive.Disposables;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Wabbajack.Lib.Extensions namespace Wabbajack.Extensions
{ {
public static class RxExt public static class RxExt
{ {

View File

@ -1,6 +1,6 @@
using System; using System;
namespace Wabbajack.Lib.Interventions namespace Wabbajack.Interventions
{ {
public abstract class AErrorMessage : Exception, IException public abstract class AErrorMessage : Exception, IException
{ {

View File

@ -6,9 +6,9 @@ using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Lib.Interventions; using Wabbajack.Interventions;
namespace Wabbajack.Lib namespace Wabbajack
{ {
public abstract class AUserIntervention : ReactiveObject, IUserIntervention public abstract class AUserIntervention : ReactiveObject, IUserIntervention
{ {

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using ReactiveUI; using ReactiveUI;
namespace Wabbajack.Lib namespace Wabbajack
{ {
public abstract class ConfirmationIntervention : AUserIntervention public abstract class ConfirmationIntervention : AUserIntervention
{ {

View File

@ -1,4 +1,4 @@
namespace Wabbajack.Lib.Interventions namespace Wabbajack.Interventions
{ {
public interface IError : IStatusMessage public interface IError : IStatusMessage
{ {

View File

@ -1,6 +1,6 @@
using System; using System;
namespace Wabbajack.Lib.Interventions namespace Wabbajack.Interventions
{ {
public interface IException : IError public interface IException : IError
{ {

View File

@ -1,6 +1,6 @@
using System; using System;
namespace Wabbajack.Lib.Interventions namespace Wabbajack.Interventions
{ {
public interface IStatusMessage public interface IStatusMessage
{ {

View File

@ -1,6 +1,6 @@
using ReactiveUI; using ReactiveUI;
namespace Wabbajack.Lib.Interventions namespace Wabbajack.Interventions
{ {
/// <summary> /// <summary>
/// Defines a message that requires user interaction. The user must perform some action /// Defines a message that requires user interaction. The user must perform some action

View File

@ -19,7 +19,7 @@ using Wabbajack.Paths;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;
using Wabbajack.RateLimiter; using Wabbajack.RateLimiter;
namespace Wabbajack.Lib namespace Wabbajack
{ {
public class LauncherUpdater public class LauncherUpdater
{ {

View File

@ -12,7 +12,7 @@ using Wabbajack.Common;
using Wabbajack.DTOs.JsonConverters; using Wabbajack.DTOs.JsonConverters;
using Cookie = CefSharp.Cookie; using Cookie = CefSharp.Cookie;
namespace Wabbajack.Lib.LibCefHelpers namespace Wabbajack.LibCefHelpers
{ {
public static class Helpers public static class Helpers
{ {

View File

@ -1,5 +1,5 @@
using ReactiveUI; using ReactiveUI;
using Wabbajack.Lib; using Wabbajack;
namespace Wabbajack.Messages; namespace Wabbajack.Messages;

View File

@ -6,9 +6,9 @@ using System.Threading.Tasks;
using Newtonsoft.Json; using Newtonsoft.Json;
using Wabbajack.Compiler; using Wabbajack.Compiler;
using Wabbajack.DTOs.JsonConverters; using Wabbajack.DTOs.JsonConverters;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Paths; using Wabbajack.Paths;
using Consts = Wabbajack.Lib.Consts; using Consts = Wabbajack.Consts;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -1,6 +1,6 @@
using Wabbajack.Paths; using Wabbajack.Paths;
namespace Wabbajack.Lib namespace Wabbajack
{ {
public class ConfirmUpdateOfExistingInstall : ConfirmationIntervention public class ConfirmUpdateOfExistingInstall : ConfirmationIntervention
{ {

View File

@ -1,8 +1,8 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Lib.Interventions; using Wabbajack.Interventions;
namespace Wabbajack.Lib namespace Wabbajack
{ {
/// <summary> /// <summary>
/// This should probably be replaced with an error, but this is just to get messageboxes out of the .Lib library /// This should probably be replaced with an error, but this is just to get messageboxes out of the .Lib library

View File

@ -3,7 +3,7 @@ using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Wabbajack.DTOs.DownloadStates; using Wabbajack.DTOs.DownloadStates;
namespace Wabbajack.Lib namespace Wabbajack
{ {
public class ManuallyDownloadFile : AUserIntervention public class ManuallyDownloadFile : AUserIntervention
{ {

View File

@ -2,7 +2,7 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Wabbajack.DTOs.DownloadStates; using Wabbajack.DTOs.DownloadStates;
namespace Wabbajack.Lib namespace Wabbajack
{ {
public class ManuallyDownloadNexusFile : AUserIntervention public class ManuallyDownloadNexusFile : AUserIntervention
{ {

View File

@ -1,6 +1,6 @@
using Wabbajack.Lib.Interventions; using Wabbajack.Interventions;
namespace Wabbajack.Lib namespace Wabbajack
{ {
public class NexusAPIQuotaExceeded : AErrorMessage public class NexusAPIQuotaExceeded : AErrorMessage
{ {

View File

@ -1,6 +1,6 @@
using Wabbajack.Common; using Wabbajack.Common;
namespace Wabbajack.Lib namespace Wabbajack
{ {
public class YesNoIntervention : ConfirmationIntervention public class YesNoIntervention : ConfirmationIntervention
{ {

View File

@ -3,14 +3,11 @@ using Microsoft.WindowsAPICodePack.Dialogs;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using System; using System;
using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Windows.Input; using System.Windows.Input;
using Wabbajack.Common; using Wabbajack;
using Wabbajack.Lib; using Wabbajack.Extensions;
using Wabbajack.Lib.Extensions;
using Wabbajack.Paths; using Wabbajack.Paths;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;

View File

@ -10,7 +10,7 @@ using Silk.NET.Core.Native;
using Silk.NET.DXGI; using Silk.NET.DXGI;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Installer; using Wabbajack.Installer;
using Wabbajack.Lib; using Wabbajack;
using static PInvoke.User32; using static PInvoke.User32;
using UnmanagedType = System.Runtime.InteropServices.UnmanagedType; using UnmanagedType = System.Runtime.InteropServices.UnmanagedType;

View File

@ -15,7 +15,8 @@ using System.Windows.Forms;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Hashing.xxHash64; using Wabbajack.Hashing.xxHash64;
using Wabbajack.Lib.Extensions; using Wabbajack.Extensions;
using Wabbajack.Models;
using Wabbajack.Paths; using Wabbajack.Paths;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;
@ -83,16 +84,18 @@ namespace Wabbajack
return default; return default;
} }
public static IObservable<BitmapImage> DownloadBitmapImage(this IObservable<string> obs, Action<Exception> exceptionHandler) public static IObservable<BitmapImage> DownloadBitmapImage(this IObservable<string> obs, Action<Exception> exceptionHandler,
LoadingLock loadingLock)
{ {
return obs return obs
.ObserveOn(RxApp.TaskpoolScheduler) .ObserveOn(RxApp.TaskpoolScheduler)
.SelectTask(async url => .SelectTask(async url =>
{ {
var ll = loadingLock.WithLoading();
try try
{ {
var (found, mstream) = await FindCachedImage(url); var (found, mstream) = await FindCachedImage(url);
if (found) return mstream; if (found) return (ll, mstream);
var ret = new MemoryStream(); var ret = new MemoryStream();
using (var client = new HttpClient()) using (var client = new HttpClient())
@ -104,16 +107,17 @@ namespace Wabbajack
ret.Seek(0, SeekOrigin.Begin); ret.Seek(0, SeekOrigin.Begin);
await WriteCachedImage(url, ret.ToArray()); await WriteCachedImage(url, ret.ToArray());
return ret; return (ll, ret);
} }
catch (Exception ex) catch (Exception ex)
{ {
exceptionHandler(ex); exceptionHandler(ex);
return default; return (ll, default);
} }
}) })
.Select(memStream => .Select(x =>
{ {
var (ll, memStream) = x;
if (memStream == null) return default; if (memStream == null) return default;
try try
{ {
@ -126,6 +130,7 @@ namespace Wabbajack
} }
finally finally
{ {
ll.Dispose();
memStream.Dispose(); memStream.Dispose();
} }
}) })

View File

@ -7,7 +7,7 @@ using Microsoft.Extensions.Logging;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Messages; using Wabbajack.Messages;
namespace Wabbajack namespace Wabbajack

View File

@ -1,6 +1,6 @@
using System; using System;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.RateLimiter; using Wabbajack.RateLimiter;
namespace Wabbajack namespace Wabbajack

View File

@ -1,20 +1,16 @@
using DynamicData.Binding; using System;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using System;
using System.Diagnostics;
using System.IO;
using System.Reactive; using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using DynamicData;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Wabbajack.Compiler; using Wabbajack.Extensions;
using Wabbajack.Lib.Extensions; using Wabbajack.Interventions;
using Wabbajack.Lib.Interventions;
using Wabbajack.Messages; using Wabbajack.Messages;
using Wabbajack.RateLimiter; using Wabbajack.RateLimiter;
using ReactiveUI;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using DynamicData.Binding;
using ReactiveUI.Fody.Helpers;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -10,11 +10,11 @@ using Wabbajack.Common;
using Wabbajack.Compiler; using Wabbajack.Compiler;
using Wabbajack.DTOs; using Wabbajack.DTOs;
using Wabbajack.DTOs.GitHub; using Wabbajack.DTOs.GitHub;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Lib.Extensions; using Wabbajack.Extensions;
using Wabbajack.Paths; using Wabbajack.Paths;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;
using Consts = Wabbajack.Lib.Consts; using Consts = Wabbajack.Consts;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -6,7 +6,7 @@ using Microsoft.WindowsAPICodePack.Dialogs;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Lib; using Wabbajack;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -4,22 +4,18 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Reactive;
using System.Reactive.Disposables; using System.Reactive.Disposables;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using DynamicData; using DynamicData;
using DynamicData.Binding;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Downloaders.GameFile; using Wabbajack.Downloaders.GameFile;
using Wabbajack.DTOs; using Wabbajack.DTOs;
using Wabbajack.Hashing.xxHash64; using Wabbajack.Messages;
using Wabbajack.Lib.Extensions;
using Wabbajack.Networking.WabbajackClientApi; using Wabbajack.Networking.WabbajackClientApi;
using Wabbajack.Services.OSIntegrated; using Wabbajack.Services.OSIntegrated;
using Wabbajack.Services.OSIntegrated.Services; using Wabbajack.Services.OSIntegrated.Services;
@ -55,11 +51,9 @@ namespace Wabbajack
private readonly ILogger<ModListGalleryVM> _logger; private readonly ILogger<ModListGalleryVM> _logger;
private readonly GameLocator _locator; private readonly GameLocator _locator;
private readonly ModListDownloadMaintainer _maintainer; private readonly ModListDownloadMaintainer _maintainer;
private readonly SettingsManager _settingsManager;
private FiltersSettings settings { get; set; } = new(); private FiltersSettings settings { get; set; } = new();
public bool Loaded => _Loaded.Value;
public ICommand ClearFiltersCommand { get; set; } public ICommand ClearFiltersCommand { get; set; }
public ModListGalleryVM(ILogger<ModListGalleryVM> logger, Client wjClient, public ModListGalleryVM(ILogger<ModListGalleryVM> logger, Client wjClient,
@ -70,6 +64,7 @@ namespace Wabbajack
_logger = logger; _logger = logger;
_locator = locator; _locator = locator;
_maintainer = maintainer; _maintainer = maintainer;
_settingsManager = settingsManager;
ClearFiltersCommand = ReactiveCommand.Create( ClearFiltersCommand = ReactiveCommand.Create(
() => () =>
@ -80,11 +75,21 @@ namespace Wabbajack
Search = string.Empty; Search = string.Empty;
GameType = ALL_GAME_TYPE; GameType = ALL_GAME_TYPE;
}); });
BackCommand = ReactiveCommand.Create(
() =>
{
NavigateToGlobal.Send(NavigateToGlobal.ScreenType.ModeSelectionView);
});
this.WhenActivated(disposables => this.WhenActivated(disposables =>
{ {
var _ = LoadModLists(); LoadModLists().FireAndForget();
LoadSettings().FireAndForget();
Disposable.Create(() => SaveSettings().FireAndForget())
.DisposeWith(disposables);
var searchTextPredicates = this.ObservableForProperty(vm => vm.Search) var searchTextPredicates = this.ObservableForProperty(vm => vm.Search)
.Select(change => change.Value) .Select(change => change.Value)
@ -141,11 +146,47 @@ namespace Wabbajack
}); });
} }
private class FilterSettings
{
public string GameType { get; set; }
public bool ShowNSFW { get; set; }
public bool ShowUtilityLists { get; set; }
public bool OnlyInstalled { get; set; }
public string Search { get; set; }
}
public override void Unload() public override void Unload()
{ {
Error = null; Error = null;
} }
private async Task SaveSettings()
{
await _settingsManager.Save("modlist_gallery", new FilterSettings
{
GameType = GameType,
ShowNSFW = ShowNSFW,
ShowUtilityLists = ShowUtilityLists,
Search = Search,
OnlyInstalled = OnlyInstalled,
});
}
private async Task LoadSettings()
{
using var ll = LoadingLock.WithLoading();
RxApp.MainThreadScheduler.Schedule(await _settingsManager.Load<FilterSettings>("modlist_gallery"),
(_, s) =>
{
GameType = s.GameType;
ShowNSFW = s.ShowNSFW;
ShowUtilityLists = s.ShowUtilityLists;
Search = s.Search;
OnlyInstalled = s.OnlyInstalled;
return Disposable.Empty;
});
}
private async Task LoadModLists() private async Task LoadModLists()
{ {
using var ll = LoadingLock.WithLoading(); using var ll = LoadingLock.WithLoading();
@ -175,13 +216,5 @@ namespace Wabbajack
return gameEntries; return gameEntries;
} }
private void UpdateFiltersSettings()
{
settings.Game = GameType;
settings.Search = Search;
settings.ShowNSFW = ShowNSFW;
settings.ShowUtilityLists = ShowUtilityLists;
settings.OnlyInstalled = OnlyInstalled;
}
} }
} }

View File

@ -14,9 +14,10 @@ using ReactiveUI.Fody.Helpers;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.DTOs; using Wabbajack.DTOs;
using Wabbajack.DTOs.ServerResponses; using Wabbajack.DTOs.ServerResponses;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Lib.Extensions; using Wabbajack.Extensions;
using Wabbajack.Messages; using Wabbajack.Messages;
using Wabbajack.Models;
using Wabbajack.Networking.WabbajackClientApi; using Wabbajack.Networking.WabbajackClientApi;
using Wabbajack.Paths; using Wabbajack.Paths;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;
@ -51,6 +52,8 @@ namespace Wabbajack
public AbsolutePath Location { get; } public AbsolutePath Location { get; }
public LoadingLock LoadingImageLock { get; } = new();
[Reactive] [Reactive]
public List<ModListTag> ModListTagList { get; private set; } public List<ModListTag> ModListTagList { get; private set; }
@ -97,7 +100,7 @@ namespace Wabbajack
Location = LauncherUpdater.CommonFolder.Value.Combine("downloaded_mod_lists", Metadata.Links.MachineURL).WithExtension(Ext.Wabbajack); Location = LauncherUpdater.CommonFolder.Value.Combine("downloaded_mod_lists", Metadata.Links.MachineURL).WithExtension(Ext.Wabbajack);
ModListTagList = new List<ModListTag>(); ModListTagList = new List<ModListTag>();
Metadata.tags.ForEach(tag => Metadata.Tags.ForEach(tag =>
{ {
ModListTagList.Add(new ModListTag(tag)); ModListTagList.Add(new ModListTag(tag));
}); });
@ -166,7 +169,8 @@ namespace Wabbajack
.ObserveOnGuiThread() .ObserveOnGuiThread()
.Select(_ => .Select(_ =>
{ {
_parent.MWVM.OpenInstaller(Location); // TODO
//_parent.MWVM.OpenInstaller(Location);
// Wait for modlist member to be filled, then open its readme // Wait for modlist member to be filled, then open its readme
return _parent.MWVM.Installer.Value.WhenAny(x => x.ModList) return _parent.MWVM.Installer.Value.WhenAny(x => x.ModList)
@ -195,7 +199,7 @@ namespace Wabbajack
{ {
try try
{ {
return !IsDownloading && !(await maintainer.HaveModList(metadata)); return !IsDownloading && await maintainer.HaveModList(metadata);
} }
catch (Exception) catch (Exception)
{ {
@ -205,7 +209,7 @@ namespace Wabbajack
.ToGuiProperty(this, nameof(Exists)); .ToGuiProperty(this, nameof(Exists));
var imageObs = Observable.Return(Metadata.Links.ImageUri) var imageObs = Observable.Return(Metadata.Links.ImageUri)
.DownloadBitmapImage((ex) => _logger.LogError("Error downloading modlist image {Title}", Metadata.Title)); .DownloadBitmapImage((ex) => _logger.LogError("Error downloading modlist image {Title}", Metadata.Title), LoadingImageLock);
_Image = imageObs _Image = imageObs
.ToGuiProperty(this, nameof(Image)); .ToGuiProperty(this, nameof(Image));
@ -221,7 +225,8 @@ namespace Wabbajack
private async Task Download() private async Task Download()
{ {
var (progress, task) = _maintainer.DownloadModlist(Metadata); var (progress, task) = _maintainer.DownloadModlist(Metadata);
var dispose = progress.Subscribe(p => ProgressPercent = p); var dispose = progress
.BindToStrict(this, vm => vm.ProgressPercent);
await task; await task;

View File

@ -6,8 +6,8 @@ using System.Threading.Tasks;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Installer; using Wabbajack.Installer;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Lib.Interventions; using Wabbajack.Interventions;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -13,13 +13,13 @@ using Microsoft.Extensions.Logging;
using Microsoft.WindowsAPICodePack.Dialogs; using Microsoft.WindowsAPICodePack.Dialogs;
using Microsoft.WindowsAPICodePack.Shell; using Microsoft.WindowsAPICodePack.Shell;
using Wabbajack.DTOs.JsonConverters; using Wabbajack.DTOs.JsonConverters;
using Wabbajack.Lib.Extensions; using Wabbajack.Extensions;
using Wabbajack.Lib.Interventions; using Wabbajack.Interventions;
using Wabbajack.Messages; using Wabbajack.Messages;
using Wabbajack.RateLimiter; using Wabbajack.RateLimiter;
using Wabbajack.View_Models; using Wabbajack.View_Models;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;
using Consts = Wabbajack.Lib.Consts; using Consts = Wabbajack.Consts;
using KnownFolders = Wabbajack.Paths.IO.KnownFolders; using KnownFolders = Wabbajack.Paths.IO.KnownFolders;
namespace Wabbajack; namespace Wabbajack;

View File

@ -11,8 +11,8 @@ using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Installer; using Wabbajack.Installer;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Lib.Interventions; using Wabbajack.Interventions;
using Wabbajack.Util; using Wabbajack.Util;
namespace Wabbajack namespace Wabbajack

View File

@ -13,8 +13,8 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Downloaders.GameFile; using Wabbajack.Downloaders.GameFile;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Lib.Interventions; using Wabbajack.Interventions;
using Wabbajack.Messages; using Wabbajack.Messages;
using Wabbajack.Networking.WabbajackClientApi; using Wabbajack.Networking.WabbajackClientApi;
using Wabbajack.Paths; using Wabbajack.Paths;

View File

@ -12,10 +12,10 @@ using Wabbajack.Common;
using Wabbajack.DTOs; using Wabbajack.DTOs;
using Wabbajack.DTOs.JsonConverters; using Wabbajack.DTOs.JsonConverters;
using Wabbajack.Installer; using Wabbajack.Installer;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Paths; using Wabbajack.Paths;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;
using Consts = Wabbajack.Lib.Consts; using Consts = Wabbajack.Consts;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -4,7 +4,7 @@ using System.Reactive.Linq;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Wabbajack.DTOs.DownloadStates; using Wabbajack.DTOs.DownloadStates;
using Wabbajack.Lib; using Wabbajack;
namespace Wabbajack namespace Wabbajack
{ {
@ -25,7 +25,7 @@ namespace Wabbajack
ImageObservable = Observable.Return(State.ImageURL?.ToString()) ImageObservable = Observable.Return(State.ImageURL?.ToString())
.ObserveOn(RxApp.TaskpoolScheduler) .ObserveOn(RxApp.TaskpoolScheduler)
.DownloadBitmapImage(ex => _logger.LogError(ex, "Skipping slide for mod {Name}", State.Name)) .DownloadBitmapImage(ex => _logger.LogError(ex, "Skipping slide for mod {Name}", State.Name), LoadingLock)
.Replay(1) .Replay(1)
.RefCount(TimeSpan.FromMilliseconds(5000)); .RefCount(TimeSpan.FromMilliseconds(5000));
} }

View File

@ -7,7 +7,7 @@ using System.Reactive;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Windows.Input; using System.Windows.Input;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Messages; using Wabbajack.Messages;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;

View File

@ -7,7 +7,7 @@ using System.Windows.Input;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Networking.WabbajackClientApi; using Wabbajack.Networking.WabbajackClientApi;
using Wabbajack.Services.OSIntegrated.TokenProviders; using Wabbajack.Services.OSIntegrated.TokenProviders;

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Downloaders.Interfaces; using Wabbajack.Downloaders.Interfaces;
using Wabbajack.Lib; using Wabbajack;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -10,7 +10,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Lib; using Wabbajack;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -10,7 +10,7 @@ using System.Windows.Input;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Networking.WabbajackClientApi; using Wabbajack.Networking.WabbajackClientApi;
using Wabbajack.Services.OSIntegrated.TokenProviders; using Wabbajack.Services.OSIntegrated.TokenProviders;
using Wabbajack.View_Models.Settings; using Wabbajack.View_Models.Settings;

View File

@ -10,8 +10,8 @@ using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.DTOs.DownloadStates; using Wabbajack.DTOs.DownloadStates;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Lib.Extensions; using Wabbajack.Extensions;
namespace Wabbajack.View_Models namespace Wabbajack.View_Models
{ {

View File

@ -4,8 +4,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Lib.Interventions; using Wabbajack.Interventions;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -5,8 +5,8 @@ using System.Windows;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Lib.Interventions; using Wabbajack.Interventions;
using Wabbajack.Messages; using Wabbajack.Messages;
namespace Wabbajack namespace Wabbajack

View File

@ -11,9 +11,9 @@ using CefSharp.Wpf;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Lib.LibCefHelpers; using Wabbajack.LibCefHelpers;
using Wabbajack.Lib.WebAutomation; using Wabbajack.WebAutomation;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -6,7 +6,7 @@ using System.Reactive.Disposables;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Wabbajack.Models; using Wabbajack.Models;
namespace Wabbajack.Lib namespace Wabbajack
{ {
public class ViewModel : ReactiveObject, IDisposable, IActivatableViewModel public class ViewModel : ReactiveObject, IDisposable, IActivatableViewModel
{ {

View File

@ -15,7 +15,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Lib; using Wabbajack;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
using System.Reactive.Linq; using System.Reactive.Linq;
using Wabbajack.Common; using Wabbajack.Common;

View File

@ -3,13 +3,11 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:lib="clr-namespace:Wabbajack.Lib;assembly=Wabbajack.Lib"
xmlns:local="clr-namespace:Wabbajack" xmlns:local="clr-namespace:Wabbajack"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:TypeArguments="lib:ViewModel" x:TypeArguments="local:ViewModel"
ClipToBounds="True" ClipToBounds="True"
mc:Ignorable="d"> mc:Ignorable="d">
<UserControl.Resources> <UserControl.Resources>

View File

@ -7,7 +7,7 @@ using System.Reactive.Disposables;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Windows; using System.Windows;
using System.Windows.Media; using System.Windows.Media;
using Wabbajack.Lib; using Wabbajack;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -1,7 +1,7 @@
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
using Wabbajack.Lib; using Wabbajack;
namespace Wabbajack namespace Wabbajack
{ {
/// <summary> /// <summary>

View File

@ -3,13 +3,12 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:lib="clr-namespace:Wabbajack.Lib;assembly=Wabbajack.Lib"
xmlns:local="clr-namespace:Wabbajack" xmlns:local="clr-namespace:Wabbajack"
xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:TypeArguments="lib:ViewModel" x:TypeArguments="local:ViewModel"
BorderThickness="0" BorderThickness="0"
mc:Ignorable="d"> mc:Ignorable="d">
<Grid> <Grid>

View File

@ -4,7 +4,7 @@ using System.Windows.Controls;
using ReactiveUI; using ReactiveUI;
using System; using System;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Wabbajack.Lib; using Wabbajack;
using System.Reactive.Disposables; using System.Reactive.Disposables;
namespace Wabbajack namespace Wabbajack

View File

@ -2,7 +2,7 @@
x:Class="Wabbajack.CompilerView" x:Class="Wabbajack.CompilerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lib="clr-namespace:Wabbajack.Lib;assembly=Wabbajack.Lib" xmlns:lib="clr-namespace:Wabbajack;assembly=Wabbajack"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks" xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:local="clr-namespace:Wabbajack" xmlns:local="clr-namespace:Wabbajack"

View File

@ -5,11 +5,12 @@
xmlns:common="clr-namespace:Wabbajack.Common;assembly=Wabbajack.Common" xmlns:common="clr-namespace:Wabbajack.Common;assembly=Wabbajack.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks" xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:lib="clr-namespace:Wabbajack.Lib;assembly=Wabbajack.Lib" xmlns:lib="clr-namespace:Wabbajack;assembly=Wabbajack"
xmlns:local="clr-namespace:Wabbajack" xmlns:local="clr-namespace:Wabbajack"
xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:rxui="http://reactiveui.net" xmlns:rxui="http://reactiveui.net"
xmlns:lib1="clr-namespace:Wabbajack"
d:DataContext="{d:DesignInstance local:InstallerVM}" d:DataContext="{d:DesignInstance local:InstallerVM}"
d:DesignHeight="500" d:DesignHeight="500"
d:DesignWidth="800" d:DesignWidth="800"
@ -304,7 +305,7 @@
x:Name="UserInterventionsControl" x:Name="UserInterventionsControl"
Content="{Binding ActiveGlobalUserIntervention}"> Content="{Binding ActiveGlobalUserIntervention}">
<local:AttentionBorder.Resources> <local:AttentionBorder.Resources>
<DataTemplate DataType="{x:Type lib:ConfirmationIntervention}"> <DataTemplate DataType="{x:Type lib1:ConfirmationIntervention}">
<local:ConfirmationInterventionView ViewModel="{Binding}" /> <local:ConfirmationInterventionView ViewModel="{Binding}" />
</DataTemplate> </DataTemplate>
<DataTemplate DataType="{x:Type local:ConfirmUpdateOfExistingInstallVM}"> <DataTemplate DataType="{x:Type local:ConfirmUpdateOfExistingInstallVM}">

View File

@ -3,7 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:lib="clr-namespace:Wabbajack.Lib;assembly=Wabbajack.Lib" xmlns:lib="clr-namespace:Wabbajack;assembly=Wabbajack"
xmlns:local="clr-namespace:Wabbajack" xmlns:local="clr-namespace:Wabbajack"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:rxui="http://reactiveui.net" xmlns:rxui="http://reactiveui.net"

View File

@ -14,7 +14,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Lib; using Wabbajack;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -3,13 +3,12 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Wabbajack"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lib="clr-namespace:Wabbajack.Lib;assembly=Wabbajack.Lib"
xmlns:rxui="http://reactiveui.net" xmlns:rxui="http://reactiveui.net"
xmlns:lib1="clr-namespace:Wabbajack"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:TypeArguments="lib:ConfirmationIntervention" x:TypeArguments="lib1:ConfirmationIntervention"
mc:Ignorable="d"> mc:Ignorable="d">
<Grid Margin="10"> <Grid Margin="10">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>

View File

@ -14,7 +14,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Lib; using Wabbajack;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -4,8 +4,8 @@ using System.Threading.Tasks;
using MahApps.Metro.Controls; using MahApps.Metro.Controls;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Lib; using Wabbajack;
using Wabbajack.Lib.LibCefHelpers; using Wabbajack.LibCefHelpers;
using Wabbajack.Paths; using Wabbajack.Paths;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;
using Wabbajack.Util; using Wabbajack.Util;

View File

@ -31,15 +31,10 @@ namespace Wabbajack
.StartWith(Visibility.Collapsed) .StartWith(Visibility.Collapsed)
.BindToStrict(this, x => x.ErrorIcon.Visibility) .BindToStrict(this, x => x.ErrorIcon.Visibility)
.DisposeWith(dispose); .DisposeWith(dispose);
Observable.CombineLatest( this.WhenAny(x => x.ViewModel.ModLists.Count)
this.WhenAny(x => x.ViewModel.ModLists.Count) .CombineLatest(this.WhenAnyValue(x => x.ViewModel.LoadingLock.IsLoading))
.Select(x => x > 0), .Select(x => x.First == 0 && !x.Second)
this.WhenAny(x => x.ViewModel.Loaded),
resultSelector: (hasContent, loaded) =>
{
return !hasContent && loaded;
})
.DistinctUntilChanged() .DistinctUntilChanged()
.Select(x => x ? Visibility.Visible : Visibility.Collapsed) .Select(x => x ? Visibility.Visible : Visibility.Collapsed)
.StartWith(Visibility.Collapsed) .StartWith(Visibility.Collapsed)

View File

@ -90,7 +90,7 @@
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Stretch="UniformToFill"> Stretch="UniformToFill">
<Image x:Name="ModListImage" Source="{Binding Metadata.Links.ImageUriFast}"> <Image x:Name="ModListImage">
<Image.Style> <Image.Style>
<Style TargetType="Image"> <Style TargetType="Image">
<Style.Triggers> <Style.Triggers>
@ -255,7 +255,7 @@
x:Name="Overlay" x:Name="Overlay"
Visibility="Collapsed" /> Visibility="Collapsed" />
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
x:Name="DescriptionTextShadow" x:Name="ModListTitleShadow"
Margin="5" Margin="5"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
@ -269,7 +269,7 @@
</TextBlock.Effect> </TextBlock.Effect>
</TextBlock> </TextBlock>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
x:Name="ModListTitleShadow" x:Name="ModListTitle"
Margin="5" Margin="5"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
@ -297,7 +297,7 @@
FontSize="14" FontSize="14"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</ScrollViewer> </ScrollViewer>
<ItemsControl Grid.Row="2" ItemsSource="{Binding ModListTagList}"> <ItemsControl Grid.Row="2" Name="TagsList">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<WrapPanel/> <WrapPanel/>

View File

@ -1,21 +1,7 @@
using System; using System.Reactive.Disposables;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; 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 ReactiveUI; using ReactiveUI;
using Wabbajack.Common;
namespace Wabbajack namespace Wabbajack
{ {
@ -27,8 +13,59 @@ namespace Wabbajack
public ModListTileView() public ModListTileView()
{ {
InitializeComponent(); InitializeComponent();
this.WhenActivated(dispose => this.WhenActivated(disposables =>
{ {
ViewModel.WhenAnyValue(vm => vm.Image)
.BindToStrict(this, view => view.ModListImage.Source)
.DisposeWith(disposables);
var textXformed = ViewModel.WhenAnyValue(vm => vm.Metadata.Title)
.CombineLatest(ViewModel.WhenAnyValue(vm => vm.Metadata.ImageContainsTitle),
ViewModel.WhenAnyValue(vm => vm.IsBroken))
.Select(x => x.Second && !x.Third ? "" : x.First);
textXformed
.BindToStrict(this, view => view.ModListTitle.Text)
.DisposeWith(disposables);
textXformed
.BindToStrict(this, view => view.ModListTitleShadow.Text)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(x => x.Metadata.Description)
.BindToStrict(this, x => x.MetadataDescription.Text)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(x => x.ModListTagList)
.BindToStrict(this, x => x.TagsList.ItemsSource)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(x => x.LoadingImageLock.IsLoading)
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, x => x.LoadingProgress.Visibility)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(x => x.IsBroken)
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, view => view.Overlay.Visibility)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(x => x.OpenWebsiteCommand)
.BindToStrict(this, x => x.OpenWebsiteButton.Command)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(x => x.ExecuteCommand)
.BindToStrict(this, x => x.ExecuteButton.Command)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(x => x.ProgressPercent)
.ObserveOnDispatcher()
.Select(p => p.Value)
.BindTo(this, x => x.DownloadProgressBar.Value)
.DisposeWith(disposables);
/*
this.MarkAsNeeded<ModListTileView, ModListMetadataVM, bool>(this.ViewModel, x => x.IsBroken); this.MarkAsNeeded<ModListTileView, ModListMetadataVM, bool>(this.ViewModel, x => x.IsBroken);
this.MarkAsNeeded<ModListTileView, ModListMetadataVM, bool>(this.ViewModel, x => x.Exists); this.MarkAsNeeded<ModListTileView, ModListMetadataVM, bool>(this.ViewModel, x => x.Exists);
this.MarkAsNeeded<ModListTileView, ModListMetadataVM, string>(this.ViewModel, x => x.Metadata.Links.ImageUri); this.MarkAsNeeded<ModListTileView, ModListMetadataVM, string>(this.ViewModel, x => x.Metadata.Links.ImageUri);
@ -36,35 +73,12 @@ namespace Wabbajack
.Select(p => p.Value) .Select(p => p.Value)
.BindToStrict(this, x => x.DownloadProgressBar.Value) .BindToStrict(this, x => x.DownloadProgressBar.Value)
.DisposeWith(dispose); .DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.Metadata)
.CombineLatest(this.WhenAny(x => x.ViewModel.IsBroken))
.Where(x => !x.First.ImageContainsTitle || x.Second)
.Select(x => x.First.Title)
.BindToStrict(this, x => x.DescriptionTextShadow.Text)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.Metadata)
.CombineLatest(this.WhenAny(x => x.ViewModel.IsBroken))
.Where(x => !x.First.ImageContainsTitle || x.Second)
.Select(x => x.First.Title)
.BindToStrict(this, x => x.ModListTitleShadow.Text)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.IsBroken)
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, x => x.Overlay.Visibility)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.Metadata.Description)
.BindToStrict(this, x => x.MetadataDescription.Text)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.OpenWebsiteCommand)
.BindToStrict(this, x => x.OpenWebsiteButton.Command)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.ModListContentsCommend) this.WhenAny(x => x.ViewModel.ModListContentsCommend)
.BindToStrict(this, x => x.ModListContentsButton.Command) .BindToStrict(this, x => x.ModListContentsButton.Command)
.DisposeWith(dispose); .DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.ExecuteCommand)
.BindToStrict(this, x => x.ExecuteButton.Command)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.Image) this.WhenAny(x => x.ViewModel.Image)
.BindToStrict(this, x => x.ModListImage.Source) .BindToStrict(this, x => x.ModListImage.Source)
.DisposeWith(dispose); .DisposeWith(dispose);
@ -72,6 +86,7 @@ namespace Wabbajack
.Select(x => x ? Visibility.Visible : Visibility.Collapsed) .Select(x => x ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, x => x.LoadingProgress.Visibility) .BindToStrict(this, x => x.LoadingProgress.Visibility)
.DisposeWith(dispose); .DisposeWith(dispose);
*/
}); });
} }
} }

View File

@ -16,7 +16,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Lib.WebAutomation; using Wabbajack.WebAutomation;
namespace Wabbajack namespace Wabbajack
{ {

View File

@ -37,6 +37,9 @@
<Reference Update="CefSharp.Wpf"> <Reference Update="CefSharp.Wpf">
<Private>true</Private> <Private>true</Private>
</Reference> </Reference>
<Reference Include="MahApps.Metro.IconPacks.Octicons, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0c0d510f9915137a">
<HintPath>..\..\..\Users\tbald\.nuget\packages\mahapps.metro.iconpacks\4.8.0\lib\netcoreapp3.1\MahApps.Metro.IconPacks.Octicons.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -82,11 +85,15 @@
<PackageReference Include="ReactiveUI.Fody" Version="16.2.6" /> <PackageReference Include="ReactiveUI.Fody" Version="16.2.6" />
<PackageReference Include="ReactiveUI.WPF" Version="16.2.6" /> <PackageReference Include="ReactiveUI.WPF" Version="16.2.6" />
<PackageReference Include="Silk.NET.DXGI" Version="2.6.0" /> <PackageReference Include="Silk.NET.DXGI" Version="2.6.0" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="WPFThemes.DarkBlend" Version="1.0.8" /> <PackageReference Include="WPFThemes.DarkBlend" Version="1.0.8" />
<PackageReference Include="CefSharp.OffScreen">
<Version>91.1.230</Version>
<NoWarn>NU1701</NoWarn>
</PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Wabbajack.Lib\Wabbajack.Lib.csproj" />
<ProjectReference Include="..\Wabbajack.Services.OSIntegrated\Wabbajack.Services.OSIntegrated.csproj" /> <ProjectReference Include="..\Wabbajack.Services.OSIntegrated\Wabbajack.Services.OSIntegrated.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -4,11 +4,11 @@ using System.Threading.Tasks;
using CefSharp; using CefSharp;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.VisualBasic.CompilerServices; using Microsoft.VisualBasic.CompilerServices;
using Wabbajack.Lib.LibCefHelpers; using Wabbajack.LibCefHelpers;
using Wabbajack.Networking.Http; using Wabbajack.Networking.Http;
using Wabbajack.Paths; using Wabbajack.Paths;
namespace Wabbajack.Lib.WebAutomation namespace Wabbajack.WebAutomation
{ {
public class CefSharpWrapper : IWebDriver public class CefSharpWrapper : IWebDriver
{ {

View File

@ -5,9 +5,9 @@ using System.Net.Http;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Wabbajack.Lib.LibCefHelpers; using Wabbajack.LibCefHelpers;
namespace Wabbajack.Lib.WebAutomation namespace Wabbajack.WebAutomation
{ {
public interface IWebDriver public interface IWebDriver
{ {

View File

@ -8,11 +8,11 @@ using CefSharp.OffScreen;
using HtmlAgilityPack; using HtmlAgilityPack;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Lib.LibCefHelpers; using Wabbajack.LibCefHelpers;
using Wabbajack.Paths; using Wabbajack.Paths;
using Wabbajack.Paths.IO; using Wabbajack.Paths.IO;
namespace Wabbajack.Lib.WebAutomation namespace Wabbajack.WebAutomation
{ {
public class Driver : IDisposable public class Driver : IDisposable
{ {

View File

@ -67,7 +67,7 @@ public class BrowseItemViewModel : ViewModelBase, IActivatableViewModel
_dtos = dtos; _dtos = dtos;
var haveGame = gameLocator.IsInstalled(_metadata.Game); var haveGame = gameLocator.IsInstalled(_metadata.Game);
Tags = metadata.tags Tags = metadata.Tags
.Select(t => new TagViewModel(t, "ModList")) .Select(t => new TagViewModel(t, "ModList"))
.Prepend(new TagViewModel(_metadata.Game.MetaData().HumanFriendlyGameName, .Prepend(new TagViewModel(_metadata.Game.MetaData().HumanFriendlyGameName,
haveGame ? "Game" : "GameNotInstalled")) haveGame ? "Game" : "GameNotInstalled"))

View File

@ -21,7 +21,7 @@ public class ModlistMetadata
[JsonPropertyName("official")] public bool Official { get; set; } [JsonPropertyName("official")] public bool Official { get; set; }
[JsonPropertyName("tags")] public List<string> tags { get; set; } = new(); [JsonPropertyName("tags")] public List<string> Tags { get; set; } = new();
[JsonPropertyName("nsfw")] public bool NSFW { get; set; } [JsonPropertyName("nsfw")] public bool NSFW { get; set; }

View File

@ -1,3 +0,0 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ReactiveUI />
</Weavers>

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ReactiveUI" minOccurs="0" maxOccurs="1" type="xs:anyType" />
<xs:element name="ModuleInit" minOccurs="0" maxOccurs="1" type="xs:anyType" />
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -1,3 +0,0 @@
# Wabbajack.Lib
While `Wabbajack` is the front end, `Wabbajack.Lib` is the back end and contains all functionality from the Compilers, the Installers to our NexusAPI and Downloaders.

View File

@ -1,90 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Platforms>x64</Platforms>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CefSharp.Common">
<Version>91.1.230</Version>
</PackageReference>
<PackageReference Include="CefSharp.OffScreen">
<Version>91.1.230</Version>
<NoWarn>NU1701</NoWarn>
</PackageReference>
<PackageReference Include="F23.StringSimilarity">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="Fody">
<Version>6.5.2</Version>
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Genbox.AlphaFS">
<Version>2.2.2.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.CSharp">
<Version>4.7.0</Version>
</PackageReference>
<PackageReference Include="ModuleInit.Fody">
<Version>2.1.1</Version>
</PackageReference>
<PackageReference Include="Octokit">
<Version>0.50.0</Version>
</PackageReference>
<PackageReference Include="ReactiveUI">
<Version>16.2.6</Version>
</PackageReference>
<PackageReference Include="ReactiveUI.Fody">
<Version>16.2.6</Version>
</PackageReference>
<PackageReference Include="SharpCompress">
<Version>0.28.3</Version>
</PackageReference>
<PackageReference Include="System.Collections.Immutable">
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="System.Drawing.Common">
<Version>5.0.2</Version>
</PackageReference>
<PackageReference Include="System.Net.Http">
<Version>4.3.4</Version>
</PackageReference>
<PackageReference Include="System.ServiceModel.Syndication">
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="YamlDotNet.NetCore">
<Version>1.0.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Wabbajack.Downloaders.Dispatcher\Wabbajack.Downloaders.Dispatcher.csproj" />
<ProjectReference Include="..\Wabbajack.Networking.WabbajackClientApi\Wabbajack.Networking.WabbajackClientApi.csproj" />
</ItemGroup>
<ItemGroup>
<None Remove="LibCefHelpers\cefsharp.7z" />
<None Update="Downloaders\BethesdaNet\bethnetlogin.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Downloaders\Converters\ffmpeg.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Downloaders\Converters\xWMAEncode.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="vcruntime140.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="vccorlib140.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="msvcp140.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="concrt140.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -20,6 +20,7 @@ public class ModListDownloadMaintainer
private readonly DownloadDispatcher _dispatcher; private readonly DownloadDispatcher _dispatcher;
private readonly FileHashCache _hashCache; private readonly FileHashCache _hashCache;
private readonly IResource<DownloadDispatcher> _rateLimiter; private readonly IResource<DownloadDispatcher> _rateLimiter;
private int _downloadingCount;
public ModListDownloadMaintainer(ILogger<ModListDownloadMaintainer> logger, Configuration configuration, public ModListDownloadMaintainer(ILogger<ModListDownloadMaintainer> logger, Configuration configuration,
DownloadDispatcher dispatcher, FileHashCache hashCache, IResource<DownloadDispatcher> rateLimiter) DownloadDispatcher dispatcher, FileHashCache hashCache, IResource<DownloadDispatcher> rateLimiter)
@ -29,6 +30,7 @@ public class ModListDownloadMaintainer
_dispatcher = dispatcher; _dispatcher = dispatcher;
_hashCache = hashCache; _hashCache = hashCache;
_rateLimiter = rateLimiter; _rateLimiter = rateLimiter;
_downloadingCount = 0;
} }
public AbsolutePath ModListPath(ModlistMetadata metadata) public AbsolutePath ModListPath(ModlistMetadata metadata)
@ -42,6 +44,9 @@ public class ModListDownloadMaintainer
var path = ModListPath(metadata); var path = ModListPath(metadata);
if (!path.FileExists()) return false; if (!path.FileExists()) return false;
if (_hashCache.TryGetHashCache(path, out var hash) && hash == metadata.DownloadMetadata!.Hash) return true;
if (_downloadingCount > 0) return false;
return await _hashCache.FileHashCachedAsync(path, token.Value) == metadata.DownloadMetadata!.Hash; return await _hashCache.FileHashCachedAsync(path, token.Value) == metadata.DownloadMetadata!.Hash;
} }
@ -58,6 +63,7 @@ public class ModListDownloadMaintainer
{ {
try try
{ {
Interlocked.Increment(ref _downloadingCount);
var job = await _rateLimiter.Begin($"Downloading {metadata.Title}", metadata.DownloadMetadata!.Size, var job = await _rateLimiter.Begin($"Downloading {metadata.Title}", metadata.DownloadMetadata!.Size,
token.Value); token.Value);
@ -75,6 +81,7 @@ public class ModListDownloadMaintainer
finally finally
{ {
progress.OnCompleted(); progress.OnCompleted();
Interlocked.Decrement(ref _downloadingCount);
} }
}); });

View File

@ -120,8 +120,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "App", "App", "{54F8D14A-61F
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack", "Wabbajack.App.Wpf\Wabbajack.csproj", "{372B2DD2-EAA3-4E18-98A7-B9838C7B41F4}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack", "Wabbajack.App.Wpf\Wabbajack.csproj", "{372B2DD2-EAA3-4E18-98A7-B9838C7B41F4}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack.Lib", "Wabbajack.Lib\Wabbajack.Lib.csproj", "{2BB49509-4C65-4687-90D7-C410A2EEEEFE}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -332,10 +330,6 @@ Global
{372B2DD2-EAA3-4E18-98A7-B9838C7B41F4}.Debug|Any CPU.Build.0 = Debug|x64 {372B2DD2-EAA3-4E18-98A7-B9838C7B41F4}.Debug|Any CPU.Build.0 = Debug|x64
{372B2DD2-EAA3-4E18-98A7-B9838C7B41F4}.Release|Any CPU.ActiveCfg = Release|x64 {372B2DD2-EAA3-4E18-98A7-B9838C7B41F4}.Release|Any CPU.ActiveCfg = Release|x64
{372B2DD2-EAA3-4E18-98A7-B9838C7B41F4}.Release|Any CPU.Build.0 = Release|x64 {372B2DD2-EAA3-4E18-98A7-B9838C7B41F4}.Release|Any CPU.Build.0 = Release|x64
{2BB49509-4C65-4687-90D7-C410A2EEEEFE}.Debug|Any CPU.ActiveCfg = Debug|x64
{2BB49509-4C65-4687-90D7-C410A2EEEEFE}.Debug|Any CPU.Build.0 = Debug|x64
{2BB49509-4C65-4687-90D7-C410A2EEEEFE}.Release|Any CPU.ActiveCfg = Release|x64
{2BB49509-4C65-4687-90D7-C410A2EEEEFE}.Release|Any CPU.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{4057B668-8595-44FE-9805-007B284A838F} = {98B731EE-4FC0-4482-A069-BCBA25497871} {4057B668-8595-44FE-9805-007B284A838F} = {98B731EE-4FC0-4482-A069-BCBA25497871}
@ -373,6 +367,5 @@ Global
{DEB4B073-4EAA-49FD-9D43-F0F8CB930E7A} = {F01F8595-5FD7-4506-8469-F4A5522DACC1} {DEB4B073-4EAA-49FD-9D43-F0F8CB930E7A} = {F01F8595-5FD7-4506-8469-F4A5522DACC1}
{4F252332-CA77-41DE-95A8-9DF38A81D675} = {98B731EE-4FC0-4482-A069-BCBA25497871} {4F252332-CA77-41DE-95A8-9DF38A81D675} = {98B731EE-4FC0-4482-A069-BCBA25497871}
{372B2DD2-EAA3-4E18-98A7-B9838C7B41F4} = {54F8D14A-61F1-4B70-A012-974323F9B05F} {372B2DD2-EAA3-4E18-98A7-B9838C7B41F4} = {54F8D14A-61F1-4B70-A012-974323F9B05F}
{2BB49509-4C65-4687-90D7-C410A2EEEEFE} = {54F8D14A-61F1-4B70-A012-974323F9B05F}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal