Populated readme file

Removed version check for XML writes
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-24 15:35:50 +02:00
parent 2239169e3c
commit ed4d3201af
6 changed files with 47 additions and 18 deletions

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard1.2</TargetFramework>
<Description>Portable KeePass Password Management Library that targets .Net Standard and WinRT. Allows reading, editing and writing to KeePass 2.x databases.</Description>
<Version>2.44.2</Version>
<Version>2.44.3</Version>
<Authors>Geoffroy Bonneville</Authors>
<Company>wismna</Company>
<PackageProjectUrl>https://github.com/wismna/ModernKeePass</PackageProjectUrl>
@@ -55,7 +55,7 @@
<PackageReference Include="Portable.BouncyCastle" Version="1.8.5" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0005" />
<PackageReference Include="Splat" Version="3.0.0" />
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.3.0" />
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.7.0" />
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
</ItemGroup>

View File

@@ -204,7 +204,7 @@ namespace ModernKeePassLib.Serialization
throw new ArgumentOutOfRangeException("fmt");
}
m_xmlWriter = XmlUtilEx.CreateXmlWriter(sXml, m_uFileVersion >= FileVersion32_4);
m_xmlWriter = XmlUtilEx.CreateXmlWriter(sXml);
WriteDocument(pgRoot);

View File

@@ -34,11 +34,11 @@ namespace ModernKeePassLib.Utility
{
XmlDocument d = new XmlDocument();
// .NET 4.5.2 and newer do not resolve external XML resources
// by default; for older .NET versions, we explicitly
// prevent resolving
// .NET 4.5.2 and newer do not resolve external XML resources
// by default; for older .NET versions, we explicitly
// prevent resolving
#if !ModernKeePassLib
d.XmlResolver = null; // Default in old .NET: XmlUrlResolver object
d.XmlResolver = null; // Default in old .NET: XmlUrlResolver object
#endif
return d;
@@ -74,28 +74,24 @@ namespace ModernKeePassLib.Utility
return XmlReader.Create(s, CreateXmlReaderSettings());
}
public static XmlWriterSettings CreateXmlWriterSettings(bool isVersionGreaterThan4 = false)
public static XmlWriterSettings CreateXmlWriterSettings()
{
XmlWriterSettings xws = new XmlWriterSettings();
xws.CloseOutput = isVersionGreaterThan4;
xws.CloseOutput = false;
xws.Encoding = StrUtil.Utf8;
xws.Indent = true;
xws.IndentChars = "\t";
xws.NewLineOnAttributes = false;
#if ModernKeePassLib
// This is needed for Argon2Kdf write
xws.Async = true;
#endif
return xws;
}
public static XmlWriter CreateXmlWriter(Stream s, bool isVersionGreaterThan4 = false)
public static XmlWriter CreateXmlWriter(Stream s)
{
if(s == null) { Debug.Assert(false); throw new ArgumentNullException("s"); }
return XmlWriter.Create(s, CreateXmlWriterSettings(isVersionGreaterThan4));
return XmlWriter.Create(s, CreateXmlWriterSettings());
}
public static void Serialize<T>(Stream s, T t)