Exemplo n.º 1
0
        /// <summary>
        /// See <see cref="ITdfNodeAdapter.BeginBlock"/>.
        /// </summary>
        /// <param name="name">The name of the block.</param>
        public void BeginBlock(string name)
        {
            TdfNode n = new TdfNode(name);

            this.nodeStack.Peek().Keys[name] = n;
            this.nodeStack.Push(n);
        }
Exemplo n.º 2
0
        public bool ContentsEqual(TdfNode other)
        {
            if (!string.Equals(this.Name, other.Name, StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }
            if (this.Keys.Count != other.Keys.Count)
            {
                return(false);
            }

            if (this.Entries.Count != other.Entries.Count)
            {
                return(false);
            }

            foreach (var entry in this.Entries)
            {
                if (!other.Entries.TryGetValue(entry.Key, out var value) || entry.Value != value)
                {
                    return(false);
                }
            }

            foreach (var entry in this.Keys)
            {
                if (!other.Keys.TryGetValue(entry.Key, out var value) || !entry.Value.ContentsEqual(value))
                {
                    return(false);
                }
            }

            return(true);
        }