public void AddChild(IcuDataNode node)
 {
     if (_children == null)
     {
         _children = new List <IcuDataNode>();
     }
     _children.Add(node);
 }
        public void ParseData(Stream stream)
        {
            //simple parser
            IcuDataTree result = new IcuDataTree();

            ResultTree = result;

            Stack <IcuDataNode> nodeStack = new Stack <IcuDataNode>();
            IcuDataNode         curNode   = null;

            using (StreamReader reader = new StreamReader(stream))
            {
                //simple parser
                string line = reader.ReadLine();
                while (line != null)
                {
                    line = line.Trim();
                    if (line.StartsWith("//"))
                    {
                        line = reader.ReadLine();
                        continue;
                    }

                    if (line.EndsWith("{"))
                    {
                        //open new node
                        int indexOf = line.IndexOf("{");
                        if (indexOf != line.Length - 1)
                        {
                            throw new NotSupportedException();
                        }

                        IcuDataNode newNode = new IcuDataNode();
                        newNode.Name = line.Substring(0, indexOf);

                        if (curNode != null)
                        {
                            curNode.AddChild(newNode);
                            nodeStack.Push(curNode);
                        }
                        curNode = newNode;
                    }
                    else if (line.StartsWith("}"))
                    {
                        //
                        if (nodeStack.Count > 0)
                        {
                            curNode = nodeStack.Pop();
                        }
                    }
                    else if (line.EndsWith("}"))
                    {
                        int firstBrace = line.IndexOf('{');
                        if (firstBrace > -1)
                        {
                            int lastBrace = line.LastIndexOf('}');

                            if (lastBrace > -1)
                            {
                                string nodeName = line.Substring(0, firstBrace);
                                string data     = line.Substring(firstBrace + 1, lastBrace - firstBrace - 1);
                                //remove string quote
                                if (data.StartsWith("\"") && data.EndsWith("\""))
                                {
                                    IcuDataNode newnode = new IcuDataNode();
                                    newnode.Name      = nodeName;
                                    newnode.TextValue = data.Substring(1, data.Length - 2);
                                    curNode.AddChild(newnode);
                                }
                                else
                                {
                                    throw new NotSupportedException();
                                }
                            }
                            else
                            {
                                throw new NotSupportedException();
                            }
                        }
                        else
                        {
                            throw new NotSupportedException();
                        }
                    }

                    //--------------------------
                    line = reader.ReadLine();
                    //--------------------------
                }
            }


            result.RootNode = curNode;
        }