📄 simpleencoder.dpr
字号:
program SimpleEncoder;
{$APPTYPE CONSOLE}
uses
Windows, SysUtils, clEncoder, Classes;
function GetMethod(const AMethod: string): TclEncodeMethod;
begin
if (AMethod = 'QP') then
begin
Result := cmMIMEQuotedPrintable;
end else
if (AMethod = 'BASE64') then
begin
Result := cmMIMEBase64;
end else
if (AMethod = 'UUE') then
begin
Result := cmUUEncode;
end else
begin
Result := cmNone;
end;
end;
var
Encoder: TclEncoder;
Src, Dst: TStream;
begin
if ParamCount < 4 then
begin
MessageBox(0, 'This is console app which encodes / decodes an amount of data from the file specified.'#13#10
+ 'Usage: Encoder.exe srcfile destfile operation[E][D] method[QP][BASE64][UUE]', 'Information', 0);
Exit;
end;
Encoder := nil;
Src := nil;
Dst := nil;
try
Encoder := TclEncoder.Create(nil);
Src := TFileStream.Create(ParamStr(1), fmOpenRead);
Dst := TFileStream.Create(ParamStr(2), fmCreate);
if (ParamStr(3) = 'E') then
Encoder.EncodeStream(Src, Dst, GetMethod(ParamStr(4)))
else
Encoder.DecodeStream(Src, Dst, GetMethod(ParamStr(4)));
WriteLn('Done.');
finally
Dst.Free();
Src.Free();
Encoder.Free();
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -