private void TxfPrepare() { try { if (NativeLib.IsUnix()) { return; } if (!m_iocBase.IsLocalFile()) { return; } string strID = StrUtil.AlphaNumericOnly(Convert.ToBase64String( CryptoRandom.Instance.GetRandomBytes(16))); string strTempDir = UrlUtil.GetTempPath(); // See also ClearOld method string strTemp = UrlUtil.EnsureTerminatingSeparator(strTempDir, false) + StrTxfTempPrefix + strID + StrTxfTempSuffix; char chB = UrlUtil.GetDriveLetter(m_iocBase.Path); char chT = UrlUtil.GetDriveLetter(strTemp); if (!TxfIsSupported(chB)) { return; } if ((chT != chB) && !TxfIsSupported(chT)) { return; } m_iocTxfMidFallback = m_iocTemp; #if ModernKeePassLib var tempFile = ApplicationData.Current.TemporaryFolder.CreateFileAsync(m_iocTemp.Path).GetAwaiter() .GetResult(); m_iocTemp = IOConnectionInfo.FromFile(tempFile); #else m_iocTemp = IOConnectionInfo.FromPath(strTemp); #endif m_lToDelete.Add(m_iocTemp); } catch (Exception) { Debug.Assert(false); m_iocTxfMidFallback = null; } }
private void TxfPrepare() { try { if (NativeLib.IsUnix()) { return; } if (!m_iocBase.IsLocalFile()) { return; } if (TxfIsUnusable()) { return; } string strID = StrUtil.AlphaNumericOnly(Convert.ToBase64String( CryptoRandom.Instance.GetRandomBytes(16))); string strTempDir = UrlUtil.GetTempPath(); // See also ClearOld method string strTemp = UrlUtil.EnsureTerminatingSeparator(strTempDir, false) + StrTxfTempPrefix + strID + StrTxfTempSuffix; char chB = UrlUtil.GetDriveLetter(m_iocBase.Path); char chT = UrlUtil.GetDriveLetter(strTemp); if (!TxfIsSupported(chB)) { return; } if ((chT != chB) && !TxfIsSupported(chT)) { return; } m_iocTxfMidFallback = m_iocTemp; m_iocTemp = IOConnectionInfo.FromPath(strTemp); m_lToDelete.Add(m_iocTemp); } catch (Exception) { Debug.Assert(false); m_iocTxfMidFallback = null; } }
public void Load(string strFilePath, KdbxFormat fmt, IStatusLogger slLogger) { IOConnectionInfo ioc = IOConnectionInfo.FromPath(strFilePath); #endif Load(IOConnection.OpenRead(ioc), fmt, slLogger); }