Esempio n. 1
0
        public Entity ParseEntity(DataBlock dataBlock, string entity, string parent)
        {
            var e = new Entity();
            e.rootPath = rootPath;
            // construye el encabezado esperable
            var block = dataBlock.makeStringBlock(entity);
            var blockParent = dataBlock.makeStringBlock(parent);
            byte[] full;
            if (parent != "")
                full = dataBlock.addArrays(block, block, blockParent);
            else
                full = dataBlock.addArrays(block, blockParent);

            if (dataBlock.moveTo(full) == false)
                throw new Exception("Sequence not found.");
            // lee la entidad
            e.Name = dataBlock.eatShortString();
            e.RelationChild = dataBlock.eatShortString();
            if (e.RelationChild != "")
                e.RelationParent = dataBlock.eatShortString();
            e.Description = dataBlock.eatShortString();
            e.IndexFilename = dataBlock.eatShortString();
            e.s1 = dataBlock.eat16int();
            if (e.IndexFilename != "")
            {
                e.CodesVariable = dataBlock.eatShortString();
                e.LabelVariable = dataBlock.eatShortString();
                e.Level = dataBlock.eat32int();
                e.b1 = dataBlock.eatByte();
                //e.VariableCount = no es confiable...que guarde rangos... eat32int();
                // en base al count de variables, que busque los "dataset"
                while (true)
                {
                    Variable v = ParseVariable(dataBlock, e);
                    if (v != null)
                        e.Variables.Add(v);
                    else
                        break;
                }
            }
            e.VariableCount = e.Variables.Count;
            return e;
        }
Esempio n. 2
0
        private int ParseBeginning(DataBlock dataBlock, string entity, string parent)
        {
            var e = new Entity();
            e.rootPath = rootPath;
            // construye el encabezado esperable
            var block = dataBlock.makeStringBlock(entity);
            var blockParent = dataBlock.makeStringBlock(parent);
            byte[] full;
            if (parent != "")
                full = dataBlock.addArrays(block, block, blockParent);
            else
                full = dataBlock.addArrays(block, blockParent);

            if (dataBlock.moveTo(full) == false)
                throw new Exception("Sequence not found.");
            return dataBlock.n;
        }