コード例 #1
0
        public static void ParseToEntry(PasswordEntry entry, string decryptedFileContent)
        {
            int last = decryptedFileContent.LastIndexOf('}') + 1;

            if (last != decryptedFileContent.Length)
            {
                decryptedFileContent = decryptedFileContent.Substring(0, last);
                Debug.WriteLine("corrupt data recognized");
            }


            //Debug.WriteLine(decryptedFileContent);
            dynamic o = JsonConvert.DeserializeObject(decryptedFileContent);



            foreach (dynamic d in o.usernames)
            {
                Username u = new Username
                {
                    Name     = d.username,
                    Password = d.password,
                    Email    = d.email,
                    Notes    = d.notes,
                    TFA      = d.TFA
                };

                entry.Add(u);
            }
        }