private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Files:array of myfile;
tmpfile:string;
fileprefix,filepostfix:string;
cur:integer;
sr:tsearchrec;
total,code:integer;
tmp:myfile;
implementation
{$R *.dfm}
procedure TForm1.ExitExecute(Sender: TObject);
begin
Close;
end;
procedure TForm1.LocalFileExecute(Sender: TObject);
var
loop,loop1:integer;
begin
total:=1;
setlength(files,1);
if opendialog1.Execute then
begin
tmpfile:=extractfilename(opendialog1.FileName);
//showmessage(tmpfile);
delete(tmpfile,pos('.',tmpfile),length(extractfileext(tmpfile)));
//showmessage(tmpfile);
for loop:=length(tmpfile) downto 1 do
begin
if not isnumeric(tmpfile[loop]) then
break;
end;
if loop=length(tmpfile) then
begin
files[0].filename:=opendialog1.filename;
files[0].sequence:=1;
files[0].postfix:='';
end
else
begin
if isnumeric(tmpfile[loop]) then
else
loop:=loop+1;
cur:=0;
fileprefix:=tmpfile;
delete(fileprefix,loop,length(fileprefix)-loop+1);
findfirst(fileprefix+'*'+extractfileext(opendialog1.FileName),faanyfile,sr);
files[0].filename:=sr.Name;
files[0].postfix:=tmpfile;
delete(files[0].postfix,1,loop-1);
val(files[cur].postfix,files[cur].sequence,code);
//showmessage(files[cur].postfix);
//showmessage(files[0].postfix);
while findnext(sr)=0 do
begin
total:=total+1;
setlength(files,total);
cur:=cur+1;
files[cur].filename:=sr.Name;
files[cur].postfix:= sr.Name;
delete(files[cur].postfix,1,loop-1);
delete(files[cur].postfix,pos('.',files[cur].postfix),length(extractfileext(opendialog1.FileName)));
val(files[cur].postfix,files[cur].sequence,code);
//showmessage(files[cur].postfix);
end;//while
//showmessage(files[0].filename);
end; //else
for loop:=0 to total-2 do
for loop1:=loop+1 to total-1 do
if files[loop].sequence>files[loop1].sequence then
begin
tmp:=files[loop];
files[loop]:=files[loop1];
files[loop1]:=tmp;
end;//if
for loop:=0 to total-1 do
if files[loop].filename=extractfilename(opendialog1.FileName) then
begin
cur:=loop;
break;
end;
webbrowser1.Navigate(opendialog1.FileName);
end; //if
end;
procedure TForm1.PrevExecute(Sender: TObject);
begin
if cur>0 then
begin
cur:=cur-1;
webbrowser1.Navigate(extractfilepath(opendialog1.FileName)+files[cur].filename);
end;
end;
procedure TForm1.NextExecute(Sender: TObject);
begin
//
if cur<total-1 then
begin
cur:=cur+1;
webbrowser1.Navigate(extractfilepath(opendialog1.FileName)+files[cur].filename);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
setlength(files,1);
total:=1;
end;
procedure TForm1.AboutExecute(Sender: TObject);
begin
showmessage('Copyright @ Oyster'+#13+#10+'All right reserved');
end;