program Instalar; {$M 16384,0,0} {$I-} uses Dos,crt; const espaco_livre=200; enter=chr(13); scim= chr(72); sbax= chr(80); esc=chr(27); var drive,directorio,directorio1:string; ok:integer; txt : string; cont,code: integer; DirInfo : SearchRec; posi : array[0..20] of integer; disco : array[1..8] of longint; ik : char; procedure cax(x,y,x1,y1,cor:integer); var i,j :integer; begin textcolor(cor); for i:=x to x1 do for j:=y to y1 do begin gotoxy(i,j); write('Û'); end; end; procedure caixa(x,y,x1,y1,cor:integer); begin cax(x+2,y+1,x1+2,y1+1,0); cax(x,y,x1,y1,cor); end; procedure apre_drives(i:integer); begin if (disco[i]<>-1) then begin gotoxy(48,5+i); if (i=1) then write(' C: espa‡o livre:',disco[i] div 1024,'kb') else if (i=2) then write(' D: espa‡o livre:',disco[i] div 1024,'kb') else if (i=3) then write(' E: espa‡o livre:',disco[i] div 1024,'kb') else if (i=4) then write(' F: espa‡o livre:',disco[i] div 1024,'kb') else if (i=5) then write(' G: espa‡o livre:',disco[i] div 1024,'kb') else if (i=6) then write(' H: espa‡o livre:',disco[i] div 1024,'kb') else if (i=7) then write(' I: espa‡o livre:',disco[i] div 1024,'kb') else if (i=8) then write(' J: espa‡o livre:',disco[i] div 1024,'kb'); end else if (disco[i]=-1) then begin gotoxy(48,5+i); if (i=1) then write(' C: Desactivado ') else if (i=2) then write(' D: Desactivado ') else if (i=3) then write(' E: Desactivado ') else if (i=4) then write(' F: Desactivado ') else if (i=5) then write(' G: Desactivado ') else if (i=6) then write(' H: Desactivado ') else if (i=7) then write(' I: Desactivado ') else if (i=8) then write(' J: Desactivado '); end else if (disco[i]'1') then begin textbackground(7); textcolor(0); apre_drives(i); if ((ik=scim) and (i<>1)) then i:=i-1 else if ((ik=scim) and (i=1)) then i:=8; if ((ik=sbax) and (i<>8)) then i:=i+1 else if ((ik=sbax) and (i=8)) then i:=1; textbackground(3); textcolor(1); apre_drives(i); end; if (ik=enter) and (disco[i]>=espaco_livre) then ok:=1; if (ik=esc) then begin textcolor(7); textbackground(0); clrscr; writeln('Instala‡Æo abortado pelo utilizador ...'); halt(1); end; end; end; if (i=1) then drive:='C:\' else if (i=2) then drive:='D:\' else if (i=3) then drive:='E:\' else if (i=4) then drive:='F:\' else if (i=5) then drive:='G:\' else if (i=6) then drive:='H:\' else if (i=7) then drive:='I:\' else if (i=8) then drive:='J:\'; ok:=0; while ok=0 do begin gotoxy(5,18); write('Em que directorio deseja installar o KABBOOUM : ',drive,' '); gotoxy(56,18); readln(directorio); if (length(directorio)<>0) and (length(directorio)<=8) then ok:=1; end; directorio:=concat(drive,directorio); ChDir(directorio); if IOResult <> 0 then mkdir(directorio); gotoxy(5,14); write(' A copiar ' ); textcolor(1); gotoxy(5,16); write ('A:\kabbooum\egavga.bgi ',directorio); txt:=concat('/c copy a:\kabbooum\egavga.bgi ',directorio, '> nul'); SwapVectors; Exec(GetEnv('COMSPEC'),txt); SwapVectors; textcolor(0); gotoxy(6,23); write('0%ÛÛÛÛÛ°°°°°°°°°°°°°°°°°°°°°°°°°50%°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°100%'); cax(3,16,70,19,1); gotoxy(3,16); write ('De A:\kabbooum\kabbooum.exe para ',directorio); txt:=concat('/c copy a:\kabbooum\kabbooum.exe ',directorio, '> nul'); SwapVectors; Exec(GetEnv('COMSPEC'),txt); SwapVectors; textcolor(0); gotoxy(6,23); write('0%ÛÛÛÛÛÛÛÛÛÛ°°°°°°°°°°°°°°°°°°°°50%°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°100%'); cax(3,16,60,19,1); gotoxy(3,16); write ('De A:\kabbooum\litt.chr para ',directorio); txt:=concat('/c copy a:\kabbooum\litt.chr ',directorio, '> nul'); SwapVectors; Exec(GetEnv('COMSPEC'),txt); SwapVectors; textcolor(0); gotoxy(6,23); write('0%ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ°°°°°°°°°°°°°°50%°°°°°°°°°°°°°°°°°°°°°°°°°°°°°100%'); cax(3,16,60,19,1); gotoxy(3,16); write ('De A:\kabbooum\sans.chr para ',directorio); txt:=concat('/c copy a:\kabbooum\sans.chr ',directorio, '> nul'); SwapVectors; Exec(GetEnv('COMSPEC'),txt); SwapVectors; textcolor(0); gotoxy(6,23); write('0%ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ°°°°°°°°50%°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°100%'); cax(3,16,60,19,1); gotoxy(3,16); write ('De A:\kabbooum\trip.chr para',directorio); txt:=concat('/c copy a:\kabbooum\trip.chr ',directorio, '> nul'); SwapVectors; Exec(GetEnv('COMSPEC'),txt); SwapVectors; textcolor(0); gotoxy(6,23); write('0%ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ50%°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°100%'); cont:=0; FindFirst('a:\kabbooum\data\*.dat', Archive, DirInfo); while DosError = 0 do begin txt:=Copy(DirInfo.Name, 5, 2); if Pos('.', txt) > 0 then begin txt:=Copy(txt, 1, 1); end; val(txt,posi[cont],code); FindNext(DirInfo); cont:=cont+1; end; directorio1:=concat(directorio,'\data'); ChDir(directorio1); if IOResult <> 0 then mkdir(directorio1); for i:=0 to cont-1 do begin cax(3,16,60,19,1); gotoxy(3,16); str(posi[i],txt); write ('De A:\kabbooum\data\mens',txt,'.dat para',directorio1); txt:=concat('/c copy a:\kabbooum\data\mens',txt,'.dat ',directorio1, '> nul'); SwapVectors; Exec(GetEnv('COMSPEC'),txt); SwapVectors; textcolor(0); for j:=0 to trunc(29/cont) do begin gotoxy(41+trunc(29/cont)*i+j,23); write('Û'); end; end; textcolor(0); gotoxy(6,23); write('0%ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ50%ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ100%'); chdir(directorio); cax(3,16,70,19,1); textcolor(14); textbackground(0); gotoxy(5,17); writeln('Para come‡ar escreva '); textcolor(15); textbackground(0); gotoxy(5,19); writeln(' Prima uma tecla para sair da instala‡„o '); repeat until KeyPressed; textcolor(7); textbackground(0); clrscr; end.