-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCL2LLC.dpr
More file actions
70 lines (57 loc) · 1.56 KB
/
Copy pathCL2LLC.dpr
File metadata and controls
70 lines (57 loc) · 1.56 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
program CL2LLC;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.Classes, System.SysUtils, System.IniFiles, Winapi.Windows;
{$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED}
{$WEAKLINKRTTI ON}
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
procedure Convert(const AFile: string);
var
Ini: TIniFile;
Lst: TStringList;
Fmt: TFormatSettings;
Section: string;
Cnt,I: Integer;
Start,Duration: Double;
begin
// Numbers with decimal point (EN)!
if (ParamCount > 0) and FileExists(AFile) then
begin
Fmt := TFormatSettings.Create('en');
Lst := TStringList.Create;
Ini := TIniFile.Create(AFile);
try
Cnt := Ini.ReadInteger('General', 'NoOfCuts', 0);
Lst.Add('{ version: 1, cutSegments: [');
for I := 0 to Pred(Cnt) do
begin
Section := 'Cut' + IntToStr(I);
Start := StrToFloat(Ini.ReadString(Section, 'Start', '0'), Fmt);
Duration := StrToFloat(Ini.ReadString(Section, 'Duration', '0'), Fmt);
if (Start > 0) and (Duration > 0) then
Lst.Add(Format('{ start: %.6f, end: %.6f },', [Start, Start + Duration], Fmt));
end;
Lst.Add('], }');
Lst.SaveToFile(ChangeFileExt(AFile, '.llc'));
finally
Lst.Free;
Ini.Free;
end;
end else
begin
Writeln('Syntax');
Writeln('CL2LLC cutlistfile');
Writeln('');
Writeln('Press RETURN');
Readln;
end;
end;
begin
try
Convert(ParamStr(1));
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.