Ejemplo n.º 1
0
        private void ParserPass(int i)
        {
            var prop = stringBuilder.ToString();

            for (int p = 0; p < NodeParsers.Count; p++)
            {
                INodeParser parser = NodeParsers[p];

                IList <INodeData> nodes = null;

                int position = i - prop.Length;

                string patched;

                if (parser.IsValid(prop, out nodes, position, out patched))
                {
                    stringBuilder = new StringBuilder(patched);

                    for (int n = 0; n < nodes.Count; n++)
                    {
                        NodeDatas.Add(nodes[n]);

                        for (int i1 = 0; i1 < nodes[n].SubNodes.Count; i1++)
                        {
                            INodeData sub = nodes[n].SubNodes[i1];
                            if (!NodeUtils.IsTerminal(sub.Type))
                            {
                                IList <INodeData> subnodes;

                                var mainParser = new MainParser();

                                mainParser.ExtractNodeData(sub.Data, out subnodes);
                                sub.SubNodes.AddRange(subnodes);
                            }
                        }
                    }

                    // rest of the node
                    if (patched.Length != 0)
                    {
                        var patchedParser = new MainParser();

                        IList <INodeData> restOfNodes = null;

                        patchedParser.ExtractNodeData(patched, out restOfNodes);

                        for (int i1 = 0; i1 < restOfNodes.Count; i1++)
                        {
                            INodeData n = restOfNodes[i1];
                            NodeDatas.Add(n);
                        }
                    }

                    return;
                }
            }
        }
Ejemplo n.º 2
0
        public override void Deserialize(BinaryFormatter bf, Stream s)
        {
            base.Deserialize(bf, s);
            int version = (int)bf.Deserialize(s);
            int Count   = (int)bf.Deserialize(s);

            for (int i = 0; i < Count; i++)
            {
                PointF pf = (PointF)bf.Deserialize(s);
                NodeDatas.Add(pf);
            }
            if (version >= 2)
            {
                if (Stream != null)
                {
                    Stream.Deserialize(bf, s);
                }
            }
        }