示例#1
0
        public void AppendItem(string itemName, params object[] args)
        {
            var newNode = new PacketNode(itemName);

            if (args != null && args.Length > 0)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if ((string)args[i] != "")
                    {
                        var pair = new KeyValuePair <string, string>((string)args[i], (string)args[i + 1]);
                        newNode.Attributes.Add(pair);
                        i++;
                    }
                }
            }
            if (_inCollection)
            {
                _node.InnerNodes.Add(newNode);
            }
            else if (itemName != "")
            {
                _node = newNode;
            }
            else
            {
                _node = new PacketNode("packet");
            }
        }
示例#2
0
        public void OpenCollection(string collectionName, params object[] args)
        {
            var newNode = new PacketNode(collectionName);

            foreach (var arg in args)
            {
                newNode.Attributes.Add((KeyValuePair <string, string>)arg);
            }

            _node         = newNode;
            _inCollection = true;
        }
示例#3
0
 public void CloseItem()
 {
     _node = null;
 }