예제 #1
0
        public Dictionary <string, List <Node> > GetSchemaDictionary(string plugInName, string profileName)
        {
            Dictionary <string, List <Node> > dict;
            string key = $"{plugInName}:{profileName}";

            if (!_schemaNodesDictionary.TryGetValue(key, out dict))
            {
                dict = new Dictionary <string, List <Node> >();
                _schemaNodesDictionary[key] = dict;

                var node = new Node(profileName);
                node.Schema = GetSchemaForProfile(plugInName, profileName);
                JsonGenerator.LoadSchema(node.Schema, node);

                var allNodes = node.Traverse();
                foreach (var n in allNodes)
                {
                    //dict[n.Path] = n;
                    if (dict.ContainsKey(n.Path))
                    {
                        var existingList = dict[n.Path];
                        existingList.Add(n);
                    }
                    else
                    {
                        dict[n.Path] = new List <Node>()
                        {
                            n
                        };
                    }
                }
            }
            return(dict);
        }