BSOne.SFC/Tocsg.Module/MsAipParser/DAipParserMain.pas

78 lines
1.9 KiB
Plaintext

unit DAipParserMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TDlgAipParserMain = class(TForm)
edPath: TEdit;
btnParser: TButton;
mmInfo: TMemo;
procedure btnParserClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DlgAipParserMain: TDlgAipParserMain;
implementation
uses
Tocsg.AIP, Tocsg.Path, Tocsg.Convert, System.TimeSpan, System.DateUtils;
{$R *.dfm}
procedure TDlgAipParserMain.btnParserClick(Sender: TObject);
var
sExt, sLName: String;
bIsEnc: Boolean;
begin
mmInfo.Clear;
edPath.Text := Trim(edPath.Text);
if not FileExists(edPath.Text) then
begin
MessageBox(Handle, PChar('존재하지 않는 파일입니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
ShowMessage(BooleanToStr(IsAipEncryted(edPath.Text), 'AIP 암호화됨', '안됨'));
exit;
sLName := 'None';
bIsEnc := false;
sExt := GetFileExt(edPath.Text).ToUpper;
if sExt = 'PDF' then
begin
sLName := GetAipLabelNameFromPDF(edPath.Text);
bIsEnc := IsAipEncrytedPDF(edPath.Text);
end else
if (sExt = 'DOC') or (sExt = 'XLS') or (sExt = 'PPT') then
begin
sLName := GetAipLabelNameFromOldOfficeDoc(edPath.Text);
bIsEnc := IsAipEncrytedOldOfficeDoc(edPath.Text, '');
end else
if (sExt = 'DOCX') or (sExt = 'XLSX') or (sExt = 'PPTX') or (sExt = 'ZIP') then
begin
sLName := GetAipLabelNameFromOfficeDoc(edPath.Text);
bIsEnc := IsAipEncrytedOfficeDoc(edPath.Text, '');
end;
mmInfo.Lines.Add('LabelName : ' + sLName);
if bIsEnc then
MessageBox(Handle, PChar('암호화가 적용되어 있습니다.'), PChar(Caption), MB_ICONINFORMATION or MB_OK)
else
MessageBox(Handle, PChar('일반 파일 입니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
end;
end.