Merge branch 'AlexVallat/Keepass2AndroidPerfOpt'

Conflicts:
	src/KeePassLib2Android/Serialization/IOConnection.cs
	src/Kp2aBusinessLogic/IKp2aApp.cs
	src/Kp2aBusinessLogic/database/Database.cs
	src/keepass2android/Resources/Resource.designer.cs
	src/keepass2android/app/App.cs
	src/keepass2android/fileselect/FileSelectActivity.cs
This commit is contained in:
Philipp Crocoll
2013-08-10 20:25:10 +02:00
48 changed files with 1002 additions and 729 deletions

View File

@@ -26,16 +26,29 @@ namespace keepass2android
{
private static bool? _logToFile;
private static object _fileLocker = new object();
public static void Log(string message)
{
Android.Util.Log.Debug("KP2A", message);
if (LogToFile)
{
using (var streamWriter = File.AppendText(LogFilename))
lock (_fileLocker)
{
string stringToLog = DateTime.Now+":"+DateTime.Now.Millisecond+ " -- " + message;
streamWriter.WriteLine(stringToLog);
try
{
using (var streamWriter = File.AppendText(LogFilename))
{
string stringToLog = DateTime.Now + ":" + DateTime.Now.Millisecond + " -- " + message;
streamWriter.WriteLine(stringToLog);
}
}
catch (Exception e)
{
Android.Util.Log.Debug("KP2A", "Couldn't write to log file. " + e);
}
}
}
}

View File

@@ -162,17 +162,6 @@ namespace KeePassLib.Serialization
finally { CommonCleanUpRead(sSource, hashedStream); }
}
public static void CopyStream(Stream input, Stream output)
{
byte[] buffer = new byte[4096];
int read;
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, read);
}
output.Seek(0, SeekOrigin.Begin);
}
private void CommonCleanUpRead(Stream sSource, HashingStreamEx hashedStream)
{
hashedStream.Close();