private bool checkEntityStart(DataBlock dataBlock)
 {
     string relationChild;
     string name = dataBlock.eatShortString();
     if (dataBlock.eatPlausibleString(out relationChild) == false)
         return false;
     if (relationChild != "")
     {
     //		if (eatPlausibleString(out relationParent) == false)
     //		return false;
     }
     string description;
     string indexfilename;
     if (dataBlock.eatPlausibleString(out description, false) == false)
         return false;
     if (dataBlock.eatPlausibleString(out indexfilename, false) == false)
         return false;
     return description.EndsWith(".ptr") ||
         indexfilename.EndsWith(".ptr");
 }
Esempio n. 2
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. 3
0
        private Variable ParseVariable(DataBlock dataBlock, Entity e)
        {
            // lee las variables
            if (JumptToDataSet(dataBlock) == false)
                return null;
            Variable v = new Variable(e);
            v.Name = dataBlock.eatShortString();
            v.Declaration = dataBlock.eatShortString();
            v.Filter = dataBlock.eatShortString();
            v.Range = dataBlock.eatShortString();
            v.Type = dataBlock.eatShortString();
            v.ValuesLabelsRaw = dataBlock.eatShortString();
            v.Label = dataBlock.eatShortString();
            v.Group = dataBlock.eatShortString();

            v.ParseDeclaration();
            v.ParseValueLabels();
            v.ParseMissingAndPrecision();
            return v;
        }
        private void ProcessOcurrence(DataBlock dataBlock, List<Entity> leaves, List<Entity> entitiesNames)
        {
            if (dataBlock.moveBackString() == -1)
                return;

            int keepN = dataBlock.n;
            string child = dataBlock.eatShortString();
            dataBlock.n = keepN;
            if (entitiesNames.Count > 0 && entitiesNames[entitiesNames.Count - 1].Name == child)
                return;
            if (dataBlock.IsText(child) == false || child == "") return;
            // avanzó ok...
            List<Entity> names = new List<Entity>();
            TryEntities(dataBlock, child, names);
            if (names.Count > 0)
                leaves.AddRange(names);
        }