-
Notifications
You must be signed in to change notification settings - Fork 5
/
IdSoapAttachment.pas
58 lines (47 loc) · 1.02 KB
/
IdSoapAttachment.pas
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
unit IdSoapAttachment;
{$I IdSoapDefines.inc}
interface
implementation
(* how to get a mime type:
var
GMimeTypes: TStringList;
procedure LoadMimeTypes;
var
LMimeTypes: TStringList;
s, l, m, e, el: String;
begin
LMimeTypes := TStringList.Create;
s := FileToString('/etc/mime.types');
while (s <> '') do
begin
split(s, #13, l, s);
l := StripSuperfluousWhiteSpace(l);
split(l, ' ', m, e);
while e <> '' do
begin
split(e, ' ', el, e);
LMimeTypes.Values[el] := m;
end;
end;
GMimeTypes := LMimeTypes;
end;
function GetMimeTypeForExt(AExt: String): String;
var
fReg: TRegistry;
begin
fReg := TRegistry.Create;
try
fReg.RootKey := HKEY_LOCAL_MACHINE;
fReg.OpenKey('Software\Classes\' + AExt, False);
Result := freg.ReadString('Content Type');
fReg.CloseKey;
if Result = '' then
begin
Result := 'Application/Octet-Stream';
end;
finally
freg.Free;
end;
end;
*)
end.