Exemplo n.º 1
0
        public void TestSave()
        {
            var stream = new MemoryStream();
            var pfp    = new PfpConvert();
            var list   = new List <BaseEntry> {
                new StoredEntry {
                    site = "example.com", name = "user", password = "******"
                },
            };

            pfp.Save(stream, "password", list);

            stream.Position = 0;
            var entries = pfp.Load(stream, "password");

            Assert.AreEqual("example.com", (entries[0] as SiteEntry).site);
            Assert.AreEqual("user", (entries[1] as StoredEntry).name);
            Assert.AreEqual("secret", (entries[1] as StoredEntry).password);
        }
Exemplo n.º 2
0
        public override bool Export(PwExportInfo pwExportInfo, Stream sOutput, IStatusLogger slLogger)
        {
            var form = new OptionForm();

            if (form.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }

            slLogger.SetText("Collecting entries...", LogStatusType.Info);

            var entries = ConvertGroup(pwExportInfo.DataGroup, slLogger);

            slLogger.SetText("Encrypting backup...", LogStatusType.Info);

            var pfp = new PfpConvert();

            pfp.Save(sOutput, form.MasterPassword, entries);

            slLogger.SetText($"Exported {entries.Count} entries.", LogStatusType.Info);

            return(true);
        }