📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils,
Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,shellapi;
type
pluginreply = procedure (Text: pchar);
TForm1 = class(TForm)
Memo1: TMemo;
procedure changefname(name1,name2:String);
Procedure go(data:string);
procedure getowner(owner:integer);
procedure process(RString: string);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
clientdllname:pchar;
OwnerAPP:integer;
implementation
{$R *.dfm}
//Gets the EXE owner
procedure tform1.getowner(owner:integer);
begin
ownerapp:=owner;
end;
//--------------------------------------------------------DOS CAPTURE
procedure TForm1.changefname(name1,name2:String);
begin
try
RenameFile(name1,name2);
memo1.Lines.Add('Name changed.');
except
memo1.Lines.Clear;
memo1.Lines.Add('Error Changing name!');
end;
end;
Procedure TForm1.go(data:string);
begin
Process(data);
end;
function CopyDir(const fromDir, toDir: string): Boolean;
var
fos: TSHFileOpStruct;
begin
ZeroMemory(@fos, SizeOf(fos));
with fos do
begin
wFunc := FO_COPY;
fFlags := FOF_FILESONLY;
pFrom := PChar(fromDir + #0);
pTo := PChar(toDir)
end;
Result := (0 = ShFileOperation(fos));
end;
function MoveDir(const fromDir, toDir: string): Boolean;
var
fos: TSHFileOpStruct;
begin
ZeroMemory(@fos, SizeOf(fos));
with fos do
begin
wFunc := FO_MOVE;
fFlags := FOF_FILESONLY;
pFrom := PChar(fromDir + #0);
pTo := PChar(toDir)
end;
Result := (0 = ShFileOperation(fos));
end;
function DelDir(dir: string): Boolean;
var
fos: TSHFileOpStruct;
begin
ZeroMemory(@fos, SizeOf(fos));
with fos do
begin
wFunc := FO_DELETE;
fFlags := FOF_SILENT or FOF_NOCONFIRMATION;
pFrom := PChar(dir + #0);
end;
Result := (0 = ShFileOperation(fos));
end;
procedure RenameDir(DirFrom, DirTo: string);
var
shellinfo: TSHFileOpStruct;
begin
with shellinfo do
begin
Wnd := 0;
wFunc := FO_RENAME;
pFrom := PChar(DirFrom);
pTo := PChar(DirTo);
fFlags := FOF_FILESONLY or FOF_ALLOWUNDO or
FOF_SILENT or FOF_NOCONFIRMATION;
end;
SHFileOperation(shellinfo);
end;
procedure Tform1.process(RString: string);
var dir1,dir2,file1,file2:string;
begin
//here you put the client plugin name:
clientdllname:='util.dll';
{ if (pos('!say',RString)>0) then //!say#channel:text
begin
Delete(RString,1,4);
chan:=copy(RString,1,Pos(':',RString));
text:=copy(RString,Pos(':',RString),length(RString));
Delete(chan,pos(':',chan),Length(chan));
Delete(text,pos(':',text),pos(':',text));
log.Lines.Add(chan +'/' +text);
SendRaw('PRIVMSG ' + chan + ' : ' + text);
end; }
if (pos('newdir',RString)>0) then //newdir#dirpath
begin
Delete(RString,1,6);
dir1:=copy(RString,Pos('#',RString),length(RString));
Delete(dir1,pos('#',dir1),pos('#',dir1));
try
CreateDir(dir1);
//send message to the client plugin
pluginreply(GetProcAddress(OwnerApp, 'pluginreply'))(pchar(clientdllname+';'+'Dir Created! '+ dir1));
except
pluginreply(GetProcAddress(OwnerApp, 'pluginreply'))(pchar(clientdllname+';'+'Error!'));
end;
end;
if (pos('removedir',RString)>0) then //removedir#dirpath
begin
Delete(RString,1,9);
dir1:=copy(RString,Pos('#',RString),length(RString));
Delete(dir1,pos('#',dir1),pos('#',dir1));
try
deldir(dir1);
//send message to the client plugin
pluginreply(GetProcAddress(OwnerApp, 'pluginreply'))(pchar(clientdllname+';'+'Dir Removed! '+ dir1));
except
pluginreply(GetProcAddress(OwnerApp, 'pluginreply'))(pchar(clientdllname+';'+'Error!'));
end;
end;
{dir1:=copy(RString,1,Pos('
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -