コード例 #1
0
ファイル: FormOrg.cs プロジェクト: miguellgt/file-structures
        /**Función de Mantenimiento para la Organizacion Secuencial indexada*/
        public void MantenimientoSecInd(CArchivo fileOri, CArchivo fileNew, CNodoEntidad ent, CNodoEntidad entC, int tamBloque)
        {
            List<CBloque> listBloque;
            List<CIndice> listaInd;
            CIndice indPri,nuevoInd;
            long aux;
            
            listaInd = new List<CIndice>();
            
            aux = ent.getApCabDatos();
            
            while (aux != -1)
            {
                indPri = fileOri.LeerIndicePrimario(aux);
                nuevoInd = new CIndice();

                nuevoInd.setIndPrim(indPri.getIndPrim());
                nuevoInd.setTamIndPri(indPri.getTamIndPri());
                nuevoInd.setTipoInd(indPri.getTipoInd());

                listBloque = new List<CBloque>();
                
                CopiarSec(fileOri, fileNew, indPri.getCabBloques(), tamBloque, ref listBloque);
                
                nuevoInd.setDirInd(fileNew.ENDF());
                nuevoInd.setCabBloques(listBloque[0].getDir());
                fileNew.EscribeIndicePrimario(nuevoInd);
                
                listaInd.Add(nuevoInd);
                
                aux = indPri.getSigInd();
            }

            for (int i = 0; i < listaInd.Count - 1; i++)
            {
                listaInd[i].setSigInd(listaInd[i + 1].getDirInd());
                fileNew.EscribeIndicePrimario((listaInd[i]));
            }
            
            entC.setApCabDatos(listaInd[0].getDirInd());
            fileNew.escribeEntidad(entC, ent.getDir());
        }