Switched to .Net Standard (yet again...)

Changed every PCL call to WinRt
WIP on CompositeKey
This commit is contained in:
bg45
2017-09-23 09:48:31 -04:00
parent 9d78d59a15
commit 32e629231c
2 changed files with 23 additions and 18 deletions

View File

@@ -310,7 +310,8 @@ namespace ModernKeePassLibPCL.Serialization
{ {
#if ModernKeePassLibPCL #if ModernKeePassLibPCL
if(IsLocalFile()) if(IsLocalFile())
return (FileSystem.Current.GetFileFromPathAsync(m_strUrl).Result != null); //return (FileSystem.Current.GetFileFromPathAsync(m_strUrl).Result != null);
return StorageFile.GetFileFromPathAsync(m_strUrl).GetResults() != null;
#else #else
if(IsLocalFile()) return File.Exists(m_strUrl); if(IsLocalFile()) return File.Exists(m_strUrl);
#endif #endif

View File

@@ -376,24 +376,28 @@ namespace ModernKeePassLibPCL.Serialization
string strDesc = UrlUtil.StripExtension(strName); string strDesc = UrlUtil.StripExtension(strName);
strPath += strDesc; strPath += strDesc;
if(iTry > 1) if (iTry > 1)
strPath += " (" + iTry.ToString(NumberFormatInfo.InvariantInfo) + strPath += " (" + iTry.ToString(NumberFormatInfo.InvariantInfo) +
")"; ")";
if(!string.IsNullOrEmpty(strExt)) strPath += "." + strExt; if (!string.IsNullOrEmpty(strExt)) strPath += "." + strExt;
++iTry; ++iTry;
} }
#if ModernKeePassLibPCL #if ModernKeePassLibPCL
while(FileSystem.Current.GetFileFromPathAsync(strPath).Result != null); //while(FileSystem.Current.GetFileFromPathAsync(strPath).Result != null);
while (StorageFile.GetFileFromPathAsync(strPath).GetResults() != null);
#else #else
while(File.Exists(strPath)); while(File.Exists(strPath));
#endif #endif
#if ModernKeePassLibPCL #if ModernKeePassLibPCL
byte[] pbData = pb.ReadData(); byte[] pbData = pb.ReadData();
var file = FileSystem.Current.GetFileFromPathAsync(strPath).Result; /*var file = FileSystem.Current.GetFileFromPathAsync(strPath).Result;
using (var stream = file.OpenAsync(FileAccess.ReadAndWrite).Result) { using (var stream = file.OpenAsync(FileAccess.ReadAndWrite).Result) {*/
var file = StorageFile.GetFileFromPathAsync(strPath).GetResults();
using (var stream = file.OpenAsync(FileAccessMode.ReadWrite).GetResults().AsStream())
{
stream.Write (pbData, 0, pbData.Length); stream.Write (pbData, 0, pbData.Length);
} }
MemUtil.ZeroByteArray(pbData); MemUtil.ZeroByteArray(pbData);