Exemple #1
0
        /// <summary>
        /// Adds new text record.
        /// </summary>
        /// <param name="key">Key.</param>
        /// <param name="value">Value.</param>
        public BimilRecord AddRecord(string key, string value, BimilRecordFormat format)
        {
            var record = new BimilRecord(this.Document, key, value, format);

            this.Records.Add(record);
            return(record);
        }
Exemple #2
0
 private void SetSystemRecordValue(string key, string value)
 {
     foreach (var record in this.Records)
     {
         if (record.Format == BimilRecordFormat.System)
         {
             if (string.Equals(key, record.Key.Text, StringComparison.Ordinal))
             {
                 record.Value.Text = value;
                 return;
             }
         }
     }
     {
         var record = new BimilRecord(this.Document, key, value, BimilRecordFormat.System);
         this.Records.Add(record);
     }
 }
Exemple #3
0
 private BimilRecord GetSystemRecord(string key)
 {
     foreach (var record in this.Records)
     {
         if (record.Format == BimilRecordFormat.System)
         {
             if (string.Equals(key, record.Key.Text, StringComparison.Ordinal))
             {
                 return(record);
             }
         }
     }
     {
         var record = new BimilRecord(this.Document, key, "", BimilRecordFormat.System);
         this.Records.Add(record);
         return(record);
     }
 }
Exemple #4
0
 private static Record ConvertBimilRecord(BimilDocument.BimilRecord record)
 {
     if (record.Key.Text.Equals("User name", StringComparison.OrdinalIgnoreCase) ||
         record.Key.Text.Equals("Username", StringComparison.OrdinalIgnoreCase) ||
         record.Key.Text.Equals("User", StringComparison.OrdinalIgnoreCase))
     {
         return(new Record(RecordType.UserName)
         {
             Text = record.Value.Text
         });
     }
     else if (record.Key.Text.Equals("Password", StringComparison.OrdinalIgnoreCase))
     {
         return(new Record(RecordType.Password)
         {
             Text = record.Value.Text
         });
     }
     else if (record.Key.Text.Equals("Notes", StringComparison.OrdinalIgnoreCase))
     {
         return(new Record(RecordType.Notes)
         {
             Text = record.Value.Text
         });
     }
     else if (record.Key.Text.Equals("URL", StringComparison.OrdinalIgnoreCase) ||
              record.Key.Text.Equals("Web address", StringComparison.OrdinalIgnoreCase))
     {
         return(new Record(RecordType.Url)
         {
             Text = record.Value.Text
         });
     }
     else if (record.Key.Text.Equals("Key", StringComparison.OrdinalIgnoreCase))
     {
         return(new Record(RecordType.TwoFactorKey)
         {
             Text = record.Value.Text
         });
     }
     else if (record.Key.Text.Equals("Card number", StringComparison.OrdinalIgnoreCase))
     {
         return(new Record(RecordType.CreditCardNumber)
         {
             Text = record.Value.Text
         });
     }
     else if (record.Key.Text.Equals("Expiration date", StringComparison.OrdinalIgnoreCase))
     {
         return(new Record(RecordType.CreditCardExpiration)
         {
             Text = record.Value.Text
         });
     }
     else if (record.Key.Text.Equals("Security code", StringComparison.OrdinalIgnoreCase) ||
              record.Key.Text.Equals("CVV", StringComparison.OrdinalIgnoreCase) ||
              record.Key.Text.Equals("CVV2", StringComparison.OrdinalIgnoreCase) ||
              record.Key.Text.Equals("CID", StringComparison.OrdinalIgnoreCase) ||
              record.Key.Text.Equals("CSC", StringComparison.OrdinalIgnoreCase))
     {
         return(new Record(RecordType.CreditCardVerificationValue)
         {
             Text = record.Value.Text
         });
     }
     else if (record.Key.Text.Equals("PIN", StringComparison.OrdinalIgnoreCase))
     {
         return(new Record(RecordType.CreditCardPin)
         {
             Text = record.Value.Text
         });
     }
     else
     {
         Debug.WriteLine("Not auto-converting field \"" + record.Key.Text + "\"");
         if (record.Value.Text.Length > 0)
         {
             return(new Record(0)
             {
                 Text = record.Key.Text + ": " + record.Value.Text
             });
         }
         else
         {
             return(null);
         }
     }
 }