AddRootNode() public méthode

public AddRootNode ( ContainerInfo rootNode ) : void
rootNode ContainerInfo
Résultat void
 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;
 }
        public ConnectionTreeModel Deserialize()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);
            connectionTreeModel.AddRootNode(root);

            ImportContainers(_ldapPath, root);

            return connectionTreeModel;
        }
        public ConnectionTreeModel Deserialize()
        {
            var connectionTreeModel = new ConnectionTreeModel();
            var root = new RootNodeInfo(RootNodeType.Connection);
            connectionTreeModel.AddRootNode(root);

            foreach (var host in _scannedHosts)
                ImportScannedHost(host, root);

            return connectionTreeModel;
        }
        public ConnectionTreeModel Deserialize(bool import)
        {
            try
            {
                if (!import)
                    Runtime.IsConnectionsFileLoaded = false;

                var rootXmlElement = _xmlDocument.DocumentElement;
                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;
            }
        }
        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;
        }
        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;
        }
        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;
        }
        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;
        }
        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;
        }
        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;
        }
 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;
 }