1694 lines
49 KiB
Plaintext
1694 lines
49 KiB
Plaintext
unit DViewCttSchResult;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|
System.Classes, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
|
|
Vcl.ExtCtrls, VirtualTrees, Vcl.Buttons, System.ImageList, Vcl.ImgList,
|
|
PngImageList, Vcl.WinXPanels, Vcl.Imaging.pngimage, Vcl.StdCtrls,
|
|
Vcl.Menus, Tocsg.Fasoo, Vcl.Graphics;
|
|
|
|
const
|
|
WM_CLICK_DECRYPT = WM_USER + 8548;
|
|
|
|
type
|
|
TDlgViewCttSchResult = class(TForm)
|
|
pnMain: TPanel;
|
|
pnClient: TPanel;
|
|
lbTotalFile2: TLabel;
|
|
imgComment: TImage;
|
|
imgMiss: TImage;
|
|
imgDel: TImage;
|
|
vtList: TVirtualStringTree;
|
|
cbViewCate: TComboBox;
|
|
pnTop: TPanel;
|
|
imgClose: TImage;
|
|
lbTitle: TLabel;
|
|
pnLeft: TPanel;
|
|
Shape2: TShape;
|
|
Shape3: TShape;
|
|
Shape4: TShape;
|
|
pnLeftTop1: TPanel;
|
|
Image1: TImage;
|
|
Label1: TLabel;
|
|
Image2: TImage;
|
|
lbTotalFileCap: TLabel;
|
|
Label5: TLabel;
|
|
lbFndFileCap: TLabel;
|
|
lbTotalFile: TLabel;
|
|
lbTgFile: TLabel;
|
|
lbFndFile: TLabel;
|
|
pnLeftTop2: TPanel;
|
|
Image3: TImage;
|
|
Label2: TLabel;
|
|
Image4: TImage;
|
|
Label7: TLabel;
|
|
Label10: TLabel;
|
|
Label11: TLabel;
|
|
lbEndDT: TLabel;
|
|
lbBeginDT: TLabel;
|
|
lbSearchTime: TLabel;
|
|
pnLeftTop3: TPanel;
|
|
Image5: TImage;
|
|
Label3: TLabel;
|
|
Image6: TImage;
|
|
mmResult: TMemo;
|
|
imgBtnList2: TPngImageList;
|
|
imgBtnList: TPngImageList;
|
|
popFun: TPopupMenu;
|
|
miOpen: TMenuItem;
|
|
miPosGo: TMenuItem;
|
|
N1: TMenuItem;
|
|
miDrm: TMenuItem;
|
|
miDelete: TMenuItem;
|
|
N3: TMenuItem;
|
|
miCopyCB: TMenuItem;
|
|
pnEgTop: TPanel;
|
|
pnEgBottom: TPanel;
|
|
pnEgLeft: TPanel;
|
|
pnEgRight: TPanel;
|
|
Label4: TLabel;
|
|
lbEgLT: TLabel;
|
|
lbEgLB: TLabel;
|
|
lbEgRB: TLabel;
|
|
miExcept: TMenuItem;
|
|
miQuarantine: TMenuItem;
|
|
miExportCSV: TMenuItem;
|
|
SaveDialog: TSaveDialog;
|
|
procedure vtListGetNodeDataSize(Sender: TBaseVirtualTree;
|
|
var NodeDataSize: Integer);
|
|
procedure vtListFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
|
procedure vtListGetImageIndex(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
|
Kind: TVTImageKind; Column: TColumnIndex; var Ghosted: Boolean;
|
|
var ImageIndex: TImageIndex);
|
|
procedure vtListGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
|
Column: TColumnIndex; TextType: TVSTTextType; var CellText: string);
|
|
procedure vtListHeaderClick(Sender: TVTHeader; HitInfo: TVTHeaderHitInfo);
|
|
procedure vtListCompareNodes(Sender: TBaseVirtualTree; Node1,
|
|
Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
|
|
procedure pnTopMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure imgCloseMouseLeave(Sender: TObject);
|
|
procedure imgCloseMouseEnter(Sender: TObject);
|
|
procedure imgCloseMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure imgCloseClick(Sender: TObject);
|
|
procedure vtListBeforeCellPaint(Sender: TBaseVirtualTree;
|
|
TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
|
|
CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
|
|
procedure imgCommentMouseEnter(Sender: TObject);
|
|
procedure imgCommentMouseLeave(Sender: TObject);
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
procedure miDrmClick(Sender: TObject);
|
|
procedure miDeleteClick(Sender: TObject);
|
|
procedure vtListContextPopup(Sender: TObject; MousePos: TPoint;
|
|
var Handled: Boolean);
|
|
procedure miOpenClick(Sender: TObject);
|
|
procedure miPosGoClick(Sender: TObject);
|
|
procedure miCopyCBClick(Sender: TObject);
|
|
procedure vtListPaintText(Sender: TBaseVirtualTree;
|
|
const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
|
|
TextType: TVSTTextType);
|
|
procedure cbViewCateChange(Sender: TObject);
|
|
procedure pnEgTopMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure pnEgRightMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure pnEgLeftMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure pnEgBottomMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure Label4MouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure lbEgLTMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure lbEgLBMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure lbEgRBMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure miExceptClick(Sender: TObject);
|
|
procedure miQuarantineClick(Sender: TObject);
|
|
procedure miExportCSVClick(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
FileImageList_: TPngImageList;// TImageList;
|
|
FIconIdxList_: TStringList;
|
|
sScanId_,
|
|
sTaskId_,
|
|
sOptFile_,
|
|
sHlpExe_,
|
|
sExpPath_,
|
|
sExceptReason_: String;
|
|
ExpList_: TStringList;
|
|
nRecentCate_: Integer;
|
|
bWaitCheckCompleted_: Boolean;
|
|
AipExtList_: TStringList;
|
|
fas_: TTgFasoo;
|
|
procedure RefreshInfo;
|
|
procedure RefreshList;
|
|
procedure SetImgBtn(img: TImage; nImgIdx: Integer);
|
|
procedure SetImgBtn2(nImgIdx: Integer);
|
|
function SendExceptReason: Boolean;
|
|
procedure UpdateEntVisible;
|
|
public
|
|
{ Public declarations }
|
|
Constructor Create(sScanId: String);
|
|
Destructor Destroy; override;
|
|
procedure CreateParams(var Params: TCreateParams); override;
|
|
|
|
procedure process_WM_COPYDATA(var msg: TMessage); Message WM_COPYDATA;
|
|
procedure process_WM_CLICK_DECRYPT(var msg: TMessage); Message WM_CLICK_DECRYPT;
|
|
end;
|
|
|
|
var
|
|
DlgViewCttSchResult: TDlgViewCttSchResult;
|
|
|
|
implementation
|
|
|
|
uses
|
|
Tocsg.Shell, Tocsg.Path, GlobalDefine, Tocsg.VTUtil, superobject,
|
|
Tocsg.Strings, Tocsg.Safe, Tocsg.Files, Tocsg.Convert, VirtualTrees.Types,
|
|
System.Math, System.DateUtils, Tocsg.Encrypt, DefineHelper, Tocsg.Process,
|
|
DProgCttSchTask, Tocsg.Exception, Condition, Tocsg.Export, ManagerService,
|
|
CttSchDefine, Define, ManagerModel, Tocsg.FileInfo, Tocsg.AIP,
|
|
Tocsg.Fasoo.Global, Tocsg.Trace, Soap.EncdDecd;
|
|
|
|
resourcestring
|
|
RS_JuminNum = '주민등록번호';
|
|
RS_Passport = '여권번호';
|
|
RS_PhoneNum = '전화번호';
|
|
RS_Email = '이메일주소';
|
|
RS_Drug = '환각성약물';
|
|
RS_BanDrug = '금지약물';
|
|
RS_Addr = '주소';
|
|
RS_CarNum = '차량번호';
|
|
RS_MedicalNum = '의료보장번호';
|
|
RS_CustomPtrn = '지정 패턴';
|
|
RS_CustomKwd = '지정 키워드';
|
|
RS_CopyDB = '클립보드에 복사 되었습니다.';
|
|
RS_SelFile = '파일을 선택해 주십시오.';
|
|
RS_Limit1000 = '1000개 미만으로 선택해 주십시오.';
|
|
RS_FailCopyCB = '클립보드 복사를 실패했습니다.';
|
|
RS_SelQuaran = '격리 할 파일을 선택해 주십시오.';
|
|
RS_Q_SelQuaran = '선택한 파일들을 격리 하시겠습니까?';
|
|
RS_SelDelFile = '완전삭제 할 파일을 선택해 주십시오.';
|
|
RS_Q_Delete = '선택된 파일들을 완전삭제 하시겠습니까?';
|
|
RS_SelDrmFile = 'DRM을 적용할 파일을 선택해 주십시오.';
|
|
RS_Q_EncDRM = '선택된 파일들을 DRM 적용 하시겠습니까?';
|
|
RS_Vul = '취약';
|
|
RS_Enc = '암호화됨';
|
|
RS_Delete = '삭제됨';
|
|
RS_Quarantine = '격리됨';
|
|
RS_Q_ExceptSelFile = '선택한 파일을 예외로 등록하시겠습니까?';
|
|
RS_SelExceptFile = '예외 할 파일을 선택해 주십시오.';
|
|
RS_Except = '예외됨';
|
|
RS_Caution = '위험';
|
|
RS_Warning = '경고';
|
|
RS_Attention = '주의';
|
|
RS_Normal = '일반';
|
|
RS_MsgExport = '내보내기를 완료 했습니다.';
|
|
RS_ErrorExport = '내보내기 중 오류가 발생했습니다.';
|
|
RS_ErrorExcept = '예외 신청중 오류가 발생했습니다.';
|
|
RS_RegExcept = '예외 등록';
|
|
RS_MsgExcept = '예외 등록 사유를 입력해주세요.';
|
|
RS_Ok = '확인';
|
|
RS_MsgMinInput = '최소 %d글자 이상 입력해 주십시오.';
|
|
|
|
{$R *.dfm}
|
|
|
|
{ TDlgViewCustomCttSchResult }
|
|
|
|
Constructor TDlgViewCttSchResult.Create(sScanId: String);
|
|
|
|
procedure InitCtrls;
|
|
var
|
|
hSysIcons: THandle;
|
|
begin
|
|
FIconIdxList_ := TStringList.Create;
|
|
FIconIdxList_.CaseSensitive := false;
|
|
FileImageList_ := TPngImageList.Create(Self);// TImageList.Create(Self);
|
|
vtList.Images := FileImageList_;
|
|
|
|
SetImgBtn(imgComment, imgComment.Tag);
|
|
SetImgBtn(imgMiss, imgMiss.Tag);
|
|
SetImgBtn(imgDel, imgDel.Tag);
|
|
SetImgBtn2(0);
|
|
|
|
cbViewCate.ItemIndex := 0;
|
|
|
|
// if CUSTOMER_TYPE = CUSTOMER_LSITC then
|
|
// begin
|
|
// miQuarantine.Enabled := true;
|
|
// miQuarantine.Visible := true;
|
|
// end;
|
|
end;
|
|
|
|
begin
|
|
Inherited Create(nil);
|
|
sScanId_ := sScanId;
|
|
sTaskId_ := '';
|
|
sHlpExe_ := GetRunExePathDir + DIR_CONF + EXE_HLP;
|
|
sOptFile_ := GetRunExePathDir + DIR_CONF + DAT_PARAM;
|
|
sExpPath_ := GetRunExePathDir + DIR_CTTSCHRST + sScanId_ + '.' + DAT_CTTSCHRSTDATA_EXP;
|
|
AipExtList_ := TStringList.Create;
|
|
AipExtList_.CaseSensitive := false;
|
|
SplitString(AIP_EXTS, '|', AipExtList_);
|
|
ExpList_ := TStringList.Create;
|
|
ExpList_.CaseSensitive := false;
|
|
case CUSTOMER_TYPE of
|
|
CUSTOMER_TMAP : miExcept.Visible := false;
|
|
else miExcept.Visible := true;
|
|
end;
|
|
if CUSTOMER_TYPE = CUSTOMER_SCD then
|
|
miDrm.Visible := false
|
|
else
|
|
miDrm.Visible := not NotUseDRM;
|
|
imgComment.Visible := miDrm.Visible;
|
|
cbViewCate.Visible := miDrm.Visible;
|
|
ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD);
|
|
sExceptReason_ := '';
|
|
nRecentCate_ := 0;
|
|
bWaitCheckCompleted_ := false;
|
|
|
|
fas_ := nil;
|
|
if UseFasooDecrypt then
|
|
begin
|
|
var bLoadFas: Boolean := true;
|
|
case CUSTOMER_TYPE of
|
|
CUSTOMER_LOTTEMART : SetDSD_CODE(DSD_CODE_LOTTEMART);
|
|
CUSTOMER_WELFNI : SetDSD_CODE(DSD_CODE_WFNI);
|
|
CUSTOMER_WELFND : SetDSD_CODE(DSD_CODE_WFND);
|
|
// CUSTOMER_CJONS : SetDSD_CODE(DSD_CODE_CJ);
|
|
CUSTOMER_GIORDANO : SetDSD_CODE(DSD_CODE_GIORDANO);
|
|
else bLoadFas := false;
|
|
end;
|
|
|
|
if bLoadFas then
|
|
begin
|
|
var sFsDir: String := GetRunExePathDir + 'fsdinit';
|
|
if not DirectoryExists(sFsDir) then
|
|
sFsDir := GetRunExePathDir + DIR_CONF + 'fsdinit';
|
|
fas_ := TTgFasoo.Create(sFsDir);
|
|
end;
|
|
end;
|
|
|
|
InitCtrls;
|
|
RefreshInfo;
|
|
RefreshList;
|
|
end;
|
|
|
|
Destructor TDlgViewCttSchResult.Destroy;
|
|
begin
|
|
if fas_ <> nil then
|
|
FreeAndNil(fas_);
|
|
FreeAndNil(ExpList_);
|
|
FreeAndNil(AipExtList_);
|
|
FreeAndNil(FIconIdxList_);
|
|
Inherited;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.CreateParams(var Params: TCreateParams);
|
|
begin
|
|
// BorderStyle := bsNone;
|
|
Inherited;
|
|
|
|
// if WindowState = TWindowState.wsNormal then
|
|
// begin
|
|
// Params.ExStyle := Params.ExStyle or WS_EX_STATICEDGE;
|
|
// Params.Style := Params.Style or WS_SIZEBOX;
|
|
// end;
|
|
|
|
Params.ExStyle := WS_EX_APPWINDOW;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.UpdateEntVisible;
|
|
var
|
|
pNode: PVirtualNode;
|
|
pData: PRstEnt;
|
|
nCnt: Integer;
|
|
begin
|
|
if not bWaitCheckCompleted_ or (cbViewCate.ItemIndex <> nRecentCate_) then
|
|
begin
|
|
nCnt := 0;
|
|
|
|
vtList.BeginUpdate;
|
|
try
|
|
pNode := vtList.GetFirst;
|
|
while pNode <> nil do
|
|
begin
|
|
pData := vtList.GetNodeData(pNode);
|
|
|
|
if not bWaitCheckCompleted_ then
|
|
begin
|
|
if pData.State = resWait then
|
|
begin
|
|
pData.State := resVul;
|
|
if not IsUseEncOnlyAIP then
|
|
begin
|
|
if FileExists(pData.sDir + pData.sFName) then
|
|
begin
|
|
try
|
|
if fas_ <> nil then
|
|
begin
|
|
case fas_.GetFileType(pData.sDir + pData.sFName) of
|
|
103, 106 : pData.State := resEnc;
|
|
end;
|
|
end else
|
|
if CUSTOMER_TYPE = CUSTOMER_CJONS then
|
|
begin
|
|
case GetFileType_r(pData.sDir + pData.sFName) of
|
|
109, // 이거 뭔지 모르지만 GetFileTypeW_r()로 FED5 암호화파일에서 검출됨.. 25_0217 18:54:27 kku
|
|
26, 103, 105, 106 : pData.State := resEnc;
|
|
end;
|
|
end else
|
|
if TTgEncrypt.CheckSign(pData.sDir + pData.sFName, SIG_DRM) then
|
|
pData.State := resEnc;
|
|
except
|
|
// ..
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
if cbViewCate.ItemIndex <> nRecentCate_ then
|
|
begin
|
|
case cbViewCate.ItemIndex of
|
|
0 : vtList.IsVisible[pNode] := true;
|
|
1 : vtList.IsVisible[pNode] := pData.State = resVul;
|
|
2 : vtList.IsVisible[pNode] := pData.State = resEnc;
|
|
3 : vtList.IsVisible[pNode] := pData.State = resDel;
|
|
4 : vtList.IsVisible[pNode] := pData.State = resExcept;
|
|
end;
|
|
|
|
if vtList.IsVisible[pNode] then
|
|
begin
|
|
Inc(nCnt);
|
|
pData.nNodeIdx := nCnt;
|
|
end;
|
|
end;
|
|
|
|
pNode := vtList.GetNext(pNode);
|
|
end;
|
|
finally
|
|
vtList.EndUpdate;
|
|
bWaitCheckCompleted_ := true;
|
|
nRecentCate_ := cbViewCate.ItemIndex;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.FormClose(Sender: TObject;
|
|
var Action: TCloseAction);
|
|
begin
|
|
if FileExists(sOptFile_) then
|
|
DeleteFile(sOptFile_);
|
|
Action := caFree;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.SetImgBtn(img: TImage; nImgIdx: Integer);
|
|
begin
|
|
imgBtnList.GetIcon(nImgIdx, img.Picture.Icon);
|
|
img.Repaint
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.SetImgBtn2(nImgIdx: Integer);
|
|
begin
|
|
imgBtnList2.GetIcon(nImgIdx, imgClose.Picture.Icon);
|
|
imgClose.Repaint
|
|
end;
|
|
|
|
function ConvPtrnIdToStr(sId: String): String;
|
|
begin
|
|
case StrToIntDef(sId, 0) of
|
|
1056002 : Result := RS_JuminNum;
|
|
1056003 : Result := RS_Passport;
|
|
1056004 : Result := RS_PhoneNum;
|
|
1056005 : Result := RS_Email;
|
|
1056006 : Result := RS_Drug;
|
|
1056007 : Result := RS_BanDrug;
|
|
1056008 : Result := RS_Addr;
|
|
1056009 : Result := RS_CarNum;
|
|
1056010 : Result := 'IP';
|
|
1056011 : Result := RS_MedicalNum;
|
|
1056012 : Result := RS_CustomPtrn;
|
|
1056013 : Result := RS_CustomKwd;
|
|
else Result := sId;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.imgCloseClick(Sender: TObject);
|
|
begin
|
|
Close;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.imgCloseMouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
SetImgBtn2(2);
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.imgCloseMouseEnter(Sender: TObject);
|
|
begin
|
|
SetImgBtn2(1);
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.imgCloseMouseLeave(Sender: TObject);
|
|
begin
|
|
SetImgBtn2(0);
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.imgCommentMouseEnter(Sender: TObject);
|
|
begin
|
|
if Sender is TImage then
|
|
SetImgBtn(TImage(Sender), TImage(Sender).Tag + 1);
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.imgCommentMouseLeave(Sender: TObject);
|
|
begin
|
|
if Sender is TImage then
|
|
SetImgBtn(TImage(Sender), TImage(Sender).Tag);
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.Label4MouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
if Button = mbLeft then
|
|
begin
|
|
ReleaseCapture;
|
|
Perform(WM_SYSCOMMAND, SC_SIZE + WMSZ_TOPRIGHT, 0);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.lbEgRBMouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
if Button = mbLeft then
|
|
begin
|
|
ReleaseCapture;
|
|
Perform(WM_SYSCOMMAND, SC_SIZE + WMSZ_BOTTOMRIGHT, 0);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.lbEgLBMouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
if Button = mbLeft then
|
|
begin
|
|
ReleaseCapture;
|
|
Perform(WM_SYSCOMMAND, SC_SIZE + WMSZ_BOTTOMLEFT, 0);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.lbEgLTMouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
if Button = mbLeft then
|
|
begin
|
|
ReleaseCapture;
|
|
Perform(WM_SYSCOMMAND, SC_SIZE + WMSZ_TOPLEFT, 0);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.miCopyCBClick(Sender: TObject);
|
|
var
|
|
pNode: PVirtualNode;
|
|
begin
|
|
case VT_CopyToClipboardSelectedInfo(vtList) of
|
|
0 : MessageBox(Handle, PChar(RS_CopyDB), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
1 : MessageBox(Handle, PChar(RS_SelFile), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
2 : MessageBox(Handle, PChar(RS_Limit1000), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
else MessageBox(Handle, PChar(RS_FailCopyCB), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.miDeleteClick(Sender: TObject);
|
|
var
|
|
pNode: PVirtualNode;
|
|
EntList: TRstEntList;
|
|
pData: PRstEnt;
|
|
dlg: TDlgProgCttSchTask;
|
|
bRefresh: Boolean;
|
|
i, nCnt: Integer;
|
|
begin
|
|
pNode := vtList.GetFirstSelected;
|
|
if pNode = nil then
|
|
begin
|
|
MessageBox(Handle, PChar(RS_SelDelFile), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
if MessageBox(Handle, PChar(RS_Q_Delete),
|
|
PChar(Caption), MB_ICONQUESTION or MB_YESNO) = IDNO then exit;
|
|
|
|
bRefresh := false;
|
|
Guard(EntList, TRstEntList.Create);
|
|
vtList.BeginUpdate;
|
|
try
|
|
while pNode <> nil do
|
|
begin
|
|
pData := vtList.GetNodeData(pNode);
|
|
if pData.State <> resDel then
|
|
begin
|
|
EntList.Add(pData);
|
|
// 대상에 zip이 있을경우 전체 새로고침 해준다.
|
|
// 상태 변경 시 적용을 위함 22_1201 17:01:27 kku
|
|
bRefresh := bRefresh or (Pos(pData.sExt, COMPRESS_EXTS) > 0);
|
|
end;
|
|
pNode := vtList.GetNextSelected(pNode);
|
|
end;
|
|
|
|
if EntList.Count = 0 then
|
|
exit;
|
|
|
|
Guard(dlg, TDlgProgCttSchTask.Create(Self, cstkDelete, EntList));
|
|
dlg.ShowModal;
|
|
|
|
nCnt := 0;
|
|
for i := 0 to EntList.Count - 1 do
|
|
begin
|
|
pData := EntList[i];
|
|
if pData.State = resDel then
|
|
begin
|
|
Inc(nCnt);
|
|
|
|
if sTaskId_ <> '' then
|
|
gMgSvc.MgCampn.SendCampaignResultSelfAction(sTaskId_, 'SELFDEL', pData.sDir + pData.sFName, i + 1);
|
|
end;
|
|
end;
|
|
|
|
if nCnt > 0 then
|
|
begin
|
|
var O: ISuperObject;
|
|
var sInfoPath: String := GetRunExePathDir + DIR_CTTSCHRST + sScanId_ + '.' + DAT_CTTSCHRST;
|
|
if LoadJsonObjFromFile(O, sInfoPath) then
|
|
begin
|
|
O.I['DelFileCount'] := O.I['DelFileCount'] + nCnt;
|
|
SaveJsonObjToFile(O, sInfoPath);
|
|
end;
|
|
|
|
gMgSvc.UpdateCttSchVulState;
|
|
end;
|
|
finally
|
|
vtList.EndUpdate;
|
|
end;
|
|
|
|
if bRefresh then
|
|
RefreshList;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.miDrmClick(Sender: TObject);
|
|
var
|
|
pNode: PVirtualNode;
|
|
EntList: TRstEntList;
|
|
pData: PRstEnt;
|
|
dlg: TDlgProgCttSchTask;
|
|
bRefresh: Boolean;
|
|
i, nEncCnt: Integer;
|
|
begin
|
|
pNode := vtList.GetFirstSelected;
|
|
if pNode = nil then
|
|
begin
|
|
MessageBox(Handle, PChar(RS_SelDrmFile), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
if MessageBox(Handle, PChar(RS_Q_EncDRM),
|
|
PChar(Caption), MB_ICONQUESTION or MB_YESNO) = IDNO then exit;
|
|
|
|
bRefresh := false;
|
|
Guard(EntList, TRstEntList.Create);
|
|
vtList.BeginUpdate;
|
|
try
|
|
while pNode <> nil do
|
|
begin
|
|
pData := vtList.GetNodeData(pNode);
|
|
if pData.State <> resEnc then
|
|
begin
|
|
EntList.Add(pData);
|
|
// 대상에 zip이 있을경우 전체 새로고침 해준다.
|
|
// 상태 변경 시 적용을 위함 22_1201 17:01:27 kku
|
|
bRefresh := bRefresh or (Pos(pData.sExt, COMPRESS_EXTS) > 0);
|
|
end;
|
|
pNode := vtList.GetNextSelected(pNode);
|
|
end;
|
|
|
|
if EntList.Count = 0 then
|
|
exit;
|
|
|
|
Guard(dlg, TDlgProgCttSchTask.Create(Self, cstkEnc, EntList));
|
|
dlg.ShowModal;
|
|
|
|
nEncCnt := 0;
|
|
for i := 0 to EntList.Count - 1 do
|
|
begin
|
|
pData := EntList[i];
|
|
if pData.State = resEnc then
|
|
begin
|
|
Inc(nEncCnt);
|
|
|
|
if sTaskId_ <> '' then
|
|
gMgSvc.MgCampn.SendCampaignResultSelfAction(sTaskId_, 'SELFDRM', pData.sDir + pData.sFName, i + 1);
|
|
end;
|
|
end;
|
|
|
|
if nEncCnt > 0 then
|
|
begin
|
|
var O: ISuperObject;
|
|
var sInfoPath: String := GetRunExePathDir + DIR_CTTSCHRST + sScanId_ + '.' + DAT_CTTSCHRST;
|
|
if LoadJsonObjFromFile(O, sInfoPath) then
|
|
begin
|
|
O.I['EncFileCount'] := O.I['EncFileCount'] + nEncCnt;
|
|
SaveJsonObjToFile(O, sInfoPath);
|
|
end;
|
|
|
|
gMgSvc.UpdateCttSchVulState;
|
|
end;
|
|
finally
|
|
vtList.EndUpdate;
|
|
end;
|
|
|
|
if bRefresh then
|
|
RefreshList;
|
|
end;
|
|
|
|
function TDlgViewCttSchResult.SendExceptReason: Boolean;
|
|
var
|
|
pData: PRstEnt;
|
|
pNode: PVirtualNode;
|
|
O, OA: ISuperObject;
|
|
dtCreate, dtModify, dtAccess: TDateTime;
|
|
sPath: String;
|
|
AddedList: TStringList;
|
|
begin
|
|
Result := false;
|
|
ASSERT(sExceptReason_ <> '');
|
|
try
|
|
Guard(AddedList, TStringList.Create); // 압축 파일 중복 처리를 위해 추가 23_1227 16:29:14 kku
|
|
|
|
OA := TSuperObject.Create(stArray);
|
|
vtList.BeginUpdate;
|
|
try
|
|
pNode := vtList.GetFirstSelected;
|
|
while pNode <> nil do
|
|
begin
|
|
pData := vtList.GetNodeData(pNode);
|
|
if pData.State <> resExcept then
|
|
begin
|
|
sPath := pData.sDir + pData.sFName;
|
|
if FileExists(sPath) and (AddedList.IndexOf(sPath) = -1) then
|
|
begin
|
|
O := SO;
|
|
O.S['DOCNAME'] := pData.sFName;
|
|
O.S['DOCPATH'] := pData.sDir;
|
|
O.S['DOCSIZE'] := IntToStr(GetFileSize_path(sPath));
|
|
if GetFileDateTime_Local(sPath, dtCreate, dtModify, dtAccess) then
|
|
O.S['DOCDATE'] := FormatDateTime('yyyy-mm-dd hh:nn:ss', dtModify)
|
|
else
|
|
O.S['DOCDATE'] := '2000-12-31 12:00:00';
|
|
OA.AsArray.Add(O);
|
|
|
|
AddedList.Add(sPath);
|
|
end;
|
|
end;
|
|
pNode := vtList.GetNextSelected(pNode);
|
|
end;
|
|
|
|
if OA.AsArray.Length > 0 then
|
|
begin
|
|
var ExptInfo: TReqDevExceptInfo;
|
|
ZeroMemory(@ExptInfo, SizeOf(ExptInfo));
|
|
ExptInfo.ReqDevType := rdtPiFile;
|
|
ExptInfo.sDevName := OA.AsString;
|
|
gMgSvc.SendRequest('', ExptInfo, sExceptReason_, '', '', 0, 'Request PI Except.');
|
|
sExceptReason_ := '';
|
|
Result := true;
|
|
end;
|
|
finally
|
|
vtList.EndUpdate;
|
|
end;
|
|
except
|
|
on E: Exception do
|
|
ETgException.TraceException(Self, E, 'Fail .. SendExceptReason() PI');
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.miExceptClick(Sender: TObject);
|
|
|
|
function CountNoExceptSel: Integer;
|
|
var
|
|
pNode: PVirtualNode;
|
|
pData: PRstEnt;
|
|
SelList: TStringList;
|
|
sPath: String;
|
|
begin
|
|
Result := 0;
|
|
Guard(SelList, TStringList.Create);
|
|
vtList.BeginUpdate;
|
|
try
|
|
pNode := vtList.GetFirstSelected;
|
|
while pNode <> nil do
|
|
begin
|
|
pData := vtList.GetNodeData(pNode);
|
|
if pData.State <> resExcept then
|
|
begin
|
|
sPath := pData.sDir + pData.sFName;
|
|
if SelList.IndexOf(sPath) = -1 then
|
|
begin
|
|
SelList.Add(sPath);
|
|
Inc(Result);
|
|
end;
|
|
end;
|
|
|
|
pNode := vtList.GetNextSelected(pNode);
|
|
end;
|
|
finally
|
|
vtList.EndUpdate;
|
|
end;
|
|
end;
|
|
|
|
var
|
|
pNode: PVirtualNode;
|
|
EntList: TRstEntList;
|
|
pData: PRstEnt;
|
|
dlg: TDlgProgCttSchTask;
|
|
bRefresh: Boolean;
|
|
i, nCnt: Integer;
|
|
begin
|
|
bRefresh := false;
|
|
|
|
if CountNoExceptSel = 0 then
|
|
begin
|
|
MessageBox(Handle, PChar(RS_SelExceptFile), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
if gMgSvc.IsNewApi then
|
|
begin
|
|
if sExceptReason_ = '' then
|
|
begin
|
|
pNode := vtList.GetFirstSelected;
|
|
if pNode = nil then
|
|
begin
|
|
MessageBox(Handle, PChar(RS_SelExceptFile), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
if MessageBox(Handle, PChar(RS_Q_ExceptSelFile),
|
|
PChar(Caption), MB_ICONQUESTION or MB_YESNO) = IDNO then exit;
|
|
|
|
var sExe: String := GetRunExePathDir + DIR_CONF + EXE_HLP;
|
|
if FileExists(sExe) then
|
|
begin
|
|
var O: ISuperObject := SO;
|
|
O.I['RcvWnd'] := Handle;
|
|
O.I['Cmd'] := HPCMD_INPUT_EXCEPT_REASON;
|
|
O.S['WinCap'] := APP_TITLE;
|
|
O.S['Title'] := RS_RegExcept;
|
|
O.S['Desc'] := RS_MsgExcept;
|
|
O.S['BtnOk'] := RS_Ok;
|
|
case CUSTOMER_TYPE of
|
|
CUSTOMER_GEC,
|
|
CUSTOMER_HDENG : O.I['MinTL'] := 10; // 10글자 이상
|
|
end;
|
|
O.S['MinMsg'] := RS_MsgMinInput;
|
|
|
|
SaveJsonObjToFile(O, GetRunExePathDir + DIR_CONF + DAT_PARAM);
|
|
{$IFDEF DEBUG}
|
|
ExecutePath(sExe);
|
|
{$ELSE}
|
|
ExecuteAppAsUser('explorer.exe', sExe, '', SW_SHOWNORMAL);
|
|
{$ENDIF}
|
|
vtList.Enabled := false;
|
|
end;
|
|
|
|
exit;
|
|
end else
|
|
if SendExceptReason then
|
|
begin
|
|
Guard(EntList, TRstEntList.Create);
|
|
vtList.BeginUpdate;
|
|
try
|
|
pNode := vtList.GetFirstSelected;
|
|
while pNode <> nil do
|
|
begin
|
|
pData := vtList.GetNodeData(pNode);
|
|
if pData.State = resVul then
|
|
begin
|
|
EntList.Add(pData);
|
|
|
|
// 대상에 zip이 있을경우 전체 새로고침 해준다.
|
|
// 상태 변경 시 적용을 위함 22_1201 17:01:27 kku
|
|
bRefresh := bRefresh or (Pos(pData.sExt, COMPRESS_EXTS) > 0);
|
|
end;
|
|
pNode := vtList.GetNextSelected(pNode);
|
|
end;
|
|
|
|
if EntList.Count = 0 then
|
|
exit;
|
|
|
|
Guard(dlg, TDlgProgCttSchTask.Create(Self, cstkCampExcept, EntList));
|
|
dlg.ShowModal;
|
|
|
|
nCnt := 0;
|
|
for i := 0 to EntList.Count - 1 do
|
|
begin
|
|
pData := EntList[i];
|
|
if pData.State = resExcept then
|
|
begin
|
|
Inc(nCnt);
|
|
|
|
if sTaskId_ <> '' then
|
|
gMgSvc.MgCampn.SendCampaignResultSelfAction(sTaskId_, 'SELFEXCEPT', pData.sDir + pData.sFName, i + 1);
|
|
end;
|
|
end;
|
|
|
|
if nCnt > 0 then
|
|
begin
|
|
var O: ISuperObject;
|
|
var sInfoPath: String := GetRunExePathDir + DIR_CTTSCHRST + sScanId_ + '.' + DAT_CTTSCHRST;
|
|
if LoadJsonObjFromFile(O, sInfoPath) then
|
|
begin
|
|
O.I['ExpFileCount'] := O.I['ExpFileCount'] + nCnt;
|
|
SaveJsonObjToFile(O, sInfoPath);
|
|
end;
|
|
|
|
gMgSvc.UpdateCttSchVulState;
|
|
end;
|
|
finally
|
|
vtList.EndUpdate;
|
|
end;
|
|
end else begin
|
|
MessageBox(Handle, PChar(RS_ErrorExcept), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
end else begin
|
|
pNode := vtList.GetFirstSelected;
|
|
if pNode = nil then
|
|
begin
|
|
MessageBox(Handle, PChar(RS_SelExceptFile), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
if MessageBox(Handle, PChar(RS_Q_ExceptSelFile),
|
|
PChar(Caption), MB_ICONQUESTION or MB_YESNO) = IDNO then exit;
|
|
|
|
Guard(EntList, TRstEntList.Create);
|
|
vtList.BeginUpdate;
|
|
try
|
|
while pNode <> nil do
|
|
begin
|
|
pData := vtList.GetNodeData(pNode);
|
|
if pData.State = resVul then
|
|
EntList.Add(pData);
|
|
|
|
// 대상에 zip이 있을경우 전체 새로고침 해준다.
|
|
// 상태 변경 시 적용을 위함 22_1201 17:01:27 kku
|
|
bRefresh := bRefresh or (Pos(pData.sExt, COMPRESS_EXTS) > 0);
|
|
pNode := vtList.GetNextSelected(pNode);
|
|
end;
|
|
|
|
if EntList.Count = 0 then
|
|
exit;
|
|
|
|
Guard(dlg, TDlgProgCttSchTask.Create(Self, cstkExcept, EntList));
|
|
dlg.ShowModal;
|
|
|
|
for i := 0 to EntList.Count - 1 do
|
|
begin
|
|
if EntList[i].State = resExcept then
|
|
ExpList_.Add(EntList[i].sDir + EntList[i].sFName);
|
|
end;
|
|
ExpList_.SaveToFile(sExpPath_, TEncoding.UTF8);
|
|
finally
|
|
vtList.EndUpdate;
|
|
end;
|
|
end;
|
|
|
|
if bRefresh then
|
|
RefreshList;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.miExportCSVClick(Sender: TObject);
|
|
var
|
|
sExe: String;
|
|
O: ISuperObject;
|
|
ProcInfo: TProcessInformation;
|
|
Label
|
|
LB_Direct;
|
|
begin
|
|
try
|
|
sExe := GetRunExePathDir + DIR_CONF + EXE_HLP;
|
|
if FileExists(sExe) then
|
|
begin
|
|
O := SO;
|
|
O.I['RcvWnd'] := Handle;
|
|
O.I['Cmd'] := HPCMD_SELECT_FILE;
|
|
O.I['Ctrl'] := 2;
|
|
O.S['Filter'] := 'CSV File|*.csv';
|
|
SaveJsonObjToFile(O, GetRunExePathDir + DIR_CONF + DAT_PARAM);
|
|
ProcInfo := ExecuteAppAsUser('explorer.exe', sExe, '', SW_SHOWNORMAL);
|
|
if ProcInfo.dwProcessId = 0 then
|
|
goto LB_Direct;
|
|
end else begin
|
|
LB_Direct :
|
|
SaveDialog.FileName := '';
|
|
if gMgSvc.Domain <> '' then
|
|
begin
|
|
var sPath: String := 'C:\Users\' + ExtractFileName(gMgSvc.Domain) + '\Desktop';
|
|
if DirectoryExists(sPath) then
|
|
SaveDialog.InitialDir := sPath;
|
|
end;
|
|
|
|
SaveDialog.Filter := 'CSV File|*.csv';
|
|
if SaveDialog.Execute(Handle) then
|
|
begin
|
|
if ExportCSV_VT(vtList, SaveDialog.FileName, TEncoding.UTF8, etkSelected) then
|
|
MessageBox(Handle, PChar(RS_MsgExport), PChar(Caption), MB_ICONINFORMATION or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(RS_ErrorExport), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
end;
|
|
end;
|
|
except
|
|
on E: Exception do
|
|
ETgException.TraceException(Self, E, 'Fail .. miExportCSVClick()');
|
|
end;
|
|
|
|
// if SaveDialog.Execute(Handle) then
|
|
// begin
|
|
// if ExportCSV_VT(vtList, SaveDialog.FileName, TEncoding.UTF8, etkSelected) then
|
|
// MessageBox(Handle, PChar('내보내기를 완료 했습니다.'), PChar(Caption), MB_ICONINFORMATION or MB_OK)
|
|
// else
|
|
// MessageBox(Handle, PChar('내보내기 중 오류가 발생했습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
// end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.miOpenClick(Sender: TObject);
|
|
var
|
|
pNode: PVirtualNode;
|
|
pData: PRstEnt;
|
|
O: ISuperObject;
|
|
begin
|
|
pNode := vtList.GetFirstSelected;
|
|
if pNode = nil then
|
|
exit;
|
|
|
|
pData := vtList.GetNodeData(pNode);
|
|
|
|
|
|
if FileExists(sHlpExe_) then
|
|
begin
|
|
O := SO;
|
|
O.I['RcvWnd'] := Handle;
|
|
O.I['Cmd'] := HPCMD_EXECUTE_FILE;
|
|
O.B['Open'] := true;
|
|
O.S['Path'] := pData.sDir + pData.sFName;
|
|
SaveJsonObjToFile(O, sOptFile_);
|
|
{$IFDEF DEBUG}
|
|
ExecutePath(pData.sDir + pData.sFName);
|
|
{$ELSE}
|
|
ExecuteAppAsUser('explorer.exe', sHlpExe_, '', SW_SHOWNORMAL);
|
|
{$ENDIF}
|
|
end else
|
|
ExecutePath(pData.sDir + pData.sFName);
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.miPosGoClick(Sender: TObject);
|
|
var
|
|
pNode: PVirtualNode;
|
|
pData: PRstEnt;
|
|
O: ISuperObject;
|
|
begin
|
|
pNode := vtList.GetFirstSelected;
|
|
if pNode = nil then
|
|
exit;
|
|
|
|
pData := vtList.GetNodeData(pNode);
|
|
|
|
if FileExists(sHlpExe_) then
|
|
begin
|
|
O := SO;
|
|
O.I['RcvWnd'] := Handle;
|
|
O.I['Cmd'] := HPCMD_OPEN_SELECT;
|
|
O.S['Path'] := pData.sDir + pData.sFName;
|
|
SaveJsonObjToFile(O, sOptFile_);
|
|
{$IFDEF DEBUG}
|
|
ExecutePath(sHlpExe_);
|
|
{$ELSE}
|
|
ExecuteAppAsUser('explorer.exe', sHlpExe_, '', SW_SHOWNORMAL);
|
|
{$ENDIF}
|
|
end else
|
|
ExplorerSelectedPath(pData.sDir + pData.sFName);
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.miQuarantineClick(Sender: TObject);
|
|
var
|
|
pNode: PVirtualNode;
|
|
EntList: TRstEntList;
|
|
pData: PRstEnt;
|
|
dlg: TDlgProgCttSchTask;
|
|
bRefresh: Boolean;
|
|
begin
|
|
pNode := vtList.GetFirstSelected;
|
|
if pNode = nil then
|
|
begin
|
|
MessageBox(Handle, PChar(RS_SelQuaran), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
if MessageBox(Handle, PChar(RS_Q_SelQuaran),
|
|
PChar(Caption), MB_ICONQUESTION or MB_YESNO) = IDNO then exit;
|
|
|
|
bRefresh := false;
|
|
Guard(EntList, TRstEntList.Create);
|
|
vtList.BeginUpdate;
|
|
try
|
|
while pNode <> nil do
|
|
begin
|
|
pData := vtList.GetNodeData(pNode);
|
|
EntList.Add(pData);
|
|
// 대상에 zip이 있을경우 전체 새로고침 해준다.
|
|
// 상태 변경 시 적용을 위함 22_1201 17:01:27 kku
|
|
bRefresh := bRefresh or (Pos(pData.sExt, COMPRESS_EXTS) > 0);
|
|
pNode := vtList.GetNextSelected(pNode);
|
|
end;
|
|
|
|
if EntList.Count = 0 then
|
|
exit;
|
|
|
|
Guard(dlg, TDlgProgCttSchTask.Create(Self, cstkQuarantine, EntList));
|
|
dlg.ShowModal;
|
|
finally
|
|
vtList.EndUpdate;
|
|
end;
|
|
|
|
if bRefresh then
|
|
RefreshList;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.pnEgBottomMouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
if Button = mbLeft then
|
|
begin
|
|
ReleaseCapture;
|
|
Perform(WM_SYSCOMMAND, SC_SIZE + WMSZ_Bottom, 0);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.pnEgLeftMouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
if Button = mbLeft then
|
|
begin
|
|
ReleaseCapture;
|
|
Perform(WM_SYSCOMMAND, SC_SIZE + WMSZ_Left, 0);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.pnEgRightMouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
if Button = mbLeft then
|
|
begin
|
|
ReleaseCapture;
|
|
Perform(WM_SYSCOMMAND, SC_SIZE + WMSZ_RIGHT, 0);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.pnEgTopMouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
if Button = mbLeft then
|
|
begin
|
|
ReleaseCapture;
|
|
Perform(WM_SYSCOMMAND, SC_SIZE + WMSZ_Top, 0);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.pnTopMouseDown(Sender: TObject;
|
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
ReleaseCapture;
|
|
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.RefreshInfo;
|
|
var
|
|
O: ISuperObject;
|
|
i: Integer;
|
|
StrList, StrList2: TStringList;
|
|
begin
|
|
if not LoadJsonObjFromFile(O, GetRunExePathDir + DIR_CTTSCHRST + sScanId_ + '.' + DAT_CTTSCHRST) then
|
|
exit;
|
|
|
|
sTaskId_ := O.S['TID'];
|
|
lbTotalFile.Caption := InsertPointComma(O.I['TotalFileCount'], 3);
|
|
lbTgFile.Caption := InsertPointComma(O.I['TargetFileCount'], 3);
|
|
lbFndFile.Caption := InsertPointComma(O.I['FoundFileCount'], 3);
|
|
|
|
lbTotalFile2.Caption := lbFndFileCap.Caption + ' ' + lbFndFile.Caption;
|
|
|
|
lbBeginDT.Caption := O.S['BeginDT'];
|
|
lbEndDT.Caption := O.S['EndDT'];
|
|
lbSearchTime.Caption := O.S['WorkTime'];
|
|
|
|
mmResult.Clear;
|
|
|
|
Guard(StrList, TStringList.Create);
|
|
Guard(StrList2, TStringList.Create);
|
|
SplitString(O.S['FoundSInfo'], ';', StrList);
|
|
for i := 0 to StrList.Count - 1 do
|
|
begin
|
|
SplitString(StrList[i], ':', StrList2);
|
|
if StrList2.Count > 1 then
|
|
mmResult.Lines.Add(ConvPtrnIdToStr(StrList2[0]) + ' : ' + InsertPointComma(StrList2[1], 3));
|
|
end;
|
|
|
|
if mmResult.Lines.Count > 4 then
|
|
mmResult.ScrollBars := TScrollStyle.ssVertical;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.RefreshList;
|
|
var
|
|
sFld,
|
|
sExt,
|
|
sFName,
|
|
sFrName,
|
|
sLine, sNline,
|
|
sPath: String;
|
|
StrList,
|
|
DataList, SchList: TStringList;
|
|
i, c, nCnt: Integer;
|
|
pData: PRstEnt;
|
|
EntState: TRstEntState;
|
|
MgCampExpt: TManagerCampExcept;
|
|
bCatLine: Boolean;
|
|
begin
|
|
MgCampExpt := nil;
|
|
if gMgSvc.IsNewApi then
|
|
MgCampExpt := TManagerCampExcept.Create;
|
|
|
|
bWaitCheckCompleted_ := IsUseEncOnlyAIP and (CUSTOMER_TYPE <> CUSTOMER_DEV);
|
|
vtList.BeginUpdate;
|
|
try
|
|
try
|
|
VT_Clear(vtList);
|
|
|
|
sPath := GetRunExePathDir + DIR_CTTSCHRST + sScanId_ + '.' + DAT_CTTSCHRSTDATA;
|
|
if not FileExists(sPath) then
|
|
exit;
|
|
|
|
if FileExists(sExpPath_) then
|
|
ExpList_.LoadFromFile(sExpPath_, TEncoding.UTF8);
|
|
|
|
Guard(StrList, TStringList.Create);
|
|
StrList.LoadFromFile(sPath, TEncoding.UTF8);
|
|
|
|
Guard(DataList, TStringList.Create);
|
|
Guard(SchList, TStringList.Create);
|
|
|
|
bCatLine := false;
|
|
nCnt := 0;
|
|
for i := 0 to StrList.Count - 1 do
|
|
begin
|
|
if StrList[i] = '' then
|
|
continue;
|
|
|
|
if bCatLine then
|
|
begin
|
|
sLine := sLine + StringReplace(StrList[i], #13#10, ' ', [rfReplaceAll]);
|
|
bCatLine := false;
|
|
end else
|
|
sLine := StringReplace(StrList[i], #13#10, ' ', [rfReplaceAll]);
|
|
|
|
// if ( (sLine[sLine.Length] <> '"') and (i < StrList.Count - 1) and
|
|
// (StrList[i + 1].Length > 0) and (StrList[i + 1][1] <> '"') and
|
|
// (Pos('<!>', StrList[i + 1]) = 0 ) ) or
|
|
// ( (i < StrList.Count - 1) and (StrList[i + 1] = '') ) then
|
|
// begin
|
|
// bCatLine := true;
|
|
// continue;
|
|
// end;
|
|
|
|
SplitString(sLine, '<!>', DataList, true);
|
|
if (DataList.Count < 7) or
|
|
( (i < StrList.Count - 1) and (Pos('<!>', StrList[i + 1]) = 0) ) then
|
|
begin
|
|
bCatLine := true;
|
|
continue;
|
|
end;
|
|
|
|
sPath := DataList[2];
|
|
sExt := GetFileExt(sPath).ToUpper;
|
|
if (IsSupportAIP or IsUseEncOnlyAIP) and not FileExists(sPath) then
|
|
begin
|
|
// AIP 암호화되어 확장자 변경된거 체크 24_1115 09:47:05 kku
|
|
var sTmpPath: String := ConvAipEncExt(sPath);
|
|
if FileExists(sTmpPath) then
|
|
sPath := sTmpPath
|
|
else if FileExists(sTmpPath + '.pfile') then
|
|
sPath := sTmpPath + '.pfile';
|
|
end;
|
|
sFld := ExtractFilePath(sPath);
|
|
sFName := ExtractFileName(sPath);
|
|
if DataList.Count >= 5 then
|
|
sFrName := DataList[4]
|
|
else
|
|
sFrName := sFName;
|
|
|
|
c := Pos(' > ', sFName);
|
|
if c > 0 then
|
|
SetLength(sFName, c - 1);
|
|
|
|
EntState := resWait;
|
|
if sPath.StartsWith('\\') or FileExists(sPath) then // 시스템 권한으로 네트워크 파일 존재 유무는 확인 불가능함 24_0610 18:26:31 kku
|
|
begin
|
|
if (MgCampExpt = nil) or not MgCampExpt.IsExceptFile(sPath) then
|
|
begin
|
|
// if IsUseEncOnlyAIP then
|
|
// EntState := resVul;
|
|
end else
|
|
EntState := resExcept;
|
|
end else
|
|
EntState := resDel;
|
|
|
|
if (sFrName.Length > 0) and (sFrName[1] = '*') then
|
|
begin
|
|
// 압축파일 내 암호화 파일 표시 25_0530 13:06:26 kku
|
|
EntState := resEnc;
|
|
Delete(sFrName, 1, 1);
|
|
end;
|
|
|
|
// case cbViewCate.ItemIndex of
|
|
// 1 : if EntState <> resVul then continue;
|
|
// 2 : if EntState <> resEnc then continue;
|
|
// 3 : if EntState <> resDel then continue;
|
|
// 4 : if EntState <> resExcept then continue;
|
|
// end;
|
|
|
|
pData := VT_AddChildData(vtList);
|
|
ZeroMemory(pData, SizeOf(TRstEnt));
|
|
|
|
Inc(nCnt);
|
|
pData.nImgIdx := -1;
|
|
pData.nNodeIdx := nCnt;
|
|
pData.sSchId := DataList[0];
|
|
// sSchName := ConvPtrnIdToStr(sSchId);
|
|
SplitString(pData.sSchId, ';', SchList);
|
|
for c := 0 to SchList.Count - 1 do
|
|
SumString(pData.sSchName, ConvPtrnIdToStr(SchList[c]), ',');
|
|
|
|
pData.nHits := StrToIntDef(DataList[1], -1);
|
|
pData.sFName := sFName;
|
|
pData.sFrName := sFrName;
|
|
pData.sDir := sFld;
|
|
pData.sFoundStr := DataList[3];
|
|
pData.sExt := sExt;
|
|
pData.State := EntState;
|
|
end;
|
|
except
|
|
on E: Exception do
|
|
ETgException.TraceException(Self, E, 'Fail .. RefreshList()');
|
|
end;
|
|
finally
|
|
vtList.EndUpdate;
|
|
if MgCampExpt <> nil then
|
|
FreeAndNil(MgCampExpt);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.vtListBeforeCellPaint(
|
|
Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode;
|
|
Column: TColumnIndex; CellPaintMode: TVTCellPaintMode; CellRect: TRect;
|
|
var ContentRect: TRect);
|
|
begin
|
|
if (Sender.AbsoluteIndex(Node) mod 2) = 0 then
|
|
begin
|
|
TargetCanvas.Brush.Color := $F7F7F7;
|
|
TargetCanvas.FillRect(CellRect);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.vtListCompareNodes(
|
|
Sender: TBaseVirtualTree; Node1, Node2: PVirtualNode; Column: TColumnIndex;
|
|
var Result: Integer);
|
|
var
|
|
pData1, pData2: PRstEnt;
|
|
llSize1, llSize2: LONGLONG;
|
|
begin
|
|
pData1 := Sender.GetNodeData(Node1);
|
|
pData2 := Sender.GetNodeData(Node2);
|
|
|
|
case Column of
|
|
0 : Result := CompareValue(pData1.nNodeIdx, pData2.nNodeIdx);
|
|
5 : Result := CompareValue(pData1.nHits, pData2.nHits);
|
|
else Result := CompareText(vtList.text[Node1, Column], vtList.text[Node2, Column]);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.vtListContextPopup(Sender: TObject;
|
|
MousePos: TPoint; var Handled: Boolean);
|
|
begin
|
|
if vtList.GetFirstSelected = nil then
|
|
Handled := true;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.vtListFreeNode(Sender: TBaseVirtualTree;
|
|
Node: PVirtualNode);
|
|
var
|
|
pData: PRstEnt;
|
|
begin
|
|
pData := Sender.GetNodeData(Node);
|
|
Finalize(pData^);
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.vtListGetImageIndex(
|
|
Sender: TBaseVirtualTree; Node: PVirtualNode; Kind: TVTImageKind;
|
|
Column: TColumnIndex; var Ghosted: Boolean; var ImageIndex: TImageIndex);
|
|
var
|
|
pData: PRstEnt;
|
|
sIPath, sExt: String;
|
|
begin
|
|
case Kind of
|
|
ikNormal,
|
|
ikSelected:
|
|
begin
|
|
if Column = 2 then
|
|
begin
|
|
pData := Sender.GetNodeData(Node);
|
|
if pData.nImgIdx = -1 then
|
|
begin
|
|
sExt := GetFileExt(pData.sFName);
|
|
pData.nImgIdx := FIconIdxList_.IndexOf(sExt);
|
|
if pData.nImgIdx = -1 then
|
|
begin
|
|
sIPath := GetRunExePathDir + DIR_CACHE + sExt + '.ico';
|
|
if FileExists(sIPath) then
|
|
begin
|
|
var ico: TIcon := TIcon.Create;
|
|
ico.LoadFromFile(sIPath);
|
|
pData.nImgIdx := FileImageList_.AddIcon(ico);
|
|
FIconIdxList_.AddObject(sExt, TObject(pData.nImgIdx));
|
|
ico.Free;
|
|
end else begin
|
|
var sHlpExe: String := GetRunExePathDir + DIR_CONF + EXE_HLP;
|
|
var O: ISuperObject := SO;
|
|
O.I['RcvWnd'] := Handle;
|
|
O.I['Cmd'] := HPCMD_REQ_FILEICON;
|
|
O.S['P'] := pData.sDir + pData.sFName;
|
|
O.I['N'] := LONGLONG(Node);
|
|
O.S['E'] := sExt;
|
|
SaveJsonObjToFile(O, GetRunExePathDir + DIR_CONF + DAT_PARAM);
|
|
{$IFDEF DEBUG}
|
|
ExecutePath(sHlpExe);
|
|
{$ELSE}
|
|
ExecuteAppAsUser('explorer.exe', sHlpExe, '', SW_SHOWNORMAL);
|
|
{$ENDIF}
|
|
exit;
|
|
end;
|
|
// pData.nImgIdx := AddFileSmallIconToImageList(FileImageList_, pData.sDir + pData.sFName);
|
|
// if pData.nImgIdx = -1 then
|
|
// pData.nImgIdx := 0;
|
|
// FIconIdxList_.AddObject(sExt, TObject(pData.nImgIdx));
|
|
end else
|
|
pData.nImgIdx := LONGLONG(FIconIdxList_.Objects[pData.nImgIdx]);
|
|
|
|
// pData.nImgIdx := GetShellImageIndex_path(pData.sDir + pData.sFName);
|
|
end;
|
|
ImageIndex := pData.nImgIdx;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.vtListGetNodeDataSize(
|
|
Sender: TBaseVirtualTree; var NodeDataSize: Integer);
|
|
begin
|
|
NodeDataSize := SizeOf(TRstEnt);
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.vtListGetText(Sender: TBaseVirtualTree;
|
|
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
|
|
var CellText: string);
|
|
var
|
|
pData: PRstEnt;
|
|
begin
|
|
pData := Sender.GetNodeData(Node);
|
|
|
|
case Column of
|
|
0 : CellText := IntToStr(pData.nNodeIdx); // IntToStr(Node.Index + 1);
|
|
1 :
|
|
begin
|
|
if pData.State = resWait then
|
|
begin
|
|
pData.State := resVul;
|
|
if not IsUseEncOnlyAIP or (CUSTOMER_TYPE = CUSTOMER_DEV) then
|
|
begin
|
|
if FileExists(pData.sDir + pData.sFName) then
|
|
begin
|
|
try
|
|
if fas_ <> nil then
|
|
begin
|
|
case fas_.GetFileType(pData.sDir + pData.sFName) of
|
|
103, 106 : pData.State := resEnc;
|
|
end;
|
|
end else
|
|
if CUSTOMER_TYPE = CUSTOMER_CJONS then
|
|
begin
|
|
case GetFileTypeW_r(pData.sDir + pData.sFName) of
|
|
109, // 이거 뭔지 모르지만 GetFileTypeW_r()로 FED5 암호화파일에서 검출됨.. 25_0217 18:54:27 kku
|
|
26, 103, 105, 106 : pData.State := resEnc;
|
|
end;
|
|
end else
|
|
if TTgEncrypt.CheckSign(pData.sDir + pData.sFName, SIG_DRM) then
|
|
pData.State := resEnc;
|
|
except
|
|
// ..
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
case CUSTOMER_TYPE of
|
|
CUSTOMER_GEC,
|
|
CUSTOMER_HDENG : ;
|
|
else begin
|
|
if IsSupportAIP and (pData.State = resVul) and (AipExtList_.IndexOf(pData.sExt) <> -1) then
|
|
begin
|
|
// var sTemp: String := GetAipLabel(pData.sDir + pData.sFName);
|
|
// if (sTemp <> '') and (Pos(RS_Normal, sTemp) = 0) then
|
|
if IsAipEncryted(pData.sDir + pData.sFName) then
|
|
pData.State := resEnc;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
case pData.State of
|
|
resVul :
|
|
begin
|
|
case CUSTOMER_TYPE of
|
|
CUSTOMER_GEC,
|
|
CUSTOMER_HDENG :
|
|
begin
|
|
if pData.nHits >= 50 then
|
|
CellText := RS_Caution
|
|
else if pData.nHits >= 10 then
|
|
CellText := RS_Warning
|
|
else if pData.nHits >= 1 then
|
|
CellText := RS_Attention
|
|
else
|
|
CellText := RS_Normal;
|
|
end else
|
|
CellText := RS_Vul;
|
|
end;
|
|
end;
|
|
resEnc : CellText := RS_Enc;
|
|
resDel : CellText := RS_Delete;
|
|
resExcept : CellText := RS_Except;
|
|
resQuarantine : CellText := RS_Quarantine;
|
|
end;
|
|
end;
|
|
2 : CellText := pData.sFrName;
|
|
3 : CellText := pData.sExt;
|
|
4 : CellText := pData.sSchName;
|
|
5 : CellText := IntToStr(pData.nHits);
|
|
6 : CellText := pData.sFoundStr;
|
|
7 : CellText := pData.sDir;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.vtListHeaderClick(Sender: TVTHeader;
|
|
HitInfo: TVTHeaderHitInfo);
|
|
begin
|
|
if HitInfo.Button = mbLeft then
|
|
begin
|
|
if HitInfo.Column < 0 then
|
|
exit;
|
|
|
|
with Sender, Treeview do
|
|
begin
|
|
if SortColumn > NoColumn then
|
|
Columns[SortColumn].Options := Columns[SortColumn].Options + [coParentColor];
|
|
|
|
// if HitInfo.Column = 0 then
|
|
// SortColumn := NoColumn
|
|
// else
|
|
begin
|
|
if not bWaitCheckCompleted_ and (HitInfo.Column = 1) then
|
|
UpdateEntVisible;
|
|
|
|
if (SortColumn = NoColumn) or (SortColumn <> HitInfo.Column) then
|
|
begin
|
|
SortColumn := HitInfo.Column;
|
|
SortDirection := sdAscending;
|
|
end else
|
|
if SortDirection = sdAscending then
|
|
SortDirection := sdDescending
|
|
else
|
|
SortDirection := sdAscending;
|
|
|
|
Columns[SortColumn].Color := $00EFEFEF;
|
|
|
|
vtList.BeginUpdate;
|
|
try
|
|
vtList.SortTree(SortColumn, SortDirection, False);
|
|
finally
|
|
vtList.EndUpdate;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.vtListPaintText(Sender: TBaseVirtualTree;
|
|
const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
|
|
TextType: TVSTTextType);
|
|
var
|
|
pData: PRstEnt;
|
|
begin
|
|
if not (vsSelected in Node.States) then
|
|
begin
|
|
pData := Sender.GetNodeData(Node);
|
|
case pData.State of
|
|
resVul :
|
|
begin
|
|
if Column = 1 then
|
|
begin
|
|
case CUSTOMER_TYPE of
|
|
CUSTOMER_GEC,
|
|
CUSTOMER_HDENG :
|
|
begin
|
|
if pData.nHits >= 50 then
|
|
TargetCanvas.Font.Color := $00384EF8
|
|
else if pData.nHits >= 10 then
|
|
TargetCanvas.Font.Color := $002E8EFF;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
resEnc : TargetCanvas.Font.Color := clGreen;
|
|
resDel,
|
|
resQuarantine,
|
|
resExcept : TargetCanvas.Font.Color := clGray;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.cbViewCateChange(Sender: TObject);
|
|
begin
|
|
// RefreshList;
|
|
UpdateEntVisible;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.process_WM_COPYDATA(var msg: TMessage);
|
|
var
|
|
dwData: DWORD;
|
|
pCpData: PCopyDataStruct;
|
|
O: ISuperObject;
|
|
sTemp: String;
|
|
i: Integer;
|
|
begin
|
|
msg.Result := 0;
|
|
|
|
dwData := 0;
|
|
pCpData := PCopyDataStruct(msg.LParam);
|
|
try
|
|
dwData := pCpData.dwData;
|
|
case dwData of
|
|
HPCMD_SELECT_FILE :
|
|
begin
|
|
O := SO(Copy(PChar(pCpData.lpData), 1, pCpData.cbData));
|
|
var sPath: String := O.S['Path'];
|
|
// case O.I['Ctrl'] of
|
|
// 1 : ;
|
|
// 2 : ;
|
|
// end;
|
|
|
|
if ExportCSV_VT(vtList, sPath, TEncoding.UTF8, etkSelected) then
|
|
MessageBox(Handle, PChar(RS_MsgExport), PChar(Caption), MB_ICONINFORMATION or MB_OK)
|
|
else
|
|
MessageBox(Handle, PChar(RS_ErrorExport), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
|
|
// 일반권한으로 실행해서 안 지워진다.. 그래서 후처리 추가 22_0614 12:40:00 kku
|
|
sPath := GetRunExePathDir + DIR_CONF + DAT_PARAM;
|
|
if FileExists(sPath) then
|
|
DeleteFile(sPath);
|
|
end;
|
|
|
|
HPCMD_INPUT_EXCEPT_REASON :
|
|
begin
|
|
vtList.Enabled := true;
|
|
sTemp := Copy(PChar(pCpData.lpData), 1, pCpData.cbData);
|
|
if sTemp = '' then
|
|
exit;
|
|
|
|
sExceptReason_ := sTemp;
|
|
PostMessage(Handle, WM_CLICK_DECRYPT, 0, 0);
|
|
end;
|
|
|
|
HPCMD_REQ_FILEICON :
|
|
begin
|
|
O := SO(Copy(PChar(pCpData.lpData), 1, pCpData.cbData));
|
|
var pNode: PVirtualNode := PVirtualNode(O.I['N']);
|
|
var sExt: String := O.S['E'];
|
|
var pBuf: TBytes := DecodeBase64(O.S['D']);
|
|
if ForceDirectories(GetRunExePathDir + DIR_CACHE) then
|
|
begin
|
|
// vtList.BeginUpdate;
|
|
// try
|
|
var ms: TMemoryStream;
|
|
Guard(ms, TMemoryStream.Create);
|
|
ms.Write(pBuf[0], Length(pBuf));
|
|
|
|
var ico: TIcon;
|
|
Guard(ico, TIcon.Create);
|
|
ms.Position := 0;
|
|
ico.LoadFromStream(ms);
|
|
ms.Position := 0;
|
|
ms.SaveToFile(GetRunExePathDir + DIR_CACHE + sExt + '.ico');
|
|
|
|
// var pData: PRstEnt := vtList.GetNodeData(pNode);
|
|
// pData.nImgIdx := FileImageList_.AddIcon(ico);
|
|
// FIconIdxList_.AddObject(sExt, TObject(pData.nImgIdx));
|
|
// vtList.RepaintNode(pNode);
|
|
// finally
|
|
// vtList.EndUpdate;
|
|
// end;
|
|
end;
|
|
end;
|
|
end;
|
|
except
|
|
on E: Exception do
|
|
ETgException.TraceException(Self, E, Format('Fail .. process_WM_COPYDATA(), dwData=%d', [dwData]));
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgViewCttSchResult.process_WM_CLICK_DECRYPT(var msg: TMessage);
|
|
begin
|
|
miExcept.Click;
|
|
end;
|
|
|
|
end.
|