This commit is contained in:
Philipp Crocoll
2014-12-25 22:06:21 +01:00
parent fa7365323c
commit 44b005f9d7
5 changed files with 301 additions and 278 deletions

View File

@@ -54,6 +54,7 @@ namespace keepass2android
ClickOkToSelectLocation,
FileIsReadOnly,
FileIsReadOnlyOnKitkat,
CopyFileRequiredForEditing
CopyFileRequiredForEditing,
DuplicateUuidsError
}
}

View File

@@ -181,10 +181,20 @@ namespace keepass2android
var childGroups = currentGroup.Groups;
var childEntries = currentGroup.Entries;
foreach (PwEntry e in childEntries) {
foreach (PwEntry e in childEntries)
{
if (Entries.ContainsKey(e.Uuid))
{
throw new DuplicateUuidsException();
}
Entries [e.Uuid] = e;
}
foreach (PwGroup g in childGroups) {
foreach (PwGroup g in childGroups)
{
if (Groups.ContainsKey(g.Uuid))
{
throw new DuplicateUuidsException();
}
Groups[g.Uuid] = g;
PopulateGlobals(g);
}
@@ -215,6 +225,8 @@ namespace keepass2android
}
internal class DuplicateUuidsException : Exception
{
}
}

View File

@@ -54,7 +54,7 @@ namespace keepass2android
StatusLogger.UpdateMessage(UiStringKey.loading_database);
//get the stream data into a single stream variable (databaseStream) regardless whether its preloaded or not:
MemoryStream preloadedMemoryStream = _databaseData == null ? null : _databaseData.Result;
MemoryStream databaseStream;
MemoryStream databaseStream;
if (preloadedMemoryStream != null)
databaseStream = preloadedMemoryStream;
else
@@ -83,12 +83,18 @@ namespace keepass2android
foreach (var innerException in e.InnerExceptions)
{
message = innerException.Message;
// Override the message shown with the last (hopefully most recent) inner exception
// Override the message shown with the last (hopefully most recent) inner exception
Kp2aLog.Log("Exception: " + innerException);
}
Finish(false, _app.GetResourceString(UiStringKey.ErrorOcurred) + " " + message);
return;
}
catch (DuplicateUuidsException e)
{
Kp2aLog.Log("Exception: " + e);
Finish(false, _app.GetResourceString(UiStringKey.DuplicateUuidsError));
return;
}
catch (Exception e)
{
Kp2aLog.Log("Exception: " + e);