-
Notifications
You must be signed in to change notification settings - Fork 2
/
TagExporter.pas
101 lines (80 loc) · 2.76 KB
/
TagExporter.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
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
95
96
97
98
99
100
101
{
Attempts to export VIS tags from a file into an override .txt
}
unit VISExporter;
//uses VisOverrides;
uses praFunctions;
function Initialize: integer;
begin
prepareOverrides();
end;
function Process(e: IInterface): integer;
var
i: integer;
frm: TForm;
clb: TCheckListBox;
curSig: String;
curName: String;
newElem: IInterface;
curEdid: String;
curTag: String;
outputTextFile: String;
begin
if Signature(e) = 'TES4' then
Exit;
outputTextFile := ScriptsPath + 'tagging-overrides\_auto-export.txt';
curName := DisplayName(e);
if curName <> '' then begin
curSig := Signature(e);
if
(curSig = 'MISC') or
//(curSig = 'OMOD') or
(curSig = 'KEYM') or
(curSig = 'AMMO') or
(curSig = 'ARMO') or
(curSig = 'BOOK') or
(curSig = 'WEAP') or
(curSig = 'ALCH') or
(curSig = 'NOTE') then begin
curTag := extractVisTag(curName);
if curTag <> '' then begin
curEdid := GetElementEditValues(e, 'EDID');
//AddMessage('Adding '+curTag+' for '+curEdid);
registerOverride(curEdid, curTag);
end;
end;
end;
end;
//============================================================================
function Finalize: integer;
var
i: integer;
dlgSave: TSaveDialog;
slExport: TStringList;
ExportFileName: string;
begin
slExport := TStringList.Create;
for i:=0 to overridesKeys.count-1 do begin
slExport.Add(overridesKeys[i]+'='+overridesVals[i]);
end;
ExportFileName := 'export.txt';
// Edit Scripts\vis-overrides\
if slExport.Count <> 0 then begin
dlgSave := TSaveDialog.Create(nil);
try
dlgSave.Options := dlgSave.Options + [ofOverwritePrompt];
dlgSave.Filter := 'Text (*.txt)|*.txt';
dlgSave.InitialDir := ScriptsPath+'tagging-overrides';
dlgSave.FileName := ExportFileName;
if dlgSave.Execute then begin
ExportFileName := dlgSave.FileName;
AddMessage('Saving ' + ExportFileName);
slExport.SaveToFile(ExportFileName);
end;
finally
dlgSave.Free;
end;
end;
slExport.Free;
end;
end.