Update Lib to version 2.44

Update nuget packages
This commit is contained in:
Geoffroy BONNEVILLE
2020-03-16 15:28:05 +01:00
parent 3a85b60e58
commit b8240d482f
108 changed files with 1102 additions and 595 deletions

View File

@@ -1,6 +1,6 @@
/*
KeePass Password Safe - The Open-Source Password Manager
Copyright (C) 2003-2019 Dominik Reichl <dominik.reichl@t-online.de>
Copyright (C) 2003-2020 Dominik Reichl <dominik.reichl@t-online.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -108,7 +108,7 @@ namespace ModernKeePassLib
private IStatusLogger m_slStatus = null;
private static string m_strLocalizedAppName = string.Empty;
private static string g_strLocalizedAppName = string.Empty;
// private const string StrBackupExtension = ".bak";
@@ -116,16 +116,14 @@ namespace ModernKeePassLib
/// Get the root group that contains all groups and entries stored in the
/// database.
/// </summary>
/// <returns>Root group. The return value is <c>null</c>, if no database
/// has been opened.</returns>
/// <returns>Root group. The return value is <c>null</c>, if the database
/// is not open.</returns>
public PwGroup RootGroup
{
get { return m_pgRootGroup; }
set
{
Debug.Assert(value != null);
if(value == null) throw new ArgumentNullException("value");
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_pgRootGroup = value;
}
}
@@ -167,8 +165,7 @@ namespace ModernKeePassLib
get { return m_pwUserKey; }
set
{
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_pwUserKey = value;
}
}
@@ -187,8 +184,8 @@ namespace ModernKeePassLib
get { return m_strName; }
set
{
Debug.Assert(value != null);
if(value != null) m_strName = value;
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_strName = value;
}
}
@@ -206,8 +203,8 @@ namespace ModernKeePassLib
get { return m_strDesc; }
set
{
Debug.Assert(value != null);
if(value != null) m_strDesc = value;
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_strDesc = value;
}
}
@@ -225,8 +222,8 @@ namespace ModernKeePassLib
get { return m_strDefaultUserName; }
set
{
Debug.Assert(value != null);
if(value != null) m_strDefaultUserName = value;
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_strDefaultUserName = value;
}
}
@@ -284,8 +281,8 @@ namespace ModernKeePassLib
get { return m_uuidDataCipher; }
set
{
Debug.Assert(value != null);
if(value != null) m_uuidDataCipher = value;
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_uuidDataCipher = value;
}
}
@@ -312,7 +309,7 @@ namespace ModernKeePassLib
get { return m_kdfParams; }
set
{
if(value == null) throw new ArgumentNullException("value");
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_kdfParams = value;
}
}
@@ -325,8 +322,7 @@ namespace ModernKeePassLib
get { return m_memProtConfig; }
set
{
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_memProtConfig = value;
}
}
@@ -362,7 +358,7 @@ namespace ModernKeePassLib
get { return m_pwLastSelectedGroup; }
set
{
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_pwLastSelectedGroup = value;
}
}
@@ -372,7 +368,7 @@ namespace ModernKeePassLib
get { return m_pwLastTopVisibleGroup; }
set
{
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_pwLastTopVisibleGroup = value;
}
}
@@ -388,7 +384,7 @@ namespace ModernKeePassLib
get { return m_pwRecycleBin; }
set
{
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_pwRecycleBin = value;
}
}
@@ -408,7 +404,7 @@ namespace ModernKeePassLib
get { return m_pwEntryTemplatesGroup; }
set
{
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
m_pwEntryTemplatesGroup = value;
}
}
@@ -512,8 +508,12 @@ namespace ModernKeePassLib
/// </summary>
public static string LocalizedAppName
{
get { return m_strLocalizedAppName; }
set { Debug.Assert(value != null); m_strLocalizedAppName = value; }
get { return g_strLocalizedAppName; }
set
{
if(value == null) { Debug.Assert(false); throw new ArgumentNullException("value"); }
g_strLocalizedAppName = value;
}
}
/// <summary>
@@ -521,8 +521,6 @@ namespace ModernKeePassLib
/// </summary>
public PwDatabase()
{
if(m_bPrimaryCreated == false) m_bPrimaryCreated = true;
Clear();
}
@@ -682,7 +680,7 @@ namespace ModernKeePassLib
#if ModernKeePassLib
IOConnectionInfo.Bytes = ((MemoryStream)s).ToArray();
#endif
}
}
ft.CommitWrite();
}
@@ -908,19 +906,18 @@ namespace ModernKeePassLib
MergeInLocationChanged(m_pgRootGroup, ppOrg, ppSrc);
ppOrg = null; // Pools are now invalid, because the location
ppSrc = null; // changed times have been merged in
// Delete *after* relocating, because relocating might
// empty some groups that are marked for deletion (and
// objects that weren't relocated yet might prevent the
// deletion)
Dictionary<PwUuid, PwDeletedObject> dOrgDel = CreateDeletedObjectsPool();
MergeInDeletionInfo(pdSource.m_vDeletedObjects, dOrgDel);
ApplyDeletions(m_pgRootGroup, dOrgDel);
// The list and the dictionary should be kept in sync
Debug.Assert(m_vDeletedObjects.UCount == (uint)dOrgDel.Count);
}
// Delete *after* relocating, because relocating might empty
// some groups that are marked for deletion (and objects
// that weren't relocated yet might prevent the deletion)
Dictionary<PwUuid, PwDeletedObject> dOrgDel = CreateDeletedObjectsPool();
if(mm == PwMergeMethod.Synchronize)
MergeInDeletionInfo(pdSource.m_vDeletedObjects, dOrgDel);
ApplyDeletions(m_pgRootGroup, dOrgDel);
// The list and the dictionary should be kept in sync
Debug.Assert(m_vDeletedObjects.UCount == (uint)dOrgDel.Count);
// Must be called *after* merging groups, because group UUIDs
// are required for recycle bin and entry template UUIDs
MergeInDbProperties(pdSource, mm);
@@ -1957,16 +1954,22 @@ namespace ModernKeePassLib
return uDeleted;
}
private static List<string> m_lStdFields = null;
private static List<string> g_lDupStdFields = null;
private static bool DupEntriesEqual(PwEntry a, PwEntry b)
{
if(m_lStdFields == null) m_lStdFields = PwDefs.GetStandardFields();
foreach(string strStdKey in m_lStdFields)
if(g_lDupStdFields == null)
{
string strA = a.Strings.ReadSafe(strStdKey);
string strB = b.Strings.ReadSafe(strStdKey);
if(!strA.Equals(strB)) return false;
g_lDupStdFields = PwDefs.GetStandardFields();
if(g_lDupStdFields.Remove(PwDefs.PasswordField))
g_lDupStdFields.Add(PwDefs.PasswordField); // Move to end (perf. opt.)
else { Debug.Assert(false); }
}
foreach(string strStdKey in g_lDupStdFields)
{
ProtectedString psA = a.Strings.GetSafe(strStdKey);
ProtectedString psB = b.Strings.GetSafe(strStdKey);
if(!psA.Equals(psB, false)) return false;
}
foreach(KeyValuePair<string, ProtectedString> kvpA in a.Strings)