private PwEntry ConvertEntry(PwEntryV3 fromEntry) { PwEntry toEntry = new PwEntry(false, false); toEntry.Uuid = new PwUuid(fromEntry.Uuid.ToArray()); String modTime = Android.Text.Format.DateFormat.GetTimeFormat(Application.Context).Format(fromEntry.TCreation.JDate); Android.Util.Log.Debug("KP2A", modTime); toEntry.CreationTime = ConvertTime(fromEntry.TCreation); toEntry.LastAccessTime = ConvertTime(fromEntry.TLastAccess); toEntry.LastModificationTime = ConvertTime(fromEntry.TLastMod); toEntry.ExpiryTime = ConvertTime(fromEntry.TExpire); toEntry.ExpiryTime = new DateTime(toEntry.ExpiryTime.Year, toEntry.ExpiryTime.Month, toEntry.ExpiryTime.Day, toEntry.ExpiryTime.Hour, toEntry.ExpiryTime.Minute, toEntry.ExpiryTime.Second); toEntry.Expires = !(Math.Abs((toEntry.ExpiryTime - _expireNever).TotalMilliseconds) < 500); if (fromEntry.Icon != null) { toEntry.IconId = (PwIcon)fromEntry.Icon.IconId; } SetFieldIfAvailable(toEntry, PwDefs.TitleField, false, fromEntry.Title); Android.Util.Log.Debug("KP2A", "load kdb: entry " + toEntry.Strings.ReadSafe(PwDefs.TitleField)); SetFieldIfAvailable(toEntry, PwDefs.UserNameField, false, fromEntry.Username); SetFieldIfAvailable(toEntry, PwDefs.UrlField, false, fromEntry.Url); SetFieldIfAvailable(toEntry, PwDefs.PasswordField, true, fromEntry.Password); SetFieldIfAvailable(toEntry, PwDefs.NotesField, true, fromEntry.Additional); if ((fromEntry.GetBinaryData() != null) && (fromEntry.GetBinaryData().Length > 0)) { toEntry.Binaries.Set(fromEntry.BinaryDesc, new ProtectedBinary(true, fromEntry.GetBinaryData())); } return(toEntry); }
private PwEntry ConvertEntry(PwEntryV3 fromEntry) { PwEntry toEntry = new PwEntry(false, false); toEntry.Uuid = new PwUuid(fromEntry.Uuid.ToArray()); String modTime = Android.Text.Format.DateFormat.GetTimeFormat(Application.Context).Format(fromEntry.TCreation.JDate); Android.Util.Log.Debug("KP2A", modTime); toEntry.CreationTime = ConvertTime(fromEntry.TCreation); toEntry.LastAccessTime = ConvertTime(fromEntry.TLastAccess); toEntry.LastModificationTime = ConvertTime(fromEntry.TLastMod); toEntry.ExpiryTime = ConvertTime(fromEntry.TExpire); toEntry.ExpiryTime = new DateTime(toEntry.ExpiryTime.Year, toEntry.ExpiryTime.Month, toEntry.ExpiryTime.Day, toEntry.ExpiryTime.Hour, toEntry.ExpiryTime.Minute, toEntry.ExpiryTime.Second); toEntry.Expires = !(Math.Abs((toEntry.ExpiryTime - _expireNever).TotalMilliseconds) < 500); if (fromEntry.Icon != null) toEntry.IconId = (PwIcon) fromEntry.Icon.IconId; SetFieldIfAvailable(toEntry, PwDefs.TitleField, false, fromEntry.Title); Android.Util.Log.Debug("KP2A", "load kdb: entry " + toEntry.Strings.ReadSafe(PwDefs.TitleField)); SetFieldIfAvailable(toEntry, PwDefs.UserNameField, false, fromEntry.Username); SetFieldIfAvailable(toEntry, PwDefs.UrlField, false, fromEntry.Url); SetFieldIfAvailable(toEntry, PwDefs.PasswordField, true, fromEntry.Password); SetFieldIfAvailable(toEntry, PwDefs.NotesField, true, fromEntry.Additional); if ((fromEntry.GetBinaryData() != null) && (fromEntry.GetBinaryData().Length > 0)) { toEntry.Binaries.Set(fromEntry.BinaryDesc, new ProtectedBinary(true, fromEntry.GetBinaryData())); } return toEntry; }