mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-26 03:02:24 -05:00
Merge branch 'master' of https://git01.codeplex.com/keepass2android
This commit is contained in:
commit
d71a204b2c
@ -663,7 +663,7 @@ namespace KeePassLib
|
|||||||
Debug.Assert(ValidateUuidUniqueness());
|
Debug.Assert(ValidateUuidUniqueness());
|
||||||
Stream s = streamOfOriginalLocation;
|
Stream s = streamOfOriginalLocation;
|
||||||
KdbxFile kdb = new KdbxFile(this);
|
KdbxFile kdb = new KdbxFile(this);
|
||||||
kdb.Save(s, null, KdbxFormat.Default, slLogger);
|
kdb.Save(s, null, KdbpFile.GetFormatToUse(m_ioSource), slLogger);
|
||||||
|
|
||||||
m_pbHashOfLastIO = kdb.HashOfFileOnDisk;
|
m_pbHashOfLastIO = kdb.HashOfFileOnDisk;
|
||||||
m_pbHashOfFileOnDisk = kdb.HashOfFileOnDisk;
|
m_pbHashOfFileOnDisk = kdb.HashOfFileOnDisk;
|
||||||
|
@ -136,12 +136,24 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_workerThread = new Thread(runHandler);
|
_workerThread = new Thread(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
runHandler();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Kp2aLog.Log("Error in worker thread of SaveDb: " + e);
|
||||||
|
Finish(false, e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
_workerThread.Start();
|
_workerThread.Start();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Kp2aLog.Log("Error in worker thread of SaveDb: "+e);
|
Kp2aLog.Log("Error starting worker thread of SaveDb: "+e);
|
||||||
Finish(false, e.Message);
|
Finish(false, e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,5 +91,11 @@ namespace Kp2aUnitTests
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestLoadKdbpWithPasswordOnly()
|
||||||
|
{
|
||||||
|
RunLoadTest("passwordonly.kdbp", DefaultPassword, "");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -263,6 +263,48 @@ namespace Kp2aUnitTests
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestLoadKdbxAndSaveKdbp_TestIdenticalFiles()
|
||||||
|
{
|
||||||
|
IKp2aApp app = LoadDatabase(DefaultDirectory + "complexDb.kdbx", "test", null);
|
||||||
|
//string kdbxXml = DatabaseToXml(app);
|
||||||
|
|
||||||
|
newFilename = TestDbDirectory + "tmp_complexDb.kdbp";
|
||||||
|
if (File.Exists(newFilename))
|
||||||
|
File.Delete(newFilename);
|
||||||
|
app.GetDb().KpDatabase.IOConnectionInfo.Path = newFilename;
|
||||||
|
app.GetDb().SaveData(Application.Context);
|
||||||
|
|
||||||
|
|
||||||
|
IKp2aApp appReloaded = LoadDatabase(newFilename, "test", null);
|
||||||
|
/*
|
||||||
|
* Unfortunately we cannot compare the xml because there are slight differences:
|
||||||
|
* - the order of ProtectedStrings in the xml is different (which is ok)
|
||||||
|
* - the CustomIconUuids are serialized as Zeros instead of not being serialized (which is ok as well)
|
||||||
|
string kdbxReloadedXml = DatabaseToXml(appReloaded);
|
||||||
|
|
||||||
|
bool areEqual = kdbxXml.Equals(kdbxReloadedXml);
|
||||||
|
|
||||||
|
if (!areEqual)
|
||||||
|
{
|
||||||
|
using (StreamWriter w1 = File.CreateText(TestDbDirectory + "FromOriginalKdbx.xml"))
|
||||||
|
{
|
||||||
|
w1.Write(kdbxXml);
|
||||||
|
}
|
||||||
|
using (StreamWriter w2 = File.CreateText(TestDbDirectory + "FromKdbp.xml"))
|
||||||
|
{
|
||||||
|
w2.Write(kdbxReloadedXml);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Assert.IsTrue(areEqual, "reloaded->xml differs from loaded->xml");
|
||||||
|
*/
|
||||||
|
AssertDatabasesAreEqual(app.GetDb().KpDatabase, appReloaded.GetDb().KpDatabase);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OnCloseToStringMemoryStream : MemoryStream
|
private class OnCloseToStringMemoryStream : MemoryStream
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:versionCode="15"
|
android:versionCode="16"
|
||||||
android:versionName="0.8.4 preview"
|
android:versionName="0.8.4 preview 2"
|
||||||
package="keepass2android.keepass2android"
|
package="keepass2android.keepass2android"
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14" />
|
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14" />
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:inputType="text"
|
||||||
|
android:hint="@string/field_name" />
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/value"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/title"
|
||||||
|
android:inputType="textMultiLine"
|
||||||
|
android:hint="@string/field_value"/>
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/protection"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/value"
|
||||||
|
android:text="@string/protection"/>
|
||||||
|
<Button
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/protection"
|
||||||
|
android:text="@string/delete_extra_string"
|
||||||
|
android:id="@+id/delete_extra" />
|
||||||
|
</RelativeLayout>
|
Loading…
Reference in New Issue
Block a user