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


C# PwEntry.SetTitle方法代码示例

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


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

示例1: ShouldHandleExportAndImportOfDifferentDatabasesSuccessfully

        public void ShouldHandleExportAndImportOfDifferentDatabasesSuccessfully()
        {
            var exportKeeShare = new KeeShare.KeeShare();
            var exportDatabase = TestHelper.CreateDatabase();
            exportKeeShare.Initialize(exportDatabase);

            var treeManagerAccessor = new TreeManagerAccessor();
            treeManagerAccessor.Initialize(exportDatabase);
            treeManagerAccessor.CreateNewUser("MrX");
            exportKeeShare.EnsureValidTree(exportDatabase);

            var userNode = TestHelper.GetUserRootNodeByNameFor(exportDatabase, "MrX");
            var userHome = TestHelper.GetUserHomeNodeByNameFor(exportDatabase, "MrX");
            var exportRootEntry = new PwEntry(true, true);
            exportRootEntry.SetTitle("ExportRootEntry");
            exportDatabase.RootGroup.AddEntry(exportRootEntry, true);

            var exportPath = GetTestPath();
            var exportFile = exportPath + SyncSource.FileNameFor(userNode) + SyncExporter.FileExtension;
            exportKeeShare.AddExportPath(exportPath);
            var exportTarget = exportDatabase.GetExportGroup().Groups.GetAt(0);
            exportTarget.AddEntry(PwNode.CreateProxyNode(userNode), true);

            var exportHomeEntry = new PwEntry(true, true);
            exportHomeEntry.SetTitle("ExportHomeEntry");
            userHome.AddEntry(exportHomeEntry, true);
            exportDatabase.RootGroup.AddEntry(PwNode.CreateProxyNode(userNode), true);

            var importDatabase = TestHelper.CreateDatabase();
            var importKeeShare = new KeeShare.KeeShare();
            importKeeShare.Initialize(importDatabase);

            exportKeeShare.Export();

            importKeeShare.AddImportPath(exportFile);
            var importGroup = importDatabase.GetImportGroup().Groups.GetAt(0);
            var importSource = importGroup.Entries.GetAt(0);
            importSource.SetPassword(userNode.Strings.ReadSafe(KeeShare.KeeShare.PasswordField));

            importKeeShare.EnsureValidTree(importDatabase);

            Assert.AreEqual(1, importDatabase.RootGroup.GetEntries(true).CloneShallowToList().Count(e => e.GetTitle() == "ExportRootEntry"));
            Assert.AreEqual(1, importDatabase.RootGroup.GetEntries(true).CloneShallowToList().Count(e => e.GetTitle() == "ExportHomeEntry"));
        }
开发者ID:hicknhack-software,项目名称:KeeShare,代码行数:44,代码来源:KeeShareUnitTest.cs

示例2: FillInFixture

        private void FillInFixture()
        {
            PwGroup rootGroup = m_database.RootGroup;

            m_treeManager.CreateNewUser("mrX");
            m_treeManager.CreateNewUser("mrY");
            m_standardKey = SyncSource.CreateKeyFor(STANDARD_PASSWORD);

            PwEntry mrX = TestHelper.GetUserRootNodeByNameFor(m_database, "mrX");
            PwEntry mrY = TestHelper.GetUserRootNodeByNameFor(m_database, "mrY");
            mrX.SetPassword(STANDARD_PASSWORD);
            mrY.SetPassword(STANDARD_PASSWORD);
            PwGroup mrXhome = m_database.GetUsersGroup().Groups.GetAt(0);

            //normal entries
            PwEntry normalEntry1 = new PwEntry(true, false);
            normalEntry1.SetTitle("normalEntry1");
            Uuid1 = normalEntry1.Uuid;
            PwEntry normalEntry2 = new PwEntry(true, false);
            normalEntry2.SetTitle("normalEntry2");
            Uuid2 = normalEntry2.Uuid;
            PwEntry normalEntry3 = new PwEntry(true, false);
            normalEntry3.SetTitle("normalEntry3");
            Uuid3 = normalEntry3.Uuid;
            PwEntry normalEntry4 = new PwEntry(true, false);
            normalEntry4.SetTitle("normalEntry4");
            Uuid4 = normalEntry4.Uuid;
            PwEntry normalEntry5 = new PwEntry(true, false);
            normalEntry5.SetTitle("normalEntry5");
            Uuid5 = normalEntry5.Uuid;
            PwEntry normalEntry6 = new PwEntry(true, false);
            normalEntry6.SetTitle("normalEntry6");
            Uuid6 = normalEntry6.Uuid;

            //pwdProxies
            PwEntry pwdProxyTo1 = PwNode.CreateProxyNode(normalEntry1);
            PwEntry pwdProxyTo3 = PwNode.CreateProxyNode(normalEntry3);

            //userProxies
            PwEntry userProxyToMrX = PwNode.CreateProxyNode(mrX);

            PwGroup grp1 = new PwGroup(true, true, "grp1", PwIcon.BlackBerry);

            rootGroup.AddEntry(normalEntry1, true);
            rootGroup.AddEntry(normalEntry2, true);
            rootGroup.AddEntry(normalEntry3, true);
            rootGroup.AddGroup(grp1, true);

            grp1.AddEntry(normalEntry4, true);
            grp1.AddEntry(normalEntry5, true);
            grp1.AddEntry(userProxyToMrX, true);
            grp1.AddEntry(pwdProxyTo1, true);

            mrXhome.AddEntry(normalEntry6, true);
            mrXhome.AddEntry(pwdProxyTo3, true);
            Assert.AreEqual(13, rootGroup.GetEntries(true).UCount);
        }
开发者ID:hicknhack-software,项目名称:KeeShare,代码行数:57,代码来源:SyncMasterUnitTest.cs

示例3: 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

示例4: ShouldNotImportDatabasesWithDifferentUsers

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

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

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

            m_treeManager.CorrectStructure();

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

            m_syncManager.Export();

            existingEntry.SetTitle("Entry Version 2");

            var deltaDBInitial = new PwDatabase();
            deltaDBInitial.Open(IOConnectionInfo.FromPath(exportFile), m_standardKey, null);
            Assert.AreEqual(0, deltaDBInitial.RootGroup.GetEntries(true).Count(e => e.GetTitle() == "Entry Version 2"));
            Assert.AreEqual(1, deltaDBInitial.RootGroup.GetEntries(true).Count(e => e.GetTitle() == "Entry Version 1"));
            deltaDBInitial.Close();

            m_syncManager.AddImportPath(exportFile);
            m_database.GetImportGroup().Groups.GetAt(0).Entries.GetAt(0).SetPassword("InvalidPassword");

            m_syncManager.RefeshSourcesList();

            Assert.AreEqual(1, m_database.RootGroup.GetEntries(true).Count(e => e.GetTitle() == "Entry Version 2"));
            Assert.AreEqual(0, m_database.RootGroup.GetEntries(true).Count(e => e.GetTitle() == "Entry Version 1"));
        }
开发者ID:hicknhack-software,项目名称:KeeShare,代码行数:37,代码来源:SyncMasterUnitTest.cs

示例5: ShouldExportImportedNodes

        public void ShouldExportImportedNodes()
        {
            var importDatabase = TestHelper.CreateDatabase();
            var importedEntry = new PwEntry(true, true);
            importedEntry.SetTitle("ImportedEntry");
            var importedGroup = new PwGroup(true, true);
            importedGroup.Name = "ImportedGroup";
            importedGroup.AddEntry(importedEntry, true);
            importDatabase.RootGroup.AddGroup(importedGroup, true);

            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);

            m_database.RootGroup.AddEntry(PwNode.CreateProxyNode(userMrX), true);
            var existingEntry = new PwEntry(true, true);
            existingEntry.SetTitle("ExistingEntry");
            m_database.RootGroup.AddEntry(existingEntry, true);
            m_treeManager.CorrectStructure();

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

            Assert.AreEqual(0, m_database.RootGroup.GetEntries(true).Count(e => e.GetTitle() == "ImportedEntry"));
            Assert.AreEqual(0, m_database.RootGroup.GetGroups(true).Count(g => g.Name == "ImportedGroup"));

            m_syncManager.Export();

            Assert.IsTrue(File.Exists(exportFile));

            var importer = new SyncImporterAccessor();
            importer.MergeInAccessor(m_database, importDatabase);

            Assert.AreEqual(1, m_database.RootGroup.GetEntries(true).Count(e => e.GetTitle() == "ImportedEntry"));
            Assert.AreEqual(1, m_database.RootGroup.GetGroups(true).Count(g => g.Name == "ImportedGroup"));

            m_syncManager.Export();

            Assert.IsTrue(File.Exists(exportFile));

            var deltaDBUpdated = new PwDatabase();
            deltaDBUpdated.Open(IOConnectionInfo.FromPath(exportFile), m_standardKey, null);
            Assert.AreEqual(1, deltaDBUpdated.RootGroup.GetEntries(true).Count(e => e.GetTitle() == "ImportedEntry"));
            Assert.AreEqual(1, deltaDBUpdated.RootGroup.GetGroups(true).Count(g => g.Name == "ImportedGroup"));
            deltaDBUpdated.Close();
        }
开发者ID:hicknhack-software,项目名称:KeeShare,代码行数:49,代码来源:SyncMasterUnitTest.cs


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