mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #331 from erri120/slideshow-fixes
Updated the Slideshow error to be non important
This commit is contained in:
commit
cb4644e133
@ -1,7 +1,6 @@
|
|||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
@ -50,7 +49,7 @@ namespace Wabbajack
|
|||||||
{
|
{
|
||||||
var ret = new MemoryStream();
|
var ret = new MemoryStream();
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
using (Stream stream = await client.GetStreamAsync(url))
|
using (var stream = await client.GetStreamAsync(url))
|
||||||
{
|
{
|
||||||
stream.CopyTo(ret);
|
stream.CopyTo(ret);
|
||||||
}
|
}
|
||||||
@ -58,28 +57,28 @@ namespace Wabbajack
|
|||||||
ret.Seek(0, SeekOrigin.Begin);
|
ret.Seek(0, SeekOrigin.Begin);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Utils.Error(ex, $"Exception while caching slide {ModName} ({ModID})");
|
Utils.Log($"Skipping slide for mod {ModName} ({ModID})");
|
||||||
return default(MemoryStream);
|
return default;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.ObserveOn(RxApp.MainThreadScheduler)
|
.ObserveOn(RxApp.MainThreadScheduler)
|
||||||
.Select(memStream =>
|
.Select(memStream =>
|
||||||
{
|
{
|
||||||
if (memStream == null) return default(BitmapImage);
|
if (memStream == null) return default;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return UIUtils.BitmapImageFromStream(memStream);
|
return UIUtils.BitmapImageFromStream(memStream);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Utils.Error(ex, $"Exception while caching slide {ModName} ({ModID})");
|
Utils.Log($"Skipping slide for mod {ModName} ({ModID})");
|
||||||
return default(BitmapImage);
|
return default;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
memStream?.Dispose();
|
memStream.Dispose();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.Replay(1)
|
.Replay(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user