Merge pull request #468 from Noggog/some-fixes

Some fixes
This commit is contained in:
Timothy Baldridge 2020-02-03 21:33:31 -07:00 committed by GitHub
commit 49305f8f8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 55 additions and 27 deletions

View File

@ -1,5 +1,9 @@
### Changelog
* Auto update functionality added client-side.
* Slideshow now moves to next slide when users clicks, even if paused
* Installer now prints to log what modlist it is installing
=======
#### Version - 1.0 beta 17 - 1/22/2020

View File

@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using System.Web;
using Wabbajack.Common;
namespace Wabbajack.Lib.Downloaders
{
@ -14,22 +15,30 @@ namespace Wabbajack.Lib.Downloaders
public AbstractDownloadState GetDownloaderState(string url)
{
if (url == null) return null;
var uri = new UriBuilder(url);
if (uri.Host != "www.dropbox.com") return null;
var query = HttpUtility.ParseQueryString(uri.Query);
if (query.GetValues("dl").Length > 0)
query.Remove("dl");
query.Set("dl", "1");
uri.Query = query.ToString();
return new HTTPDownloader.State()
try
{
Url = uri.ToString().Replace("dropbox.com:443/", "dropbox.com/")
};
if (url == null) return null;
var uri = new UriBuilder(url);
if (uri.Host != "www.dropbox.com") return null;
var query = HttpUtility.ParseQueryString(uri.Query);
if (query.GetValues("dl")?.Length > 0)
query.Remove("dl");
query.Set("dl", "1");
uri.Query = query.ToString();
return new HTTPDownloader.State()
{
Url = uri.ToString().Replace("dropbox.com:443/", "dropbox.com/")
};
}
catch (Exception)
{
Utils.Error($"Error downloading Dropbox link: {url}");
throw;
}
}
public async Task Prepare()

View File

@ -59,7 +59,16 @@ namespace Wabbajack.Lib.Downloaders
var gameMeta = GameRegistry.GetByMO2ArchiveName(name);
var game = gameMeta != null ? GameRegistry.GetByMO2ArchiveName(name).Game : GameRegistry.GetByNexusName(name).Game;
var client = await NexusApiClient.Get();
var info = await client.GetModInfo(game, general.modID);
dynamic info;
try
{
info = await client.GetModInfo(game, general.modID);
}
catch (Exception)
{
Utils.Error($"Error getting mod info for Nexus mod with {general.modID}");
throw;
}
return new State
{
GameName = general.gameName,

View File

@ -249,7 +249,7 @@ namespace Wabbajack.Lib.NexusApi
var builder = new UriBuilder(url) { Host = Consts.WabbajackCacheHostname, Port = Consts.WabbajackCachePort, Scheme = "http" };
return await Get<T>(builder.ToString());
}
catch (Exception ex)
catch (Exception)
{
return await Get<T>(url);
}

View File

@ -362,6 +362,7 @@ namespace Wabbajack
{
try
{
Utils.Log($"Starting to install {ModList.Name}");
var success = await this.Installer.Install();
Completed = ErrorResponse.Create(success);
try

View File

@ -138,7 +138,7 @@ namespace Wabbajack
// Latch onto update events and update GUI
AutoUpdater.CheckForUpdateEvent += (args) =>
{
UpdateAvailable = args.IsUpdateAvailable;
UpdateAvailable = args?.IsUpdateAvailable ?? false;
};
// Trigger a query for updates soon after starting

View File

@ -56,15 +56,17 @@ namespace Wabbajack
.Select(_ => Observable.Interval(TimeSpan.FromSeconds(intervalSeconds))))
// When a new timer comes in, swap to it
.Switch()
.Unit())
.Unit()
// Only subscribe to timer if enabled and installing
.FlowSwitch(
Observable.CombineLatest(
this.WhenAny(x => x.Enable),
this.WhenAny(x => x.Installer.Installing),
resultSelector: (enabled, installing) => enabled && installing)))
// When filter switch enabled, fire an initial signal
.StartWith(Unit.Default)
// Only subscribe to slideshow triggers if enabled and installing
.FlowSwitch(
Observable.CombineLatest(
this.WhenAny(x => x.Enable),
this.WhenAny(x => x.Installer.Installing),
resultSelector: (enabled, installing) => enabled && installing))
// Only subscribe to slideshow triggers if started
.FlowSwitch(this.WhenAny(x => x.Installer.StartedInstallation))
// Block spam
.Debounce(TimeSpan.FromMilliseconds(250), RxApp.MainThreadScheduler)
.Scan(

View File

@ -51,7 +51,7 @@
</ItemsControl>
</ScrollViewer>
</Border>
<mahapps:ProgressRing x:Name="LoadingRing" Grid.Row="1" />
<mahapps:ProgressRing x:Name="LoadingRing" Grid.Row="1" Visibility="Collapsed" />
<iconPacks:PackIconControl
x:Name="ErrorIcon"
Grid.Row="1"
@ -61,7 +61,8 @@
VerticalAlignment="Center"
Foreground="{StaticResource ErrorBrush}"
Kind="{x:Static iconPacks:PackIconMaterialKind.AlertCircle}"
ToolTip="Error loading modlist gallery" />
ToolTip="Error loading modlist gallery"
Visibility="Collapsed" />
<local:TopProgressView
Title="Browsing Modlists"
Grid.Row="0"

View File

@ -33,10 +33,12 @@ namespace Wabbajack
return !hasContent && succeeded;
})
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
.StartWith(Visibility.Collapsed)
.BindToStrict(this, x => x.LoadingRing.Visibility)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.Error)
.Select(e => (e?.Succeeded ?? true) ? Visibility.Collapsed : Visibility.Visible)
.StartWith(Visibility.Collapsed)
.BindToStrict(this, x => x.ErrorIcon.Visibility)
.DisposeWith(dispose);
});