unit DDecLogMain; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Tocsg.Controls; type TDlgDecLogMain = class(TForm) Label1: TLabel; Label2: TLabel; edSrc: TEdit; edDest: TEdit; btnOpen: TSpeedButton; chAfterOpen: TCheckBox; btnDec: TButton; OpenDialog: TOpenDialog; procedure btnOpenClick(Sender: TObject); procedure btnDecClick(Sender: TObject); private { Private declarations } MgCtrls_: TManagerInputControlsData; public { Public declarations } Constructor Create(aOwner: TComponent); override; Destructor Destroy; override; end; var DlgDecLogMain: TDlgDecLogMain; implementation uses Tocsg.Path, Tocsg.Safe, Tocsg.Trace, Tocsg.Shell; {$R *.dfm} Constructor TDlgDecLogMain.Create(aOwner: TComponent); begin Inherited Create(aOwner); MgCtrls_ := TManagerInputControlsData.Create(CutFileExt(GetRunExePath) + '.ini'); MgCtrls_.RegInputCtrl(edSrc); MgCtrls_.RegInputCtrl(edDest); MgCtrls_.RegInputCtrl(chAfterOpen); MgCtrls_.Load; end; Destructor TDlgDecLogMain.Destroy; begin FreeAndNil(MgCtrls_); Inherited; end; procedure TDlgDecLogMain.btnOpenClick(Sender: TObject); begin if OpenDialog.Execute(Handle) then edSrc.Text := OpenDialog.FileName; end; procedure TDlgDecLogMain.btnDecClick(Sender: TObject); var SrcList, DestList: TStringList; i: Integer; sLine, sTemp: String; begin edSrc.Text := Trim(edSrc.Text); edDest.Text := Trim(edDest.Text); if edSrc.Text = '' then begin MessageBox(Handle, PChar('"´ë»ó ÆÄÀÏ °æ·Î"¸¦ ÀÔ·ÂÇØ ÁֽʽÿÀ.'), PChar(Caption), MB_ICONWARNING or MB_OK); edSrc.SetFocus; exit; end; if edDest.Text = '' then begin MessageBox(Handle, PChar('"º¹È£È­ ÈÄ ÀúÀå °æ·Î"¸¦ ÀÔ·ÂÇØ ÁֽʽÿÀ.'), PChar(Caption), MB_ICONWARNING or MB_OK); edDest.SetFocus; exit; end; if not FileExists(edSrc.Text) then begin MessageBox(Handle, PChar('"´ë»ó ÆÄÀÏ °æ·Î"°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.'), PChar(Caption), MB_ICONWARNING or MB_OK); edSrc.SetFocus; exit; end; if not DirectoryExists(ExtractFilePath(edDest.Text)) then begin MessageBox(Handle, PChar('"º¹È£È­ ÈÄ ÀúÀå °æ·Î"ÀÇ Æú´õ°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.'), PChar(''), MB_ICONWARNING or MB_OK); edDest.SetFocus; exit; end; MgCtrls_.Save; if GetFileExt(edDest.Text).ToUpper <> 'LOG' then edDest.Text := edDest.Text + '.ini'; Guard(SrcList, TStringList.Create); Guard(DestList, TStringList.Create); try SrcList.LoadFromFile(edSrc.Text, TEncoding.UTF8); sLine := ''; for i := 0 to SrcList.Count - 1 do begin if SrcList[i] = '' then continue; sTemp := SrcList[i]; if sTemp.StartsWith('[2025-') or (sTemp[1] = ':') then sLine := sTemp else sLine := sLine + sTemp; if i <> (SrcList.Count - 1) then begin sTemp := SrcList[i + 1]; if not sTemp.StartsWith('[2025-') and (sTemp[1] <> ':') then continue; end; if sLine <> '' then begin if sLine[1] = ':' then DestList.Add(DecLog(sLine)) else DestList.Add(sLine); end; end; DestList.SaveToFile(edDest.Text, TEncoding.UTF8); MessageBox(Handle, PChar('·Î±× º¹È£È­ ¿Ï·á'), PChar(Caption), MB_ICONINFORMATION or MB_OK); if chAfterOpen.Checked then ExecutePath(edDest.Text); except on E: Exception do MessageBox(Handle, PChar(Format('º¹È£È­ Áß ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù. (%s)', [E.Message])), PChar(Caption), MB_ICONWARNING or MB_OK); end; end; end.