summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e1948f2)
raw | patch | inline | side by side (parent: e1948f2)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 22 Apr 2016 12:53:46 +0000 (15:53 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 22 Apr 2016 12:54:32 +0000 (15:54 +0300) |
src/sfs/wadcvt.dpr | patch | blob | history |
diff --git a/src/sfs/wadcvt.dpr b/src/sfs/wadcvt.dpr
index bcb95204dd175df5eca2cd7f4cb857e486902996..d8058379b63784914b93e0b581a934e50bc9a236 100644 (file)
--- a/src/sfs/wadcvt.dpr
+++ b/src/sfs/wadcvt.dpr
sfs,
sfsPlainFS,
sfsZipFS,
- paszlib;
+ paszlib,
+ ImagingTypes, Imaging, ImagingUtility;
procedure processed (count: Cardinal);
buflen: Integer;
f: Integer;
st: string[24];
+ img: string;
begin
result := fname;
if length(ExtractFileExt(fname)) <> 0 then exit;
end;
end;
// targa (stupid hack; this "signature" is not required by specs)
+ {
if buflen >= 18 then
begin
Move((buf+buflen-18)^, (PChar(@st[1]))^, 16);
exit;
end;
end;
+ }
+ // detect image format
+ img := DetermineMemoryFormat(buf, buflen);
+ if length(img) > 0 then
+ begin
+ result := result+'.'+img;
+ exit;
+ end;
+ // check if this is text file
+ if buflen > 16 then
+ begin
+ for f := 0 to buflen-1 do
+ begin
+ if buf[f] = #127 then exit;
+ if buf[f] < #32 then
+ begin
+ if (buf[f] <> #9) and (buf[f] <> #10) and (buf[f] <> #13) then exit;
+ end;
+ end;
+ result := result+'.txt';
+ end;
finally
FreeMem(buf);
end;