Hola fide_uci.
Almacenar en una tabla las rutas+nombres de archivo que se seleccionen es a mi criterio la mejor opción. Luego con una simple consulta podrás saber si un archivo ya ha sido seleccionado.
Apegandome a lo que solicitas,
pero sin recomendartelo, podrías hacer:
Código Delphi
[-]
...
implementation
const
SIGNATURE = 'TU FIRMA';
procedure TForm1.Mark(const aFileName: string);
var
i: Integer;
begin
with TFileStream.Create(aFileName, fmOpenReadWrite) do
try
Seek(0, soFromEnd);
for i:= 0 to Length(SIGNATURE) do
Write(SIGNATURE[i], 1);
finally
Free;
end;
end;
function TForm1.isMarked(const aFileName: string): boolean;
var
buf: char;
str: string;
i : Integer;
begin
with TFileStream.Create(aFileName, fmOpenRead) do
try
Seek(-Length(SIGNATURE), soFromEnd);
for i:= 0 to length(SIGNATURE)-1 do
begin
Read(buf,1);
str := str + buf;
end;
finally
Free;
end;
Result := str = SIGNATURE;
end;
procedure TForm1.DeleteMark(const aFileName: string);
begin
if isMarked(aFileName) then
with TFileStream.Create(aFileName, fmOpenReadWrite) do
try
Size := Size - Length(SIGNATURE);
finally
Free;
end;
end;
El único inconveniente que encontre de este modo es con los archivos de texto, ya que al abrirlos (vg.: bloc de notas), se visualiza la firma.
Saludos.