コード例 #1
0
 public void Add(ConfigTreeNodeImpl configTreeNode)
 {
     if (this.ConfigPath != configTreeNode.ConfigPath)
     {
         this.TryAddAsChild(configTreeNode.ConfigPath, configTreeNode);
     }
     else
     {
         foreach (KeyValuePair <string, ConfigTreeNodeImpl> pair in configTreeNode.children)
         {
             this.TryAddAsChild(pair.Key, pair.Value);
         }
     }
 }
コード例 #2
0
        public static void SetDefaultConfigs(ConfigurationServiceImpl configurationService)
        {
            string str;
            FileSystemConfigsImporter importer = new FileSystemConfigsImporter();

            if (Directory.Exists(MAVEN_CONFIG_PATH))
            {
                str = MAVEN_CONFIG_PATH;
            }
            else
            {
                if (!Directory.Exists(IDE_CONFIG_PATH))
                {
                    string[] textArray1 = new string[] { "Configs directory was not found. Path for maven: ", MAVEN_CONFIG_PATH, ". Path for IDE: ", IDE_CONFIG_PATH, "." };
                    throw new ConfigsNotFoundException(string.Concat(textArray1));
                }
                str = IDE_CONFIG_PATH;
            }
            ConfigTreeNodeImpl configTreeNode = importer.Import <ConfigTreeNodeImpl>(str, new ConfigurationProfileImpl(null));

            configurationService.SetRootConfigNode(configTreeNode);
        }
コード例 #3
0
        public ConfigTreeNode FindNode(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }
            char[] trimChars = new char[] { '/' };
            path = path.Trim(trimChars);
            pathHelper.Init(path);
            ConfigTreeNodeImpl impl = this;

            while (pathHelper.HasNextPathPart())
            {
                ConfigTreeNodeImpl impl2;
                if (!impl.children.TryGetValue(pathHelper.GetNextPathPart(), out impl2))
                {
                    return(null);
                }
                impl = impl2;
            }
            return(impl);
        }
コード例 #4
0
        public ConfigTreeNode FindOrCreateNode(string configPath)
        {
            if (string.IsNullOrEmpty(configPath))
            {
                return(this);
            }
            char[] trimChars = new char[] { '/' };
            configPath = configPath.Trim(trimChars);
            pathHelper.Init(configPath);
            ConfigTreeNodeImpl impl = this;

            while (pathHelper.HasNextPathPart())
            {
                ConfigTreeNodeImpl impl2;
                string             nextPathPart = pathHelper.GetNextPathPart();
                if (!impl.children.TryGetValue(nextPathPart, out impl2))
                {
                    impl2 = new ConfigTreeNodeImpl(nextPathPart);
                    impl.children.Add(nextPathPart, impl2);
                }
                impl = impl2;
            }
            return(impl);
        }