private bool GenerateFromExport(string csvPath, out List <PasswordEntry> entries)
        {
            entries = new List <PasswordEntry>();

            using (var parser = new TextFieldParser(csvPath))
            {
                parser.TextFieldType = FieldType.Delimited;
                parser.SetDelimiters(",");

                while (!parser.EndOfData)
                {
                    try
                    {
                        var fields = parser.ReadFields();
                        var entry  = new PasswordEntry();

                        if (!Uri.TryCreate(fields[0], UriKind.Absolute, out var uri) ||
                            !uri.IsAbsoluteUri || (uri.Scheme.ToLower() != "http" && uri.Scheme.ToLower() != "https") || string.IsNullOrWhiteSpace(uri.Host))
                        {
                            //invalid record
                            continue;
                        }

                        entry.Url      = uri;
                        entry.UserName = fields[1];
                        entry.Password = fields[2];
                        if (string.IsNullOrWhiteSpace(entry.Password))
                        {
                            continue;
                        }

                        entry.Note     = fields[3];
                        entry.Title    = string.IsNullOrWhiteSpace(fields[4]) ? uri.Host : fields[4];
                        entry.Group    = fields[5];
                        entry.Favorite = fields[6] == "1";

                        entries.Add(entry);
                    }
                    catch (MalformedLineException ex)
                    {
                        //we should have already validated the content, so this should never happen
                        Debug.Assert(false);
                    }
                }

                return(entries.Count > 0);
            }
        }
 private dynamic Generate1PasswordEntry(string keyId, PasswordEntry entry)
 {
     return(new
     {
         //keyId,
         locationKey = entry.Url.Host,
         typeName = "webforms.WebForm",
         location = entry.Url.ToString(),
         uuid = Guid.NewGuid().ToString("N"),
         updatedAt = DateTime.UtcNow.ToUnixTimeMilliseconds(),
         createdAt = DateTime.UtcNow.ToUnixTimeMilliseconds(),
         title = entry.Title,
         securityLevel = "SL5",
         secureContents = new
         {
             fields = new[]
             {
                 new
                 {
                     type = "T",
                     //name = "username",
                     value = entry.UserName,
                     designation = "username"
                 },
                 new
                 {
                     type = "P",
                     //name = "password",
                     value = entry.Password,
                     designation = "password",
                 }
             }
         },
         notesPlain = entry.Note
     });
 }