remove old (pre-sdk-style) projects, rename sdk style projects to have the names of the old ones. adjust the .sln and .csproj files accordingly. This is a bit like a squash commit, as it shows the diff between the pre-sdk-style code with the updated code (sdk-style, Material3, Zxing=>GMS CodeScanner, Kdbp support removed)
This commit is contained in:
1
src/KeePassLib2Android/.gitignore
vendored
1
src/KeePassLib2Android/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
obj/
|
||||
@@ -1,186 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>KeePassLib2Android</RootNamespace>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AssemblyName>KeePassLib2Android</AssemblyName>
|
||||
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
||||
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
||||
<NuGetPackageImportStamp>8482b288</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;_EXCLUDE_KEYBOARD;_EXCLUDE_FILECHOOSER;_EXCLUDE_JAVAFILESTORAGE;INCLUDE_KEYTRANSFORM</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>5</WarningLevel>
|
||||
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseNoNet|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\ReleaseNoNet</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
|
||||
<ConsolePause>False</ConsolePause>
|
||||
<TargetFramework>net8.0-android</TargetFramework>
|
||||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="protobuf-net">
|
||||
<HintPath>..\ProtoBuf\protobuf-net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="OpenTK-1.0" />
|
||||
<Reference Include="Mono.Security" />
|
||||
<None Remove="Resources\values\Strings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Collections\ProtectedBinarySet.cs" />
|
||||
<Compile Include="Collections\VariantDictionary.cs" />
|
||||
<Compile Include="Cryptography\Cipher\ChaCha20Cipher.cs" />
|
||||
<Compile Include="Cryptography\Cipher\ChaCha20Engine.cs" />
|
||||
<Compile Include="Cryptography\Cipher\CtrBlockCipher.cs" />
|
||||
<Compile Include="Cryptography\CryptoUtil.cs" />
|
||||
<Compile Include="Cryptography\Hash\Blake2b.cs" />
|
||||
<Compile Include="Cryptography\KeyDerivation\AesKdf.cs" />
|
||||
<Compile Include="Cryptography\KeyDerivation\Argon2Kdf.Core.cs" />
|
||||
<Compile Include="Cryptography\KeyDerivation\Argon2Kdf.cs" />
|
||||
<Compile Include="Cryptography\KeyDerivation\KdfEngine.cs" />
|
||||
<Compile Include="Cryptography\KeyDerivation\KdfParameters.cs" />
|
||||
<Compile Include="Cryptography\KeyDerivation\KdfPool.cs" />
|
||||
<Compile Include="IDatabaseFormat.cs" />
|
||||
<Compile Include="Keys\KcpKeyFile.Xml.cs" />
|
||||
<Compile Include="Kp2aLog.cs" />
|
||||
<Compile Include="PwGroup.Search.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Resources\KLRes.Generated.cs" />
|
||||
<Compile Include="Resources\KSRes.Generated.cs" />
|
||||
<Compile Include="Collections\AutoTypeConfig.cs" />
|
||||
<Compile Include="Collections\ProtectedBinaryDictionary.cs" />
|
||||
<Compile Include="Collections\ProtectedStringDictionary.cs" />
|
||||
<Compile Include="Collections\PwObjectList.cs" />
|
||||
<Compile Include="Collections\PwObjectPool.cs" />
|
||||
<Compile Include="Collections\StringDictionaryEx.cs" />
|
||||
<Compile Include="Cryptography\Cipher\CipherPool.cs" />
|
||||
<Compile Include="Cryptography\Cipher\Salsa20Cipher.cs" />
|
||||
<Compile Include="Cryptography\Cipher\StandardAesEngine.cs" />
|
||||
<Compile Include="Cryptography\CryptoRandom.cs" />
|
||||
<Compile Include="Cryptography\CryptoRandomStream.cs" />
|
||||
<Compile Include="Cryptography\Cipher\ICipherEngine.cs" />
|
||||
<Compile Include="Cryptography\HashingStreamEx.cs" />
|
||||
<Compile Include="Cryptography\HmacOtp.cs" />
|
||||
<Compile Include="Cryptography\PasswordGenerator\CharSetBasedGenerator.cs" />
|
||||
<Compile Include="Cryptography\PasswordGenerator\CustomPwGenerator.cs" />
|
||||
<Compile Include="Cryptography\PasswordGenerator\CustomPwGeneratorPool.cs" />
|
||||
<Compile Include="Cryptography\PasswordGenerator\PatternBasedGenerator.cs" />
|
||||
<Compile Include="Cryptography\PasswordGenerator\PwCharSet.cs" />
|
||||
<Compile Include="Cryptography\PasswordGenerator\PwProfile.cs" />
|
||||
<Compile Include="Cryptography\PopularPasswords.cs" />
|
||||
<Compile Include="Cryptography\QualityEstimation.cs" />
|
||||
<Compile Include="Cryptography\PasswordGenerator\PwGenerator.cs" />
|
||||
<Compile Include="PwCustomIcon.cs" />
|
||||
<Compile Include="PwDatabase.cs" />
|
||||
<Compile Include="PwDefs.cs" />
|
||||
<Compile Include="PwDeletedObject.cs" />
|
||||
<Compile Include="PwEntry.cs" />
|
||||
<Compile Include="PwEnums.cs" />
|
||||
<Compile Include="PwGroup.cs" />
|
||||
<Compile Include="PwUuid.cs" />
|
||||
<Compile Include="Interfaces\IStructureItem.cs" />
|
||||
<Compile Include="Interfaces\IUIOperations.cs" />
|
||||
<Compile Include="Interfaces\IXmlSerializerEx.cs" />
|
||||
<Compile Include="Interfaces\IDeepCloneable.cs" />
|
||||
<Compile Include="Interfaces\IStatusLogger.cs" />
|
||||
<Compile Include="Interfaces\ITimeLogger.cs" />
|
||||
<Compile Include="Keys\KcpCustomKey.cs" />
|
||||
<Compile Include="Keys\KeyProvider.cs" />
|
||||
<Compile Include="Keys\KeyProviderPool.cs" />
|
||||
<Compile Include="Keys\KeyValidator.cs" />
|
||||
<Compile Include="Keys\KeyValidatorPool.cs" />
|
||||
<Compile Include="Keys\UserKeyType.cs" />
|
||||
<Compile Include="Keys\KcpKeyFile.cs" />
|
||||
<Compile Include="Keys\IUserKey.cs" />
|
||||
<Compile Include="Keys\KcpPassword.cs" />
|
||||
<Compile Include="Keys\KcpUserAccount.cs" />
|
||||
<Compile Include="Keys\CompositeKey.cs" />
|
||||
<Compile Include="Native\NativeMethods.cs" />
|
||||
<Compile Include="Native\NativeLib.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Security\XorredBuffer.cs" />
|
||||
<Compile Include="Security\ProtectedBinary.cs" />
|
||||
<Compile Include="Security\ProtectedString.cs" />
|
||||
<Compile Include="Serialization\BinaryReaderEx.cs" />
|
||||
<Compile Include="Serialization\FileLock.cs" />
|
||||
<Compile Include="Serialization\FileTransactionEx.cs" />
|
||||
<Compile Include="Serialization\HashedBlockStream.cs" />
|
||||
<Compile Include="Serialization\HmacBlockStream.cs" />
|
||||
<Compile Include="Serialization\IOConnection.cs">
|
||||
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KP2AKdbLibraryBinding\KP2AKdbLibraryBinding.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Update="Resources\values\Strings.xml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:UpdateGeneratedFiles</Generator>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Serialization\IOConnection.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Serialization\IocProperties.cs" />
|
||||
<Compile Include="Serialization\IocPropertyInfo.cs" />
|
||||
<Compile Include="Serialization\IocPropertyInfoPool.cs" />
|
||||
<Compile Include="Serialization\KdbxFile.cs" />
|
||||
<Compile Include="Serialization\KdbxFile.Read.cs" />
|
||||
<Compile Include="Serialization\KdbxFile.Read.Streamed.cs" />
|
||||
<Compile Include="Serialization\KdbxFile.Write.cs" />
|
||||
<Compile Include="Serialization\IOConnectionInfo.cs" />
|
||||
<Compile Include="Serialization\OldFormatException.cs" />
|
||||
<Compile Include="Translation\KPStringTable.cs" />
|
||||
<Compile Include="Translation\KPStringTableItem.cs" />
|
||||
<Compile Include="Translation\KPTranslation.cs" />
|
||||
<Compile Include="Translation\KPTranslationProperties.cs" />
|
||||
<Compile Include="Utility\AppLogEx.cs" />
|
||||
<Compile Include="Utility\GfxUtil.cs" />
|
||||
<Compile Include="Utility\MemUtil.cs" />
|
||||
<Compile Include="Utility\MessageService.cs" />
|
||||
<Compile Include="Utility\MonoWorkarounds.cs" />
|
||||
<Compile Include="Utility\StrUtil.cs" />
|
||||
<Compile Include="Utility\UrlUtil.cs" />
|
||||
<Compile Include="Utility\TimeUtil.cs" />
|
||||
<Compile Include="Delegates\Handlers.cs" />
|
||||
<Compile Include="Utility\XmlUtilEx.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="KeePassLib.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KP2AKdbLibraryBinding\KP2AKdbLibraryBinding.csproj">
|
||||
<Project>{70D3844A-D9FA-4A64-B205-A84C6A822196}</Project>
|
||||
<Name>KP2AKdbLibraryBinding</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Serialization\ProtoBuf\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -108,8 +108,12 @@ namespace keepass2android
|
||||
|
||||
public static void SendLog(Context ctx)
|
||||
{
|
||||
if (!File.Exists(LogFilename))
|
||||
return;
|
||||
if (!File.Exists(LogFilename))
|
||||
{
|
||||
Toast.MakeText(ctx, "Debug log is empty.", ToastLength.Long).Show();
|
||||
return;
|
||||
}
|
||||
|
||||
Intent sendIntent = new Intent();
|
||||
sendIntent.SetAction(Intent.ActionSend);
|
||||
sendIntent.PutExtra(Intent.ExtraText, File.ReadAllText(LogFilename));
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
KeePass Password Safe - The Open-Source Password Manager
|
||||
Copyright (C) 2003-2017 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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
#if !KeePassUAP
|
||||
using System.Windows.Forms;
|
||||
#endif
|
||||
|
||||
namespace KeePassLib.Native
|
||||
{
|
||||
internal static partial class NativeMethods
|
||||
{
|
||||
#if (!KeePassLibSD && !KeePassUAP)
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct XClassHint
|
||||
{
|
||||
public IntPtr res_name;
|
||||
public IntPtr res_class;
|
||||
}
|
||||
|
||||
[DllImport("libX11")]
|
||||
private static extern int XSetClassHint(IntPtr display, IntPtr window, IntPtr class_hints);
|
||||
|
||||
private static Type m_tXplatUIX11 = null;
|
||||
private static Type GetXplatUIX11Type(bool bThrowOnError)
|
||||
{
|
||||
if(m_tXplatUIX11 == null)
|
||||
{
|
||||
// CheckState is in System.Windows.Forms
|
||||
string strTypeCS = typeof(CheckState).AssemblyQualifiedName;
|
||||
string strTypeX11 = strTypeCS.Replace("CheckState", "XplatUIX11");
|
||||
m_tXplatUIX11 = Type.GetType(strTypeX11, bThrowOnError, true);
|
||||
}
|
||||
|
||||
return m_tXplatUIX11;
|
||||
}
|
||||
|
||||
private static Type m_tHwnd = null;
|
||||
private static Type GetHwndType(bool bThrowOnError)
|
||||
{
|
||||
if(m_tHwnd == null)
|
||||
{
|
||||
// CheckState is in System.Windows.Forms
|
||||
string strTypeCS = typeof(CheckState).AssemblyQualifiedName;
|
||||
string strTypeHwnd = strTypeCS.Replace("CheckState", "Hwnd");
|
||||
m_tHwnd = Type.GetType(strTypeHwnd, bThrowOnError, true);
|
||||
}
|
||||
|
||||
return m_tHwnd;
|
||||
}
|
||||
|
||||
internal static void SetWmClass(Form f, string strName, string strClass)
|
||||
{
|
||||
if(f == null) { Debug.Assert(false); return; }
|
||||
|
||||
// The following crashes under Mac OS X (SIGSEGV in native code,
|
||||
// not just an exception), thus skip it when we're on Mac OS X;
|
||||
// https://sourceforge.net/projects/keepass/forums/forum/329221/topic/5860588
|
||||
if(NativeLib.GetPlatformID() == PlatformID.MacOSX) return;
|
||||
|
||||
try
|
||||
{
|
||||
Type tXplatUIX11 = GetXplatUIX11Type(true);
|
||||
FieldInfo fiDisplayHandle = tXplatUIX11.GetField("DisplayHandle",
|
||||
BindingFlags.NonPublic | BindingFlags.Static);
|
||||
IntPtr hDisplay = (IntPtr)fiDisplayHandle.GetValue(null);
|
||||
|
||||
Type tHwnd = GetHwndType(true);
|
||||
MethodInfo miObjectFromHandle = tHwnd.GetMethod("ObjectFromHandle",
|
||||
BindingFlags.Public | BindingFlags.Static);
|
||||
object oHwnd = miObjectFromHandle.Invoke(null, new object[] { f.Handle });
|
||||
|
||||
FieldInfo fiWholeWindow = tHwnd.GetField("whole_window",
|
||||
BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
IntPtr hWindow = (IntPtr)fiWholeWindow.GetValue(oHwnd);
|
||||
|
||||
XClassHint xch = new XClassHint();
|
||||
xch.res_name = Marshal.StringToCoTaskMemAnsi(strName ?? string.Empty);
|
||||
xch.res_class = Marshal.StringToCoTaskMemAnsi(strClass ?? string.Empty);
|
||||
IntPtr pXch = Marshal.AllocCoTaskMem(Marshal.SizeOf(xch));
|
||||
Marshal.StructureToPtr(xch, pXch, false);
|
||||
|
||||
XSetClassHint(hDisplay, hWindow, pXch);
|
||||
|
||||
Marshal.FreeCoTaskMem(pXch);
|
||||
Marshal.FreeCoTaskMem(xch.res_name);
|
||||
Marshal.FreeCoTaskMem(xch.res_class);
|
||||
}
|
||||
catch(Exception) { Debug.Assert(false); }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
KeePass Password Safe - The Open-Source Password Manager
|
||||
Copyright (C) 2003-2017 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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General assembly properties
|
||||
[assembly: AssemblyTitle("KeePassLib")]
|
||||
[assembly: AssemblyDescription("KeePass Password Management Library")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Dominik Reichl")]
|
||||
[assembly: AssemblyProduct("KeePassLib")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2003-2017 Dominik Reichl")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// COM settings
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Assembly GUID
|
||||
[assembly: Guid("395f6eec-a1e0-4438-aa82-b75099348134")]
|
||||
|
||||
// Assembly version information
|
||||
[assembly: AssemblyVersion("2.35.0.*")]
|
||||
[assembly: AssemblyFileVersion("2.35.0.0")]
|
||||
@@ -107,7 +107,7 @@ namespace KeePassLib.Serialization
|
||||
try
|
||||
{
|
||||
Stream sXml;
|
||||
if (fmt == KdbxFormat.Default || fmt == KdbxFormat.ProtocolBuffers)
|
||||
if (fmt == KdbxFormat.Default)
|
||||
{
|
||||
BinaryReaderEx br = new BinaryReaderEx(sHashing,
|
||||
encNoBom, KLRes.FileCorrupted);
|
||||
@@ -229,10 +229,7 @@ namespace KeePassLib.Serialization
|
||||
|
||||
if (fmt == KdbxFormat.ProtocolBuffers)
|
||||
{
|
||||
KdbpFile.ReadDocument(m_pwDatabase, sXml, m_pbInnerRandomStreamKey, m_pbHashOfHeader);
|
||||
|
||||
Kp2aLog.Log(String.Format("KdbpFile.ReadDocument: {0}ms", stopWatch.ElapsedMilliseconds));
|
||||
|
||||
throw new Exception("kdbp is deprecated and was removed to simplify the build process.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -210,35 +210,29 @@ namespace KeePassLib.Serialization
|
||||
|
||||
var stopWatch = Stopwatch.StartNew();
|
||||
|
||||
if (m_format == KdbxFormat.ProtocolBuffers)
|
||||
{
|
||||
KdbpFile.WriteDocument(m_pwDatabase, sXml, m_pbInnerRandomStreamKey, m_pbHashOfHeader);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#if KeePassUAP
|
||||
XmlWriterSettings xws = new XmlWriterSettings();
|
||||
xws.Encoding = encNoBom;
|
||||
xws.Indent = true;
|
||||
xws.IndentChars = "\t";
|
||||
xws.NewLineOnAttributes = false;
|
||||
XmlWriterSettings xws = new XmlWriterSettings();
|
||||
xws.Encoding = encNoBom;
|
||||
xws.Indent = true;
|
||||
xws.IndentChars = "\t";
|
||||
xws.NewLineOnAttributes = false;
|
||||
|
||||
XmlWriter xw = XmlWriter.Create(sXml, xws);
|
||||
XmlWriter xw = XmlWriter.Create(sXml, xws);
|
||||
#else
|
||||
XmlTextWriter xw = new XmlTextWriter(sXml, encNoBom);
|
||||
XmlTextWriter xw = new XmlTextWriter(sXml, encNoBom);
|
||||
|
||||
xw.Formatting = Formatting.Indented;
|
||||
xw.IndentChar = '\t';
|
||||
xw.Indentation = 1;
|
||||
xw.Formatting = Formatting.Indented;
|
||||
xw.IndentChar = '\t';
|
||||
xw.Indentation = 1;
|
||||
#endif
|
||||
m_xmlWriter = xw;
|
||||
m_xmlWriter = xw;
|
||||
|
||||
WriteDocument(pgRoot);
|
||||
|
||||
m_xmlWriter.Flush();
|
||||
m_xmlWriter.Close();
|
||||
}
|
||||
m_xmlWriter.Flush();
|
||||
m_xmlWriter.Close();
|
||||
|
||||
Kp2aLog.Log(String.Format("{1}: {0}ms", stopWatch.ElapsedMilliseconds, m_format == KdbxFormat.ProtocolBuffers ? "KdbpFile.WriteDocument" : "Xml WriteDocument"));
|
||||
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ namespace KeePassLib.Serialization
|
||||
/// Use this flag when exporting data to a plain-text XML file.
|
||||
/// </summary>
|
||||
PlainXml,
|
||||
|
||||
//Deprecated
|
||||
ProtocolBuffers
|
||||
}
|
||||
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
KeePass Password Safe - The Open-Source Password Manager
|
||||
Copyright (C) 2003-2017 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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
#if !KeePassUAP
|
||||
using System.Windows.Forms;
|
||||
#endif
|
||||
|
||||
namespace KeePassLib.Translation
|
||||
{
|
||||
public sealed class KPFormCustomization
|
||||
{
|
||||
private string m_strFQName = string.Empty;
|
||||
/// <summary>
|
||||
/// The fully qualified name of the form.
|
||||
/// </summary>
|
||||
[XmlAttribute]
|
||||
public string FullName
|
||||
{
|
||||
get { return m_strFQName; }
|
||||
set
|
||||
{
|
||||
if(value == null) throw new ArgumentNullException("value");
|
||||
m_strFQName = value;
|
||||
}
|
||||
}
|
||||
|
||||
private KPControlCustomization m_ccWindow = new KPControlCustomization();
|
||||
public KPControlCustomization Window
|
||||
{
|
||||
get { return m_ccWindow; }
|
||||
set { m_ccWindow = value; }
|
||||
}
|
||||
|
||||
private List<KPControlCustomization> m_vControls =
|
||||
new List<KPControlCustomization>();
|
||||
[XmlArray("ChildControls")]
|
||||
[XmlArrayItem("Control")]
|
||||
public List<KPControlCustomization> Controls
|
||||
{
|
||||
get { return m_vControls; }
|
||||
set
|
||||
{
|
||||
if(value == null) throw new ArgumentNullException("value");
|
||||
|
||||
m_vControls = value;
|
||||
}
|
||||
}
|
||||
|
||||
#if (!KeePassLibSD && !KeePassUAP)
|
||||
private Form m_formEnglish = null;
|
||||
[XmlIgnore]
|
||||
public Form FormEnglish
|
||||
{
|
||||
get { return m_formEnglish; }
|
||||
set { m_formEnglish = value; }
|
||||
}
|
||||
|
||||
public void ApplyTo(Form form)
|
||||
{
|
||||
Debug.Assert(form != null); if(form == null) throw new ArgumentNullException("form");
|
||||
|
||||
// Not supported by TrlUtil (preview form):
|
||||
// Debug.Assert(form.GetType().FullName == m_strFQName);
|
||||
|
||||
m_ccWindow.ApplyTo(form);
|
||||
|
||||
if(m_vControls.Count == 0) return;
|
||||
foreach(Control c in form.Controls) ApplyToControl(c);
|
||||
}
|
||||
|
||||
private void ApplyToControl(Control c)
|
||||
{
|
||||
foreach(KPControlCustomization cc in m_vControls)
|
||||
{
|
||||
if(c.Name == cc.Name)
|
||||
{
|
||||
cc.ApplyTo(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach(Control cSub in c.Controls) ApplyToControl(cSub);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -687,6 +687,25 @@ namespace KeePassLib.Utility
|
||||
return false;
|
||||
}
|
||||
|
||||
public static string GetTempPath()
|
||||
{
|
||||
string strDir;
|
||||
if (NativeLib.IsUnix())
|
||||
strDir = NativeMethods.GetUserRuntimeDir();
|
||||
#if KeePassUAP
|
||||
else strDir = Windows.Storage.ApplicationData.Current.TemporaryFolder.Path;
|
||||
#else
|
||||
else strDir = Path.GetTempPath();
|
||||
#endif
|
||||
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(strDir)) Directory.CreateDirectory(strDir);
|
||||
}
|
||||
catch (Exception) { Debug.Assert(false); }
|
||||
|
||||
return strDir;
|
||||
}
|
||||
|
||||
#if !KeePassLibSD
|
||||
// Structurally mostly equivalent to UrlUtil.GetFileInfos
|
||||
|
||||
Reference in New Issue
Block a user