Example #1
0
        private PwEntryV3 ConvertEntry(PwEntry fromEntry, PwDatabaseV3 dbTo)
        {
            PwEntryV3 toEntry = new PwEntryV3();

            toEntry.Uuid                 = fromEntry.Uuid.UuidBytes;
            toEntry.CreationTime         = ConvertTime(fromEntry.CreationTime);
            toEntry.LastAccessTime       = ConvertTime(fromEntry.LastAccessTime);
            toEntry.LastModificationTime = ConvertTime(fromEntry.LastModificationTime);

            if (fromEntry.Expires)
            {
                toEntry.ExpiryTime = ConvertTime(fromEntry.ExpiryTime);
            }
            else
            {
                toEntry.ExpiryTime = ConvertTime(_expireNever);
            }


            toEntry.Icon = dbTo.IconFactory.GetIcon((int)fromEntry.IconId);
            toEntry.SetTitle(GetString(fromEntry, PwDefs.TitleField), dbTo);
            Android.Util.Log.Debug("KP2A", "save kdb: entry " + fromEntry.Strings.ReadSafe(PwDefs.TitleField));
            toEntry.SetUsername(GetString(fromEntry, PwDefs.UserNameField), dbTo);
            toEntry.SetUrl(GetString(fromEntry, PwDefs.UrlField), dbTo);
            var pwd = GetString(fromEntry, PwDefs.PasswordField);

            if (pwd != null)
            {
                toEntry.SetPassword(pwd, dbTo);
            }
            toEntry.SetNotes(GetString(fromEntry, PwDefs.NotesField), dbTo);
            if (fromEntry.Binaries.Any())
            {
                var binaryData = fromEntry.Binaries.First().Value.ReadData();
                toEntry.SetBinaryData(binaryData, 0, binaryData.Length);
            }

            return(toEntry);
        }
Example #2
0
        private PwEntryV3 ConvertEntry(PwEntry fromEntry, PwDatabaseV3 dbTo)
        {
            PwEntryV3 toEntry = new PwEntryV3();
            toEntry.Uuid = fromEntry.Uuid.UuidBytes;
            toEntry.CreationTime = ConvertTime(fromEntry.CreationTime);
            toEntry.LastAccessTime = ConvertTime(fromEntry.LastAccessTime);
            toEntry.LastModificationTime = ConvertTime(fromEntry.LastModificationTime);

            if (fromEntry.Expires)
            {
                toEntry.ExpiryTime = ConvertTime(fromEntry.ExpiryTime);
            }
            else
            {
                toEntry.ExpiryTime = ConvertTime(_expireNever);
            }

            toEntry.Icon = dbTo.IconFactory.GetIcon((int) fromEntry.IconId);
            toEntry.SetTitle(GetString(fromEntry, PwDefs.TitleField), dbTo);
            Android.Util.Log.Debug("KP2A", "save kdb: entry " + fromEntry.Strings.ReadSafe(PwDefs.TitleField));
            toEntry.SetUsername(GetString(fromEntry, PwDefs.UserNameField), dbTo);
            toEntry.SetUrl(GetString(fromEntry, PwDefs.UrlField), dbTo);
            var pwd = GetString(fromEntry, PwDefs.PasswordField);
            if (pwd != null)
                toEntry.SetPassword(pwd, dbTo);
            toEntry.SetNotes(GetString(fromEntry, PwDefs.NotesField), dbTo);
            if (fromEntry.Binaries.Any())
            {
                var binaryData = fromEntry.Binaries.First().Value.ReadData();
                toEntry.SetBinaryData(binaryData, 0, binaryData.Length);
            }

            return toEntry;
        }