コード例 #1
0
        public ConnectionTreeModel Deserialize()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);

            connectionTreeModel.AddRootNode(root);
            var connectionInfo = new ConnectionInfo();

            foreach (var line in _fileContent)
            {
                var parts = line.Split(new[] { ':' }, 3);
                if (parts.Length < 3)
                {
                    continue;
                }

                var key   = parts[0];
                var value = parts[2];

                SetConnectionInfoParameter(connectionInfo, key, value);
            }
            root.AddChild(connectionInfo);

            return(connectionTreeModel);
        }
コード例 #2
0
        public ConnectionTreeModel Deserialize()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);

            connectionTreeModel.AddRootNode(root);

            var xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(_puttycmConnectionsXml);

            var configurationNode = xmlDocument.SelectSingleNode("/configuration");

            var rootNodes = configurationNode?.SelectNodes("./root");

            if (rootNodes == null)
            {
                return(connectionTreeModel);
            }
            foreach (XmlNode rootNode in rootNodes)
            {
                ImportRootOrContainer(rootNode, root);
            }

            return(connectionTreeModel);
        }
コード例 #3
0
        public void ExpandingAllItemsUpdatesColumnWidthAppropriately()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);

            connectionTreeModel.AddRootNode(root);
            ContainerInfo parent = root;

            foreach (var i in Enumerable.Repeat("", 8))
            {
                var newContainer = new ContainerInfo {
                    IsExpanded = false
                };
                parent.AddChild(newContainer);
                parent = newContainer;
            }

            _connectionTree.ConnectionTreeModel = connectionTreeModel;

            var widthBefore = _connectionTree.Columns[0].Width;

            _connectionTree.ExpandAll();
            var widthAfter = _connectionTree.Columns[0].Width;

            Assert.That(widthAfter, Is.GreaterThan(widthBefore));
        }
コード例 #4
0
        private ConnectionTreeModel CreateNodeHierarchy(List <ConnectionInfo> connectionList)
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var rootNode            = new RootNodeInfo(RootNodeType.Connection)
            {
                ConstantID = "0"
            };

            connectionTreeModel.AddRootNode(rootNode);

            foreach (DataRow row in _dataTable.Rows)
            {
                var id             = (string)row["ConstantID"];
                var connectionInfo = connectionList.First(node => node.ConstantID == id);
                var parentId       = (string)row["ParentID"];
                if (parentId == "0")
                {
                    rootNode.AddChild(connectionInfo);
                }
                else
                {
                    (connectionList.First(node => node.ConstantID == parentId) as ContainerInfo)?.AddChild(connectionInfo);
                }
            }
            return(connectionTreeModel);
        }
コード例 #5
0
        public void CannotAddFolderToPuttySessionNode()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root      = new RootNodeInfo(RootNodeType.Connection);
            var puttyRoot = new RootNodeInfo(RootNodeType.PuttySessions);

            connectionTreeModel.AddRootNode(root);
            connectionTreeModel.AddRootNode(puttyRoot);

            _connectionTree.ConnectionTreeModel = connectionTreeModel;

            _connectionTree.SelectedObject = puttyRoot;
            _connectionTree.AddFolder();

            Assert.That(puttyRoot.Children, Is.Empty);
        }
コード例 #6
0
        private ConnectionTreeModel CreateConnectionTreeModel()
        {
            var connectionTreeModel = new ConnectionTreeModel();

            connectionTreeModel.AddRootNode(new RootNodeInfo(RootNodeType.Connection));
            return(connectionTreeModel);
        }
コード例 #7
0
        private ConnectionTreeModel SetupConnectionTreeModel()
        {
            /*
             * Root
             * |--- con0
             * |--- folder1
             * |    L--- con1
             * L--- folder2
             *      |--- con2
             *      L--- folder3
             *           |--- con3
             *           L--- con4
             */
            BuildTreeNodes();
            var connectionTreeModel = new ConnectionTreeModel();
            var rootNode            = new RootNodeInfo(RootNodeType.Connection);

            rootNode.AddChild(_folder1);
            rootNode.AddChild(_folder2);
            rootNode.AddChild(_con0);
            _folder1.AddChild(_con1);
            _folder2.AddChild(_con2);
            _folder2.AddChild(_folder3);
            _folder3.AddChild(_con3);
            _folder3.AddChild(_con4);
            connectionTreeModel.AddRootNode(rootNode);
            return(connectionTreeModel);
        }
コード例 #8
0
        public ConnectionTreeModel Deserialize(bool import)
        {
            try
            {
                if (!import)
                {
                    Runtime.IsConnectionsFileLoaded = false;
                }

                var rootXmlElement = _xmlDocument.DocumentElement;
                _rootNodeInfo = InitializeRootNode(rootXmlElement);
                CreateDecryptor(_rootNodeInfo, rootXmlElement);
                var connectionTreeModel = new ConnectionTreeModel();
                connectionTreeModel.AddRootNode(_rootNodeInfo);


                if (_confVersion > 1.3)
                {
                    var protectedString = _xmlDocument.DocumentElement?.Attributes["Protected"].Value;
                    if (!_decryptor.ConnectionsFileIsAuthentic(protectedString, _rootNodeInfo.PasswordString.ConvertToSecureString()))
                    {
                        mRemoteNG.Settings.Default.LoadConsFromCustomLocation = false;
                        mRemoteNG.Settings.Default.CustomConsPath             = "";
                        return(null);
                    }
                }

                if (_confVersion >= 2.6)
                {
                    if (rootXmlElement?.Attributes["FullFileEncryption"].Value == "True")
                    {
                        var decryptedContent = _decryptor.Decrypt(rootXmlElement.InnerText);
                        rootXmlElement.InnerXml = decryptedContent;
                    }
                }

                if (import && !IsExportFile(rootXmlElement))
                {
                    Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strCannotImportNormalSessionFile);
                    return(null);
                }

                AddNodesFromXmlRecursive(_xmlDocument.DocumentElement, _rootNodeInfo);

                if (!import)
                {
                    Runtime.IsConnectionsFileLoaded = true;
                }

                return(connectionTreeModel);
            }
            catch (Exception ex)
            {
                Runtime.IsConnectionsFileLoaded = false;
                Runtime.MessageCollector.AddExceptionStackTrace(Language.strLoadFromXmlFailed, ex);
                throw;
            }
        }
コード例 #9
0
        public ConnectionTreeModel Deserialize()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);

            connectionTreeModel.AddRootNode(root);

            ImportContainers(_ldapPath, root);

            return(connectionTreeModel);
        }
コード例 #10
0
        private ConnectionTreeModel SetupConnectionTreeModel()
        {
            /*
             * Tree:
             * Root
             * |--- folder1 (description1, hostname1)
             * |    |--- con1 (description2, hostname2)
             * |    L--- con2 (description3, hostname3)
             * |--- folder2 (description4, hostname4)
             * |    |--- con3 (description5, hostname5)
             * |    L--- con4 (description6, hostname6)
             * L--- con5 (description7, hostname7)
             *
             */
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);

            _folder1 = new ContainerInfo {
                Name = "folder1", Description = "description1", Hostname = "hostname1"
            };
            _con1 = new ConnectionInfo {
                Name = "con1", Description = "description2", Hostname = "hostname2"
            };
            _con2 = new ConnectionInfo {
                Name = "con2", Description = "description3", Hostname = "hostname3"
            };
            _folder2 = new ContainerInfo {
                Name = "folder2", Description = "description4", Hostname = "hostname4"
            };
            _con3 = new ConnectionInfo {
                Name = "con3", Description = "description5", Hostname = "hostname5"
            };
            _con4 = new ConnectionInfo {
                Name = "con4", Description = "description6", Hostname = "hostname6"
            };
            _con5 = new ConnectionInfo {
                Name = "con5", Description = "description7", Hostname = "hostname7"
            };

            _folder1.Inheritance.TurnOffInheritanceCompletely();
            _con1.Inheritance.TurnOffInheritanceCompletely();
            _con2.Inheritance.TurnOffInheritanceCompletely();
            _folder2.Inheritance.TurnOffInheritanceCompletely();
            _con3.Inheritance.TurnOffInheritanceCompletely();
            _con4.Inheritance.TurnOffInheritanceCompletely();
            _con5.Inheritance.TurnOffInheritanceCompletely();

            connectionTreeModel.AddRootNode(root);
            root.AddChildRange(new [] { _folder1, _folder2, _con5 });
            _folder1.AddChildRange(new [] { _con1, _con2 });
            _folder2.AddChildRange(new[] { _con3, _con4 });

            return(connectionTreeModel);
        }
コード例 #11
0
        public void RenamingNodeWithNothingSelectedDoesNothing()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);

            connectionTreeModel.AddRootNode(root);

            _connectionTree.ConnectionTreeModel = connectionTreeModel;
            _connectionTree.SelectedObject      = null;

            Assert.DoesNotThrow(() => _connectionTree.RenameSelectedNode());
        }
コード例 #12
0
        public void CannotDuplicateRootPuttyNode()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var puttyRoot           = new RootNodeInfo(RootNodeType.PuttySessions);

            connectionTreeModel.AddRootNode(puttyRoot);
            _connectionTree.ConnectionTreeModel = connectionTreeModel;

            _connectionTree.SelectedObject = puttyRoot;
            _connectionTree.DuplicateSelectedNode();

            Assert.That(connectionTreeModel.RootNodes, Has.One.Items);
        }
コード例 #13
0
        public void DuplicatingWithNoNodeSelectedDoesNothing()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var puttyRoot           = new RootNodeInfo(RootNodeType.PuttySessions);

            connectionTreeModel.AddRootNode(puttyRoot);
            _connectionTree.ConnectionTreeModel = connectionTreeModel;

            _connectionTree.SelectedObject = null;
            _connectionTree.DuplicateSelectedNode();

            Assert.That(connectionTreeModel.RootNodes, Has.One.Items);
        }
コード例 #14
0
        private ConnectionTreeModel SetupConnectionTreeModel()
        {
            /*
             * Root
             * |--- con0
             * |--- folder1
             * |    L--- con1
             * L--- folder2
             *      |--- con2
             *      L--- folder3
             *           |--- con3
             *           L--- con4
             */
            var connectionTreeModel = new ConnectionTreeModel();
            var rootNode            = new RootNodeInfo(RootNodeType.Connection);
            var folder1             = new ContainerInfo {
                Name = "folder1"
            };
            var folder2 = new ContainerInfo {
                Name = "folder2"
            };
            var folder3 = new ContainerInfo {
                Name = "folder3"
            };
            var con0 = new ConnectionInfo {
                Name = "con0"
            };
            var con1 = new ConnectionInfo {
                Name = "con1"
            };
            var con2 = new ConnectionInfo {
                Name = "con2"
            };
            var con3 = new ConnectionInfo {
                Name = "con3"
            };
            var con4 = new ConnectionInfo {
                Name = "con4"
            };

            rootNode.AddChild(folder1);
            rootNode.AddChild(folder2);
            rootNode.AddChild(con0);
            folder1.AddChild(con1);
            folder2.AddChild(con2);
            folder2.AddChild(folder3);
            folder3.AddChild(con3);
            folder3.AddChild(con4);
            connectionTreeModel.AddRootNode(rootNode);
            return(connectionTreeModel);
        }
コード例 #15
0
        public void CannotDuplicateRootConnectionNode()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);

            connectionTreeModel.AddRootNode(root);
            _connectionTree.ConnectionTreeModel = connectionTreeModel;
            _connectionTree.ExpandAll();

            _connectionTree.SelectedObject = root;
            _connectionTree.DuplicateSelectedNode();

            Assert.That(connectionTreeModel.RootNodes, Has.One.Items);
        }
コード例 #16
0
        public ConnectionTreeModel Deserialize(IEnumerable <ScanHost> scannedHosts)
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);

            connectionTreeModel.AddRootNode(root);

            foreach (var host in scannedHosts)
            {
                ImportScannedHost(host, root);
            }

            return(connectionTreeModel);
        }
コード例 #17
0
        public void GetChildListProvidesAllChildren()
        {
            var root    = new ContainerInfo();
            var folder1 = new ContainerInfo();
            var folder2 = new ContainerInfo();
            var con1    = new ConnectionInfo();

            root.AddChild(folder1);
            folder1.AddChild(folder2);
            root.AddChild(con1);
            _connectionTreeModel.AddRootNode(root);
            var connectionList = _connectionTreeModel.GetRecursiveChildList(root);

            Assert.That(connectionList, Is.EquivalentTo(new[] { folder1, folder2, con1 }));
        }
コード例 #18
0
 public void NewConnectionsFile(string filename)
 {
     try
     {
         filename.ThrowIfNullOrEmpty(nameof(filename));
         var newConnectionsModel = new ConnectionTreeModel();
         newConnectionsModel.AddRootNode(new RootNodeInfo(RootNodeType.Connection));
         SaveConnections(newConnectionsModel, false, new SaveFilter(), filename, true);
         LoadConnections(false, false, filename);
     }
     catch (Exception ex)
     {
         Runtime.MessageCollector.AddExceptionMessage(Language.strCouldNotCreateNewConnectionsFile, ex);
     }
 }
コード例 #19
0
        public ConnectionTreeModel Deserialize(bool import)
        {
            try
            {
                if (!import)
                {
                    Runtime.IsConnectionsFileLoaded = false;
                }

                var rootInfo            = InitializeRootNode();
                var connectionTreeModel = new ConnectionTreeModel();
                connectionTreeModel.AddRootNode(rootInfo);

                if (_confVersion > 1.3)
                {
                    var protectedString = _xmlDocument.DocumentElement?.Attributes["Protected"].Value;
                    if (!_decryptor.ConnectionsFileIsAuthentic(protectedString, rootInfo))
                    {
                        mRemoteNG.Settings.Default.LoadConsFromCustomLocation = false;
                        mRemoteNG.Settings.Default.CustomConsPath             = "";
                        return(null);
                    }
                }

                if (import && !IsExportFile())
                {
                    Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strCannotImportNormalSessionFile);
                    return(null);
                }

                AddNodesFromXmlRecursive(_xmlDocument.DocumentElement, rootInfo);
                //Windows.treeForm.InitialRefresh();
                //SetSelectedNode(RootTreeNode);

                if (!import)
                {
                    Runtime.IsConnectionsFileLoaded = true;
                }

                return(connectionTreeModel);
            }
            catch (Exception ex)
            {
                Runtime.IsConnectionsFileLoaded = false;
                Runtime.MessageCollector.AddExceptionStackTrace(Language.strLoadFromXmlFailed, ex);
                throw;
            }
        }
コード例 #20
0
        public void CanDuplicateConnectionNode()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);
            var con1 = new ConnectionInfo();

            root.AddChild(con1);
            connectionTreeModel.AddRootNode(root);
            _connectionTree.ConnectionTreeModel = connectionTreeModel;
            _connectionTree.ExpandAll();

            _connectionTree.SelectedObject = con1;
            _connectionTree.DuplicateSelectedNode();

            Assert.That(root.Children, Has.Exactly(2).Items);
        }
コード例 #21
0
        public void CannotDuplicatePuttyConnectionNode()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var puttyRoot           = new RootNodeInfo(RootNodeType.PuttySessions);
            var puttyConnection     = new PuttySessionInfo();

            puttyRoot.AddChild(puttyConnection);
            connectionTreeModel.AddRootNode(puttyRoot);
            _connectionTree.ConnectionTreeModel = connectionTreeModel;
            _connectionTree.ExpandAll();

            _connectionTree.SelectedObject = puttyConnection;
            _connectionTree.DuplicateSelectedNode();

            Assert.That(puttyRoot.Children, Has.One.Items);
        }
コード例 #22
0
        /// <summary>
        /// Builds a tree which looks like:
        /// Root
        /// |- folder1
        /// |   |- con1
        /// |- con2
        /// |- folder2
        ///     |- folder3
        ///         |- con3
        /// </summary>
        /// <returns></returns>
        public ConnectionTreeModel Build()
        {
            var model   = new ConnectionTreeModel();
            var root    = new RootNodeInfo(RootNodeType.Connection);
            var folder1 = new ContainerInfo {
                Name = "folder1", Username = "******", Domain = "domain1", Password = "******"
            };
            var folder2 = new ContainerInfo {
                Name = "folder2", Username = "******", Domain = "domain2", Password = "******"
            };
            var folder3 = new ContainerInfo
            {
                Name        = "folder3",
                Inheritance =
                {
                    Username = true,
                    Domain   = true,
                    Password = true
                }
            };
            var con1 = new ConnectionInfo {
                Name = "Con1", Username = "******", Domain = "domain1", Password = "******"
            };
            var con2 = new ConnectionInfo {
                Name = "Con2", Username = "******", Domain = "domain2", Password = "******"
            };
            var con3 = new ContainerInfo
            {
                Name        = "con3",
                Inheritance =
                {
                    Username = true,
                    Domain   = true,
                    Password = true
                }
            };

            root.AddChild(folder1);
            root.AddChild(con2);
            folder1.AddChild(con1);
            root.AddChild(folder2);
            folder2.AddChild(folder3);
            folder3.AddChild(con3);
            model.AddRootNode(root);
            return(model);
        }
コード例 #23
0
        private ConnectionTreeModel SetupConnectionTreeModel()
        {
            /*
             * Tree:
             * Root
             * |--- folder1
             * |    |--- con1
             * |    L--- con2
             * |--- folder2
             * |    |--- con3
             * |    L--- con4
             * L--- con5
             *
             */
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);

            _folder1 = new ContainerInfo {
                Name = "folder1"
            };
            _con1 = new ConnectionInfo {
                Name = "con1"
            };
            _con2 = new ConnectionInfo {
                Name = "con2"
            };
            _folder2 = new ContainerInfo {
                Name = "folder2"
            };
            _con3 = new ConnectionInfo {
                Name = "con3"
            };
            _con4 = new ConnectionInfo {
                Name = "con4"
            };
            _con5 = new ConnectionInfo {
                Name = "con5"
            };

            connectionTreeModel.AddRootNode(root);
            root.AddChildRange(new [] { _folder1, _folder2, _con5 });
            _folder1.AddChildRange(new [] { _con1, _con2 });
            _folder2.AddChildRange(new[] { _con3, _con4 });

            return(connectionTreeModel);
        }
コード例 #24
0
        public void FilteringIsRetainedAndUpdatedWhenNodeDeleted()
        {
            // root
            // |- folder1
            // |	|- con1
            // |	|- dontshowme
            // |- folder2
            //		|- con2
            var connectionTreeModel = new ConnectionTreeModel();
            var root    = new RootNodeInfo(RootNodeType.Connection);
            var folder1 = new ContainerInfo {
                Name = "folder1"
            };
            var folder2 = new ContainerInfo {
                Name = "folder2"
            };
            var con1 = new ConnectionInfo {
                Name = "con1"
            };
            var con2 = new ConnectionInfo {
                Name = "con2"
            };
            var conDontShow = new ConnectionInfo {
                Name = "dontshowme"
            };

            root.AddChildRange(new [] { folder1, folder2 });
            folder1.AddChildRange(new [] { con1, conDontShow });
            folder2.AddChild(con2);
            connectionTreeModel.AddRootNode(root);

            _connectionTree.ConnectionTreeModel = connectionTreeModel;
            // ensure all folders expanded
            _connectionTree.ExpandAll();

            // apply filtering on the tree
            _filter.FilterText          = "con";
            _connectionTree.ModelFilter = _filter;

            connectionTreeModel.DeleteNode(con1);

            Assert.That(_connectionTree.IsFiltering, Is.True);
            Assert.That(_connectionTree.FilteredObjects, Does.Not.Contain(con1));
            Assert.That(_connectionTree.FilteredObjects, Does.Not.Contain(conDontShow));
            Assert.That(_connectionTree.FilteredObjects, Does.Contain(con2));
        }
コード例 #25
0
        private ConnectionTreeModel GenerateConnectionTreeModel()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection)
            {
                IsExpanded = true
            };
            var folder1 = new ContainerInfo {
                IsExpanded = true
            };
            var folder2 = new ContainerInfo();
            var con1    = new ConnectionInfo();

            root.AddChild(folder1);
            folder1.AddChild(folder2);
            root.AddChild(con1);
            connectionTreeModel.AddRootNode(root);
            return(connectionTreeModel);
        }
コード例 #26
0
        private ConnectionTreeModel CreateConnectionTreeModel()
        {
            var model   = new ConnectionTreeModel();
            var root    = new RootNodeInfo(RootNodeType.Connection);
            var folder1 = new ContainerInfo {
                Name = "folder1", Username = "******", Domain = "domain1", Password = "******"
            };
            var con1 = new ConnectionInfo {
                Name = "Con1", Username = "******", Domain = "domain1", Password = "******"
            };
            var con2 = new ConnectionInfo {
                Name = "Con2", Username = "******", Domain = "domain2", Password = "******"
            };

            root.AddChild(folder1);
            root.AddChild(con2);
            folder1.AddChild(con1);
            model.AddRootNode(root);
            return(model);
        }
コード例 #27
0
        public void CopyHostnameDoesNotCopyAnythingIfNameOfSelectedContainerIsEmpty()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);
            var con1 = new ContainerInfo {
                Name = string.Empty
            };

            root.AddChild(con1);
            connectionTreeModel.AddRootNode(root);

            _connectionTree.ConnectionTreeModel = connectionTreeModel;
            _connectionTree.ExpandAll();
            _connectionTree.SelectedObject = con1;

            var clipboard = Substitute.For <IClipboard>();

            _connectionTree.CopyHostnameSelectedNode(clipboard);
            clipboard.DidNotReceiveWithAnyArgs().SetText("");
        }
コード例 #28
0
        public void CopyHostnameCopiesTheNodeNameOfTheSelectedContainer()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root      = new RootNodeInfo(RootNodeType.Connection);
            var container = new ContainerInfo {
                Name = "MyFolder"
            };

            root.AddChild(container);
            connectionTreeModel.AddRootNode(root);

            _connectionTree.ConnectionTreeModel = connectionTreeModel;
            _connectionTree.ExpandAll();
            _connectionTree.SelectedObject = container;

            var clipboard = Substitute.For <IClipboard>();

            _connectionTree.CopyHostnameSelectedNode(clipboard);
            clipboard.Received(1).SetText(container.Name);
        }
コード例 #29
0
        public ConnectionTreeModel Deserialize()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);

            var xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(_rdcmConnectionsXml);


            var rdcManNode = xmlDocument.SelectSingleNode("/RDCMan");

            VerifySchemaVersion(rdcManNode);
            VerifyFileVersion(rdcManNode);

            var fileNode = rdcManNode?.SelectSingleNode("./file");

            ImportFileOrGroup(fileNode, root);

            connectionTreeModel.AddRootNode(root);
            return(connectionTreeModel);
        }
コード例 #30
0
        public void Setup()
        {
            _connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);

            root.AddChild(new ConnectionInfo());
            _connectionTreeModel.AddRootNode(root);

            _cryptographyProvider = new AeadCryptographyProvider();
            var connectionNodeSerializer = new XmlConnectionNodeSerializer27(
                _cryptographyProvider,
                _connectionTreeModel.RootNodes.OfType <RootNodeInfo>().First().PasswordString.ConvertToSecureString(),
                new SaveFilter());

            _serializer        = new XmlConnectionsSerializer(_cryptographyProvider, connectionNodeSerializer);
            _xmlReaderSettings = new XmlReaderSettings
            {
                ValidationType  = ValidationType.Schema,
                ValidationFlags = XmlSchemaValidationFlags.ProcessInlineSchema |
                                  XmlSchemaValidationFlags.ProcessSchemaLocation |
                                  XmlSchemaValidationFlags.ReportValidationWarnings
            };
        }