Beispiel #1
0
        public RawNode Concatenate(RawNode node)
        {
            if (node == null)
            {
                return(this);
            }

            var toAddDictionary = dictionary;
            var addDictionary   = node.dictionary;
            var keys            = addDictionary.Keys;

            foreach (var k in keys)
            {
                if (!toAddDictionary.ContainsKey(k))
                {
                    toAddDictionary.Add(k, addDictionary[k]);
                }
            }
            return(new RawNode(toAddDictionary));
        }
Beispiel #2
0
        public RawNode WithFallback(RawNode fallback)
        {
            if (fallback == null)
            {
                return(this);
            }

            var dict         = new Dictionary <string, object>(this.dictionary);
            var fallbackDict = fallback.dictionary;

            foreach (var item in fallbackDict.Keys)
            {
                if (!dict.ContainsKey(item))
                {
                    dict.Add(item, fallbackDict[item]);
                }
            }

            return(new RawNode(dict));
        }
Beispiel #3
0
 public static void Stringify(StringBuilder sb, string key, RawNode node)
 {
     Stringify(sb, 0, key, node.GetRawData());
 }