mirror of
https://github.com/wismna/ModernKeePassLib.git
synced 2025-10-04 08:00:18 -04:00
Removed dependencies to UWP SDK
Added ImageSharp for image processing
This commit is contained in:
@@ -1,17 +1,21 @@
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
|
||||
namespace ModernKeePassLib.Utility
|
||||
{
|
||||
public class GfxUtil
|
||||
{
|
||||
public static Image LoadImage(byte[] pb)
|
||||
public static Image<Rgba32> LoadImage(byte[] pb)
|
||||
{
|
||||
return null;
|
||||
return Image.Load<Rgba32>(pb);
|
||||
}
|
||||
|
||||
public static Image ScaleImage(Image m_imgOrg, int? w, int? h, ScaleTransformFlags flags)
|
||||
public static Image<Rgba32> ScaleImage(Image<Rgba32> m_imgOrg, int? w, int? h, ScaleTransformFlags flags)
|
||||
{
|
||||
return null;
|
||||
m_imgOrg.Mutate(i => i.Resize(w.GetValueOrDefault(), h.GetValueOrDefault()));
|
||||
return m_imgOrg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +0,0 @@
|
||||
using System.IO;
|
||||
using Windows.Storage.Streams;
|
||||
|
||||
namespace ModernKeePassLibPCL.Utility
|
||||
{
|
||||
public static class StreamExtensions
|
||||
{
|
||||
public static Stream AsStream(this IRandomAccessStream inputStream)
|
||||
{
|
||||
var reader = new DataReader(inputStream.GetInputStreamAt(0));
|
||||
var bytes = new byte[inputStream.Size];
|
||||
reader.LoadAsync((uint)inputStream.Size).GetResults();
|
||||
reader.ReadBytes(bytes);
|
||||
return new MemoryStream(bytes);
|
||||
}
|
||||
}
|
||||
}
|
@@ -25,10 +25,6 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
#if ModernKeePassLib
|
||||
using Windows.Storage;
|
||||
#endif
|
||||
|
||||
using ModernKeePassLib.Native;
|
||||
|
||||
namespace ModernKeePassLib.Utility
|
||||
@@ -44,14 +40,7 @@ namespace ModernKeePassLib.Utility
|
||||
|
||||
public static char LocalDirSepChar
|
||||
{
|
||||
#if KeePassRT
|
||||
get { return '\\'; }
|
||||
#elif ModernKeePassLib
|
||||
//get { return PortablePath.DirectorySeparatorChar; }
|
||||
get { return '\\'; }
|
||||
#else
|
||||
get { return Path.DirectorySeparatorChar; }
|
||||
#endif
|
||||
}
|
||||
|
||||
private static char[] g_vDirSepChars = null;
|
||||
@@ -486,16 +475,7 @@ namespace ModernKeePassLib.Utility
|
||||
}
|
||||
|
||||
string str;
|
||||
try
|
||||
{
|
||||
#if ModernKeePassLib
|
||||
var dirT = StorageFolder.GetFolderFromPathAsync(
|
||||
strPath).GetResults();
|
||||
str = dirT.Path;
|
||||
#else
|
||||
str = Path.GetFullPath(strPath);
|
||||
#endif
|
||||
}
|
||||
try { str = Path.GetFullPath(strPath); }
|
||||
catch(Exception) { Debug.Assert(false); return strPath; }
|
||||
|
||||
Debug.Assert((str.IndexOf("\\..\\") < 0) || NativeLib.IsUnix());
|
||||
@@ -703,10 +683,11 @@ namespace ModernKeePassLib.Utility
|
||||
string strDir;
|
||||
if(NativeLib.IsUnix())
|
||||
strDir = NativeMethods.GetUserRuntimeDir();
|
||||
#if KeePassUAP || ModernKeePassLib
|
||||
#if KeePassUAP
|
||||
else strDir = Windows.Storage.ApplicationData.Current.TemporaryFolder.Path;
|
||||
#else
|
||||
else strDir = Path.GetTempPath();
|
||||
#endif
|
||||
|
||||
try
|
||||
{
|
||||
@@ -714,11 +695,10 @@ namespace ModernKeePassLib.Utility
|
||||
}
|
||||
catch(Exception) { Debug.Assert(false); }
|
||||
|
||||
#endif
|
||||
return strDir;
|
||||
}
|
||||
|
||||
#if !ModernKeePassLib && !KeePassLibSD
|
||||
#if !KeePassLibSD
|
||||
// Structurally mostly equivalent to UrlUtil.GetFileInfos
|
||||
public static List<string> GetFilePaths(string strDir, string strPattern,
|
||||
SearchOption opt)
|
||||
|
Reference in New Issue
Block a user