mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
WIP saving
This commit is contained in:
@@ -22,6 +22,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// Bert TODO: For now, remove the accesscontrol from this class.
|
||||
// In WinRT, the security of file has changed, and something could potentially be done
|
||||
@@ -70,7 +71,7 @@ namespace ModernKeePassLib.Serialization
|
||||
else m_iocTemp = m_iocBase;
|
||||
}
|
||||
|
||||
public Stream OpenWrite()
|
||||
public async Task<Stream> OpenWrite()
|
||||
{
|
||||
if(!m_bTransacted) m_bMadeUnhidden = UrlUtil.UnhideFile(m_iocTemp.Path);
|
||||
else // m_bTransacted
|
||||
@@ -79,7 +80,7 @@ namespace ModernKeePassLib.Serialization
|
||||
catch(Exception) { }
|
||||
}
|
||||
|
||||
return IOConnection.OpenWrite(m_iocTemp);
|
||||
return await IOConnection.OpenWrite(m_iocTemp);
|
||||
}
|
||||
|
||||
public void CommitWrite()
|
||||
|
@@ -281,18 +281,24 @@ namespace ModernKeePassLib.Serialization
|
||||
return CreateWebClient(ioc).OpenWrite(uri);
|
||||
}
|
||||
#else
|
||||
public static Stream OpenWrite(IOConnectionInfo ioc)
|
||||
public async static Task<Stream> OpenWrite(IOConnectionInfo ioc)
|
||||
{
|
||||
return OpenWriteLocal(ioc);
|
||||
return await OpenWriteLocal(ioc);
|
||||
}
|
||||
#endif
|
||||
|
||||
private static Stream OpenWriteLocal(IOConnectionInfo ioc)
|
||||
private async static Task<Stream> OpenWriteLocal(IOConnectionInfo ioc)
|
||||
{
|
||||
Debug.Assert(false, "Not implemented yet");
|
||||
return null;
|
||||
// return new FileStream(ioc.Path, FileMode.Create, FileAccess.Write,
|
||||
// FileShare.None);
|
||||
try
|
||||
{
|
||||
IRandomAccessStream stream = await ioc.StorageFile.OpenAsync(FileAccessMode.ReadWrite);
|
||||
return stream.AsStream();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Assert(false, ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool FileExists(IOConnectionInfo ioc)
|
||||
|
Reference in New Issue
Block a user