Exemple #1
0
        private Dictionary <uint, Node> ReadNodes(OsiReader reader)
        {
            var nodes = new Dictionary <uint, Node>();
            var count = reader.ReadUInt32();

            while (count-- > 0)
            {
                Node node   = null;
                var  type   = reader.ReadByte();
                var  nodeId = reader.ReadUInt32();
                switch ((Node.Type)type)
                {
                case Node.Type.Database:
                    node = new DatabaseNode();
                    break;

                case Node.Type.Proc:
                    node = new ProcNode();
                    break;

                case Node.Type.DivQuery:
                    node = new DivQueryNode();
                    break;

                case Node.Type.InternalQuery:
                    node = new InternalQueryNode();
                    break;

                case Node.Type.And:
                    node = new AndNode();
                    break;

                case Node.Type.NotAnd:
                    node = new NotAndNode();
                    break;

                case Node.Type.RelOp:
                    node = new RelOpNode();
                    break;

                case Node.Type.Rule:
                    node = new RuleNode();
                    break;

                case Node.Type.UserQuery:
                    node = new UserQueryNode();
                    break;

                default:
                    throw new NotImplementedException("No serializer found for this node type");
                }

                node.Read(reader);
                nodes.Add(nodeId, node);
            }

            return(nodes);
        }
Exemple #2
0
        private Dictionary<uint, Node> ReadNodes(OsiReader reader)
        {
            var nodes = new Dictionary<uint, Node>();
            var count = reader.ReadUInt32();
            while (count-- > 0)
            {
                Node node = null;
                var type = reader.ReadByte();
                var nodeId = reader.ReadUInt32();
                switch ((Node.Type)type)
                {
                    case Node.Type.Database:
                        node = new DatabaseNode();
                        break;

                    case Node.Type.Proc:
                        node = new ProcNode();
                        break;

                    case Node.Type.DivQuery:
                        node = new DivQueryNode();
                        break;

                    case Node.Type.InternalQuery:
                        node = new InternalQueryNode();
                        break;

                    case Node.Type.And:
                        node = new AndNode();
                        break;

                    case Node.Type.NotAnd:
                        node = new NotAndNode();
                        break;

                    case Node.Type.RelOp:
                        node = new RelOpNode();
                        break;

                    case Node.Type.Rule:
                        node = new RuleNode();
                        break;

                    case Node.Type.UserQuery:
                        node = new UserQueryNode();
                        break;

                    default:
                        throw new NotImplementedException("No serializer found for this node type");
                }

                node.Read(reader);
                nodes.Add(nodeId, node);
            }

            return nodes;
        }