-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnitMulticoreLog.pas
76 lines (63 loc) · 1.72 KB
/
UnitMulticoreLog.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
unit UnitMulticoreLog;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Actions,
Vcl.ActnList, Vcl.ExtActns, Vcl.StdCtrls;
type
TFrameMulticoreLog = class(TFrame)
ActionList: TActionList;
FileRun: TFileRun;
LabelDescription: TLabel;
ButtonEnable: TButton;
ButtonShow: TButton;
ButtonDisable: TButton;
procedure ButtonEnableClick(Sender: TObject);
procedure ButtonDisableClick(Sender: TObject);
procedure ButtonShowClick(Sender: TObject);
private
{ Private declarations }
procedure UpdateStatus();
public
{ Public declarations }
constructor Create(AOWner: TComponent); override;
end;
implementation
uses
GB300Utils;
{$R *.dfm}
{ TFrameMulticoreLog }
procedure TFrameMulticoreLog.ButtonDisableClick(Sender: TObject);
begin
if not DeleteFile(Path + 'log.txt') then
raise Exception.Create('Could not delete log.txt in root dir to disable logging');
UpdateStatus();
end;
procedure TFrameMulticoreLog.ButtonEnableClick(Sender: TObject);
var
FS: TFileStream;
begin
FS := TFileStream.Create(Path + 'log.txt', fmCreate);
FS.Free();
UpdateStatus();
end;
procedure TFrameMulticoreLog.ButtonShowClick(Sender: TObject);
begin
FileRun.FileName := Path + 'log.txt';
FileRun.Execute();
end;
constructor TFrameMulticoreLog.Create(AOWner: TComponent);
begin
inherited;
UpdateStatus();
end;
procedure TFrameMulticoreLog.UpdateStatus();
var
b: Boolean;
begin
b := FileExists(Path + 'log.txt');
ButtonEnable.Enabled := not b;
ButtonShow.Enabled := b;
ButtonDisable.Enabled := b;
end;
end.