1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
procedure TForm1.ScruteDossier1Fichier(Sender: TObject; Nom: String);// Réponse à l'événement OnFichier
var
dossierfichier : string;
cheminfichier : string;
nomfichier : string;
taille_fichier : integer;
penetration : integer;
date_fichier,AA,BB: TDateTime;
D, S1,S2,S3,S4,S5,S6,A1,B1 :String;
i,j:Integer;
begin
D := Edit4.Text;
limitedate:= StrToDateTime(D);
// AFFCIHE LES NOUVEAU FICHIER
// SUIVANT LA DERNIER DATE DU FICHIER LE PLUS RECENT CONNU
// compteur de l ensemble des fichiers presents
n_fil := n_fil+1;
Edit10.Text:= IntToStr(n_fil);
// RECUPERATION DES INFOS SUR LE FICHIER TROUVE
dossierfichier := ScruteDossier1.GetCheminFichier;
cheminfichier := ScruteDossier1.GetNomFichier;
nomfichier := ScruteDossier1.GetNomFichierSimple;
taille_fichier := ScruteDossier1.GetTailleFichier;
penetration := ScruteDossier1.GetPenetration;
date_fichier := ScruteDossier1.GetDateHeureFichier;
// AFFICHE DANS LE RICHEDIT L ENSEMBLE DES FICHIERS TROUVES
RichEdit2.lines.add(nomfichier+' Taille fichier '+IntToStr(taille_fichier)+
' Date '+DateToStr(date_fichier)+' Time '+TimeToStr(date_fichier)+' Penetration '+IntToStr(penetration));
// AFFICHE LES NOUVEAU FICHIER DANS LE TSTRINGGRID
if date_fichier > limitedate then
begin
//Compteur de fichier à inserer dans le TstringGrid
lig := lig+1;
Edit14.Text:= IntToStr(lig);
//SG_newfile.cells[0,lig] := IntToStr(lig);
SG_newfile.cells[0,lig] := DateToStr(date_fichier)+' '+TimeToStr(date_fichier);
SG_newfile.cells[1,lig] := nomfichier;
SG_newfile.cells[2,lig] := IntToStr(taille_fichier);
SG_newfile.cells[3,lig] := IntToStr(penetration);
SG_newfile.cells[4,lig] := dossierfichier;
SG_newfile.cells[5,lig] := cheminfichier;
end;
// AFFECTE LE NOMBRE EXACTE DE LIGNE AU TSTRINGGRID
SG_newfile.RowCount:=lig;
// TRI DECROISSANT DU TSTRINGGRID
With SG_newfile Do
Begin
For i:=1 To rowcount+1 Do
For j:=i+1 To RowCount+1 Do
A1 := Cells[0,i]; // DATE FICHIER (STRING)
AA := StrToDateTime(A1); // DATE FICHIER (TDATETIME)
B1 := Cells[0,j]; // DATE FICHIER (STRING)
BB := StrToDateTime(B1); // DATE FICHIER (TDATETIME)
// ON DEPLACE LA LIGNE ENTIER SUIVANT LA COMPARAISON ENTRE LES DEUX DATE
If AA<BB Then
Begin
S1 := Cells[0,i];
S2 := Cells[1,i];
S3 := Cells[2,i];
S4 := Cells[3,i];
S5 := Cells[4,i];
S6 := Cells[5,i];
Cells[0,i] := Cells[0,j];
Cells[1,i] := Cells[1,j];
Cells[2,i] := Cells[2,j];
Cells[3,i] := Cells[3,j];
Cells[4,i] := Cells[4,j];
Cells[5,i] := Cells[5,j];
Cells[0,j] := S1;
Cells[1,j] := S2;
Cells[2,j] := S3;
Cells[3,j] := S4;
Cells[4,j] := S5;
Cells[5,j] := S6;
End;
End;
end; |
Partager