173 lines
4.6 KiB
Plaintext
173 lines
4.6 KiB
Plaintext
unit DCustomCttSchOpt;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons;
|
|
|
|
type
|
|
TDlgCustomCttSchOpt = class(TForm)
|
|
btnOk: TButton;
|
|
btnCancel: TButton;
|
|
GroupBox1: TGroupBox;
|
|
Label1: TLabel;
|
|
mmTarget: TMemo;
|
|
Label2: TLabel;
|
|
edTgExts: TEdit;
|
|
GroupBox2: TGroupBox;
|
|
Label3: TLabel;
|
|
edRules: TEdit;
|
|
btnRule: TSpeedButton;
|
|
Label4: TLabel;
|
|
mmExcept: TMemo;
|
|
chIncFName: TCheckBox;
|
|
chIncZip: TCheckBox;
|
|
Label5: TLabel;
|
|
edLimitMB: TEdit;
|
|
Label6: TLabel;
|
|
edTmSec: TEdit;
|
|
Label7: TLabel;
|
|
Label8: TLabel;
|
|
procedure btnRuleClick(Sender: TObject);
|
|
procedure btnOkClick(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
sRecentRule_: String;
|
|
procedure SaveOpt;
|
|
procedure LoadOpt;
|
|
procedure UpdateRName;
|
|
public
|
|
{ Public declarations }
|
|
Constructor Create(aOwner: TComponent); override;
|
|
procedure CreateParams(var Params: TCreateParams); override; // 작업표시줄에 표시
|
|
|
|
property UseRule: String read sRecentRule_;
|
|
end;
|
|
|
|
var
|
|
DlgCustomCttSchOpt: TDlgCustomCttSchOpt;
|
|
|
|
implementation
|
|
|
|
uses
|
|
DRuleList, Tocsg.Safe, System.IniFiles, Tocsg.Path, Tocsg.Strings, ManagerService;
|
|
|
|
resourcestring
|
|
RS_InputTarget = '대상 폴더 및 드라이브를 입력해 주십시오.';
|
|
RS_TargetExts = '대상 확장자를 입력해 주십시오.';
|
|
RS_InputRule = '컨텐츠 룰을 하나 이상 추가해 주십시오.';
|
|
|
|
{$R *.dfm}
|
|
|
|
Constructor TDlgCustomCttSchOpt.Create(aOwner: TComponent);
|
|
begin
|
|
Inherited Create(aOwner);
|
|
sRecentRule_ := '';
|
|
LoadOpt;
|
|
end;
|
|
|
|
procedure TDlgCustomCttSchOpt.CreateParams(var Params: TCreateParams);
|
|
begin
|
|
Inherited CreateParams(Params);
|
|
Params.ExStyle := WS_EX_APPWINDOW;
|
|
end;
|
|
|
|
procedure TDlgCustomCttSchOpt.SaveOpt;
|
|
var
|
|
ini: TIniFile;
|
|
begin
|
|
Guard(ini, TIniFile.Create(CutFileExt(GetRunExePath) + '.ini'));
|
|
ini.WriteString('CustomCttSch', 'Target', mmTarget.Text);
|
|
ini.WriteString('CustomCttSch', 'TgExts', edTgExts.Text);
|
|
ini.WriteString('CustomCttSch', 'ExceptPh', mmExcept.Text);
|
|
ini.WriteString('CustomCttSch', 'RecentRule', sRecentRule_);
|
|
ini.WriteBool('CustomCttSch', 'IncFName', chIncFName.Checked);
|
|
ini.WriteBool('CustomCttSch', 'IncZip', chIncZip.Checked);
|
|
ini.WriteInteger('CustomCttSch', 'LimitMB', StrToIntDef(edLimitMB.Text, 50));
|
|
ini.WriteInteger('CustomCttSch', 'TmSec', StrToIntDef(edTmSec.Text, 30));
|
|
end;
|
|
|
|
procedure TDlgCustomCttSchOpt.LoadOpt;
|
|
var
|
|
ini: TIniFile;
|
|
begin
|
|
Guard(ini, TIniFile.Create(CutFileExt(GetRunExePath) + '.ini'));
|
|
mmTarget.Text := ini.ReadString('CustomCttSch', 'Target', '');
|
|
edTgExts.Text := ini.ReadString('CustomCttSch', 'TgExts', 'doc|docx|xls|xlsx|ppt|pptx|txt|pdf');
|
|
mmExcept.Text := ini.ReadString('CustomCttSch', 'ExceptPh', ':\Windows\|:\Programs File|');
|
|
sRecentRule_ := ini.ReadString('CustomCttSch', 'RecentRule', '');
|
|
chIncFName.Checked := ini.ReadBool('CustomCttSch', 'IncFName', false);
|
|
chIncZip.Checked := ini.ReadBool('CustomCttSch', 'IncZip', false);
|
|
edLimitMB.Text := IntToStr(ini.ReadInteger('CustomCttSch', 'LimitMB', 50));
|
|
edTmSec.Text := IntToStr(ini.ReadInteger('CustomCttSch', 'TmSec', 30));
|
|
UpdateRName;
|
|
end;
|
|
|
|
procedure TDlgCustomCttSchOpt.UpdateRName;
|
|
var
|
|
RList: TStringList;
|
|
sRNames: String;
|
|
i: Integer;
|
|
begin
|
|
if gMgSvc = nil then
|
|
exit;
|
|
|
|
Guard(RList, TStringList.Create);
|
|
SplitString(sRecentRule_, ';', RList);
|
|
|
|
sRNames := '';
|
|
for i := 0 to RList.Count - 1 do
|
|
SumString(sRNames, gMgSvc.MgRule.GetRuleNameFromId(RList[i]), ', ');
|
|
|
|
edRules.Text := sRNames;
|
|
end;
|
|
|
|
procedure TDlgCustomCttSchOpt.btnOkClick(Sender: TObject);
|
|
begin
|
|
mmTarget.Text := Trim(mmTarget.Text);
|
|
edTgExts.Text := Trim(edTgExts.Text);
|
|
mmExcept.Text := Trim(mmExcept.Text);
|
|
edLimitMB.Text := Trim(edLimitMB.Text);
|
|
edTmSec.Text := Trim(edTmSec.Text);
|
|
|
|
if mmTarget.Text = '' then
|
|
begin
|
|
MessageBox(Handle, PChar(RS_InputTarget), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
mmTarget.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if edTgExts.Text = '' then
|
|
begin
|
|
MessageBox(Handle, PChar(RS_TargetExts), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
edTgExts.SetFocus;
|
|
exit;
|
|
end;
|
|
|
|
if sRecentRule_ = '' then
|
|
begin
|
|
MessageBox(Handle, PChar(RS_InputRule), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
btnRule.Click;
|
|
exit;
|
|
end;
|
|
|
|
SaveOpt;
|
|
|
|
ModalResult := mrOk;
|
|
end;
|
|
|
|
procedure TDlgCustomCttSchOpt.btnRuleClick(Sender: TObject);
|
|
var
|
|
dlg: TDlgRuleList;
|
|
begin
|
|
Guard(dlg, TDlgRuleList.Create(Self, sRecentRule_));
|
|
if dlg.ShowModal = mrOk then
|
|
begin
|
|
sRecentRule_ := dlg.ChkRList;
|
|
UpdateRName;
|
|
end;
|
|
end;
|
|
|
|
end.
|