-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConvertFilesToUTF8.dpr
More file actions
56 lines (48 loc) · 1.11 KB
/
ConvertFilesToUTF8.dpr
File metadata and controls
56 lines (48 loc) · 1.11 KB
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
program ConvertFilesToUTF8;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
System.Classes,
System.IOUtils,
UTF8Converter in 'UTF8Converter.pas' {frmUTF8Converter};
var
Params: TArray<string>;
i: Integer;
SuccessCount: Integer;
begin
try
WriteLn('UTF-8 文件转换工具');
WriteLn('-------------------');
// 如果没有命令行参数,则使用默认参数
if ParamCount = 0 then
begin
// 默认转换这些文件
Params := [
'ConfigManager.pas',
'JSONConfig.pas',
'ConfigEditor.dpr',
'-d',
GetCurrentDir
];
end
else
begin
// 使用命令行参数
SetLength(Params, ParamCount);
for i := 1 to ParamCount do
Params[i-1] := ParamStr(i);
end;
// 执行转换
SuccessCount := TfrmUTF8Converter.ExecuteCommandLine(Params);
WriteLn(Format('转换完成,共成功转换 %d 个文件', [SuccessCount]));
WriteLn('按任意键退出...');
ReadLn;
except
on E: Exception do
begin
WriteLn('发生错误: ' + E.Message);
ReadLn;
end;
end;
end.