OpenWriteLocal now creates a memory stream from bytes

This commit is contained in:
Geoffroy BONNEVILLE
2019-08-19 13:48:34 +02:00
parent cd9da40499
commit 46e54ab00f
2 changed files with 1 additions and 5 deletions

View File

@@ -225,9 +225,7 @@ namespace ModernKeePassLib.Serialization
try { if(bEfsEncrypted) File.Decrypt(m_iocBase.Path); } // For TxF try { if(bEfsEncrypted) File.Decrypt(m_iocBase.Path); } // For TxF
catch(Exception) { Debug.Assert(false); } catch(Exception) { Debug.Assert(false); }
#endif #endif
#if !ModernKeePassLib
otCreation = File.GetCreationTimeUtc(m_iocBase.Path); otCreation = File.GetCreationTimeUtc(m_iocBase.Path);
#endif
#if !ModernKeePassLib #if !ModernKeePassLib
// May throw with Mono // May throw with Mono
FileSecurity sec = File.GetAccessControl(m_iocBase.Path, acs); FileSecurity sec = File.GetAccessControl(m_iocBase.Path, acs);
@@ -256,9 +254,7 @@ namespace ModernKeePassLib.Serialization
#if !ModernKeePassLib #if !ModernKeePassLib
if(otCreation.HasValue && (otCreation.Value.Year >= 1971)) if(otCreation.HasValue && (otCreation.Value.Year >= 1971))
File.SetCreationTimeUtc(m_iocBase.Path, otCreation.Value); File.SetCreationTimeUtc(m_iocBase.Path, otCreation.Value);
#endif
#if !ModernKeePassLib
if(bEfsEncrypted) if(bEfsEncrypted)
{ {
try { File.Encrypt(m_iocBase.Path); } try { File.Encrypt(m_iocBase.Path); }

View File

@@ -635,7 +635,7 @@ namespace ModernKeePassLib.Serialization
private static Stream OpenWriteLocal(IOConnectionInfo ioc) private static Stream OpenWriteLocal(IOConnectionInfo ioc)
{ {
#if ModernKeePassLib #if ModernKeePassLib
return new MemoryStream(); return new MemoryStream(ioc.Bytes);
#else #else
return new FileStream(ioc.Path, FileMode.Create, FileAccess.Write, return new FileStream(ioc.Path, FileMode.Create, FileAccess.Write,
FileShare.None); FileShare.None);