mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-04 08:00:16 -04:00
Read-mode working
Write-mode does not create exceptions but still doesn't work
This commit is contained in:
@@ -43,6 +43,7 @@ using ModernKeePassLibPCL.Keys;
|
||||
using ModernKeePassLibPCL.Resources;
|
||||
using ModernKeePassLibPCL.Utility;
|
||||
using Windows.Security.Cryptography.Core;
|
||||
using Windows.Storage.Streams;
|
||||
|
||||
namespace ModernKeePassLibPCL.Serialization
|
||||
{
|
||||
@@ -70,7 +71,7 @@ namespace ModernKeePassLibPCL.Serialization
|
||||
/// a KDBX stream.</param>
|
||||
/// <param name="kdbFormat">Format specifier.</param>
|
||||
/// <param name="slLogger">Status logger (optional).</param>
|
||||
public void Load(Stream sSource, KdbxFormat kdbFormat, IStatusLogger slLogger)
|
||||
public void Load(IRandomAccessStream sSource, KdbxFormat kdbFormat, IStatusLogger slLogger)
|
||||
{
|
||||
Debug.Assert(sSource != null);
|
||||
if(sSource == null) throw new ArgumentNullException("sSource");
|
||||
@@ -78,7 +79,7 @@ namespace ModernKeePassLibPCL.Serialization
|
||||
m_format = kdbFormat;
|
||||
m_slLogger = slLogger;
|
||||
|
||||
HashingStreamEx hashedStream = new HashingStreamEx(sSource, false, null);
|
||||
HashingStreamEx hashedStream = new HashingStreamEx(sSource.AsStream(), false, null);
|
||||
|
||||
UTF8Encoding encNoBom = StrUtil.Utf8;
|
||||
try
|
||||
@@ -164,7 +165,7 @@ namespace ModernKeePassLibPCL.Serialization
|
||||
finally { CommonCleanUpRead(sSource, hashedStream); }
|
||||
}
|
||||
|
||||
private void CommonCleanUpRead(Stream sSource, HashingStreamEx hashedStream)
|
||||
private void CommonCleanUpRead(IRandomAccessStream sSource, HashingStreamEx hashedStream)
|
||||
{
|
||||
hashedStream.Dispose();
|
||||
m_pbHashOfFileOnDisk = hashedStream.Hash;
|
||||
@@ -375,7 +376,7 @@ namespace ModernKeePassLibPCL.Serialization
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public static List<PwEntry> ReadEntries(PwDatabase pwDatabase, Stream msData)
|
||||
public static List<PwEntry> ReadEntries(PwDatabase pwDatabase, IRandomAccessStream msData)
|
||||
{
|
||||
return ReadEntries(msData);
|
||||
}
|
||||
@@ -385,7 +386,7 @@ namespace ModernKeePassLibPCL.Serialization
|
||||
/// </summary>
|
||||
/// <param name="msData">Input stream to read the entries from.</param>
|
||||
/// <returns>Extracted entries.</returns>
|
||||
public static List<PwEntry> ReadEntries(Stream msData)
|
||||
public static List<PwEntry> ReadEntries(IRandomAccessStream msData)
|
||||
{
|
||||
/* KdbxFile f = new KdbxFile(pwDatabase);
|
||||
f.m_format = KdbxFormat.PlainXml;
|
||||
|
Reference in New Issue
Block a user