Deactivation of buggy Splat custom icon implementation

This commit is contained in:
BONNEVILLE Geoffroy
2018-03-12 12:40:07 +01:00
parent fb0eab00c2
commit 7613629d87
3 changed files with 14 additions and 16 deletions

View File

@@ -2,7 +2,7 @@
<package > <package >
<metadata> <metadata>
<id>ModernKeePassLib</id> <id>ModernKeePassLib</id>
<version>2.38.1</version> <version>2.38.2</version>
<title>ModernKeePassLib</title> <title>ModernKeePassLib</title>
<authors>Geoffroy Bonneville</authors> <authors>Geoffroy Bonneville</authors>
<owners>Geoffroy Bonneville</owners> <owners>Geoffroy Bonneville</owners>
@@ -10,7 +10,7 @@
<projectUrl>https://github.com/wismna/ModernKeePass</projectUrl> <projectUrl>https://github.com/wismna/ModernKeePass</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Portable KeePass Password Management Library that targets .Net Standard and WinRT. Allows reading, editing and writing to KeePass 2.x databases.</description> <description>Portable KeePass Password Management Library that targets .Net Standard and WinRT. Allows reading, editing and writing to KeePass 2.x databases.</description>
<releaseNotes>Version bump to 2.38</releaseNotes> <releaseNotes>Deactivation of buggy custom icon implementation</releaseNotes>
<copyright>Copyright © 2018 Geoffroy Bonneville</copyright> <copyright>Copyright © 2018 Geoffroy Bonneville</copyright>
<tags>KeePass KeePassLib Portable PCL NetStandard</tags> <tags>KeePass KeePassLib Portable PCL NetStandard</tags>
<dependencies> <dependencies>

View File

@@ -80,11 +80,7 @@ namespace ModernKeePassLib
// MemoryStream ms = new MemoryStream(m_pbImageDataPng, false); // MemoryStream ms = new MemoryStream(m_pbImageDataPng, false);
// m_imgOrg = Image.FromStream(ms); // m_imgOrg = Image.FromStream(ms);
// ms.Close(); // ms.Close();
#if ModernKeePassLib
try { m_imgOrg = GfxUtil.LoadImage(m_pbImageDataPng).GetAwaiter().GetResult(); }
#else
try { m_imgOrg = GfxUtil.LoadImage(m_pbImageDataPng); } try { m_imgOrg = GfxUtil.LoadImage(m_pbImageDataPng); }
#endif
catch(Exception) { Debug.Assert(false); m_imgOrg = null; } catch(Exception) { Debug.Assert(false); m_imgOrg = null; }
if(m_imgOrg != null) if(m_imgOrg != null)
@@ -121,8 +117,9 @@ namespace ModernKeePassLib
Image img; Image img;
if(m_dImageCache.TryGetValue(lID, out img)) return img; if(m_dImageCache.TryGetValue(lID, out img)) return img;
#if ModernKeePassLib #if ModernKeePassLib
img = GfxUtil.ScaleImage(m_pbImageDataPng, w, h).GetAwaiter().GetResult(); img = GfxUtil.ScaleImage(m_pbImageDataPng, w, h);
#else #else
img = GfxUtil.ScaleImage(m_imgOrg, w, h, ScaleTransformFlags.UIIcon); img = GfxUtil.ScaleImage(m_imgOrg, w, h, ScaleTransformFlags.UIIcon);
#endif #endif

View File

@@ -1,22 +1,23 @@
using System.IO; using System.IO;
using System.Threading.Tasks;
using Splat; using Splat;
namespace ModernKeePassLib.Utility namespace ModernKeePassLib.Utility
{ {
public class GfxUtil public class GfxUtil
{ {
public static async Task<IBitmap> LoadImage(byte[] pb) public static IBitmap LoadImage(byte[] pb)
{ {
return await ScaleImage(pb, null, null); return null;
//return ScaleImage(pb, null, null);
} }
public static async Task<IBitmap> ScaleImage(byte[] pb, int? w, int? h) public static IBitmap ScaleImage(byte[] pb, int? w, int? h)
{ {
using (var ms = new MemoryStream(pb, false)) return null;
/*using (var ms = new MemoryStream(pb, false))
{ {
return await BitmapLoader.Current.Load(ms, w, h); return BitmapLoader.Current.Load(ms, w, h).Result;
} }*/
} }
} }
} }