当前位置: 首页>>代码示例>>C#>>正文


C# PwDatabase.Save方法代码示例

本文整理汇总了C#中KeePassLib.PwDatabase.Save方法的典型用法代码示例。如果您正苦于以下问题:C# PwDatabase.Save方法的具体用法?C# PwDatabase.Save怎么用?C# PwDatabase.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KeePassLib.PwDatabase的用法示例。


在下文中一共展示了PwDatabase.Save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateKeePassDatabase

        public static PwDatabase CreateKeePassDatabase(string databasePath, CompositeKey compositeKey)
        {
            if (!databasePath.EndsWith(".kdbx"))
                throw new FileNotFoundException("The database file must end with .kdbx");

            var directoryName = Path.GetDirectoryName(databasePath);
            var fileName = Path.GetFileName(databasePath);

            if (!Directory.Exists(directoryName))
                Directory.CreateDirectory(directoryName);

            var ioc = new IOConnectionInfo();
            ioc.Path = fileName;
            ioc.CredSaveMode = IOCredSaveMode.NoSave;

            var database = new PwDatabase();
            database.New(ioc, compositeKey);
            database.Save(null);

            return database;
        }
开发者ID:badmishkallc,项目名称:jolt9-devops,代码行数:21,代码来源:Util.cs

示例2: Save

 public void Save(PwDatabase kpDatabase, Stream stream)
 {
     kpDatabase.Save(stream, null);
 }
开发者ID:pythe,项目名称:wristpass,代码行数:4,代码来源:KdbxDatabaseFormat.cs

示例3: CloseKeePassDatabase

 public static void CloseKeePassDatabase(PwDatabase database)
 {
     database.Save(null);
     database.Close();
 }
开发者ID:badmishkallc,项目名称:jolt9-devops,代码行数:5,代码来源:Util.cs

示例4: ShouldHandleCyclesOfNodesInImportAndExport

        public void ShouldHandleCyclesOfNodesInImportAndExport()
        {
            var exportPath = GetTestPath();
            m_syncManager.AddExportPath(exportPath);

            var userMrX = TestHelper.GetUserRootNodeByNameFor(m_database, "mrX");
            m_database.GetExportGroup().Groups.GetAt(0).AddEntry(PwNode.CreateProxyNode(userMrX), true);

            var existingEntry = new PwEntry(true, true);
            existingEntry.SetTitle("Entry Version 1");
            m_database.RootGroup.AddEntry(existingEntry, true);
            m_database.RootGroup.AddEntry(PwNode.CreateProxyNode(userMrX), true);

            m_treeManager.CorrectStructure();

            string exportFile = exportPath + SyncSource.FileNameFor(userMrX) + SyncExporter.FileExtension;
            Assert.IsFalse(File.Exists(exportFile));

            m_syncManager.Export();

            var deltaDBInitial = new PwDatabase();
            deltaDBInitial.Open(IOConnectionInfo.FromPath(exportFile), m_standardKey, null);
            Assert.AreEqual(1, deltaDBInitial.RootGroup.GetEntries(true).Count(e => e.GetTitle() == "Entry Version 1"));
            foreach(var entry in deltaDBInitial.RootGroup.GetEntries(true))
            {
                entry.SetTitle("Changed");
            }
            deltaDBInitial.Save(null);
            deltaDBInitial.Close();

            m_syncManager.AddImportPath(exportFile);
            m_database.GetImportGroup().Groups.GetAt(0).Entries.GetAt(0).SetPassword(userMrX.Strings.ReadSafe(KeeShare.KeeShare.PasswordField));

            m_syncManager.RefeshSourcesList();
            // Node normalEntry6 is within the user home and is relocated on export which changes the parent node - during import, the parents of
            // not "officially" relocated nodes is checked and an assertion is thrown
            Assert.AreEqual(0, m_database.RootGroup.GetEntries(true).Count(e => e.GetTitle() == "Changed"));
        }
开发者ID:hicknhack-software,项目名称:KeeShare,代码行数:38,代码来源:SyncMasterUnitTest.cs


注:本文中的KeePassLib.PwDatabase.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。