⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.pas

📁 海盗远控1.23源代码
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    AttribForm.Edit1.Text:=li.Caption;                  //文件名
    if (li.ImageIndex = 4 )or( li.ImageIndex = 32) then
    begin
      AttribForm.Edit4.Text:='文件夹';
    end else
    begin
      AttribForm.Edit3.Text:= li.Subitems.Strings[0]+' bytes';
      AttribForm.Edit4.Text:= GetBmp(lowercase(ExtractFileExt(li.Caption)));
    end;
    AttribForm.Edit6.Text := li.Subitems.Strings[1];  //最后修改时间
    if ComputerorServer then
    begin
      AttribForm.Edit2.Text :=ComputerDir; //文件位置
      if FindFirst(ComputerDir + li.Caption, faAnyFile, SR) = 0 then
      begin
        AttribForm.Edit5.Text := FormatDateTime(dtFmt,CovFileDate(SR.FindData.ftCreationTime));   //创建时间
        AttribForm.Edit7.Text := FormatDateTime(dtFmt,CovFileDate(SR.FindData.ftLastAccessTime)); //最后访问时间
      end;
      Attributes := FileGetAttr(ComputerDir + li.Caption);
      AttribForm.CheckBox1.Checked := (Attributes and faReadOnly) = faReadOnly;
      AttribForm.CheckBox2.Checked := (Attributes and faArchive) = faArchive;
      AttribForm.CheckBox3.Checked := (Attributes and faHidden) = faHidden;
      AttribForm.CheckBox4.Checked := (Attributes and faSysFile) = faSysFile;
    end else
    begin
      AttribForm.Edit2.Text:= CurDir; //文件位置
      if li.ImageIndex = 32 then ZhuDongCmdSend('022', CurDir + li.Caption , True)
      else ZhuDongCmdSend('022', CurFile , True);
    end; 
    AttribForm.ShowModal;
  except
  end;
end;

//粘贴文件
procedure TViKing.FileToolButton3Click(Sender: TObject);
var
 Path1,Path2,Temp: string;
 i,j: integer;
 StrTmpList:TStringList;
begin
  try
    if ComputerorServer then
    begin
      StrTmpList:=TStringList.Create;
      StrTmpList.Text:=ComputerFuzhi;
      I := 0;
      for j:=StrTmpList.Count-1 downto 0 do
      begin
        try
          Path1:=ComputerDir;
          Path2:=StrTmpList[j];
          if Copy(StrTmpList[j],length(StrTmpList[j]),1)='\' then
          begin
            if DirectoryExists(StrTmpList[j]) then
            begin
              Delete(Path2,Length(Path2),1);
              Temp:=Path1+GetFileName(Path2);
              Path2:=StrTmpList[j];
              Path1:=Temp+'\';
              I:=0;
              while DirectoryExists(Path1) do
              begin
                inc(i);
                Path1 := GetFilepath(Temp) + Translate('ZhuanTai16', '复件(') + inttoStr(i) + ')' + GetFileName(Temp)+'\';
              end;
              DoCopyDir(Path2,Path1);
            end;
          end else
          begin
            if FIleExists(StrTmpList[j])  then
            begin
              Path1:=ComputerDir;
              Path2:=StrTmpList[j];
              Path1:=Path1+GetFileName(Path2);
              i:=0;
              Temp:=Path1;
              while FileExists(Path1) do
              begin
                inc(i);
                Path1 := GetFilepath(Temp) + Translate('ZhuanTai16', '复件(') + inttoStr(i) + ')' + GetFileName(Temp);
              end;
              Mycopyfile(Path2,Path1);
            end;
          end;
        except
        end;
      end;
      StrTmpList.Free;
      ComputerFuzhi:='';
      FileToolButton7Click(Sender); //刷新文件
      Exit;
    end;
    if FuZhi = '' then Exit;
    try
      ViKing.Enabled := False;
      Temp := CurDir + EOL + FuZhi;
      ZhuDongCmdSend('003', Temp, False);
      FuZhi:= '';
    except
      ViKing.Enabled := True;
      ZhuanTai.Caption := Translate('ZhuanTai17', '粘贴文件出错了!');
    end;
  except
    ZhuanTai.Caption := Translate('ZhuanTai18', '粘贴: "') + ComputerFuzhi + Translate('ZhuanTai19', '" 错误!');
  end;
end;

procedure TViKing.FileToolButton4Click(Sender: TObject);
var
  li: TListItem;
  Fstemp: string;
  i,w,j: integer;
begin
  try
    li := ListView1.Selected;
    if li = nil then Exit;
    if ComputerorServer then begin
      ViKing.SetFocus;
      if Application.MessageBox(PChar(Translate('ZhuanTai20', '你确认要删除选中文件或文件夹吗?')), PChar(Translate('ZhuanTai21', '警告')), mb_yesno + mb_iconquestion + mb_topmost) = IDYES then begin
        for i := 0 to ListView1.Items.Count - 1 do begin
          if ListView1.Items[i].Selected then begin
            if (ListView1.Items[i].ImageIndex >= 5) and (ListView1.Items[i].ImageIndex <= 27) then begin
              Fstemp := ComputerDir + ListView1.Items[i].Caption;
              FilesetAttr(Fstemp, 0);
              DeleteFile(Fstemp);
              if not FileExists(Fstemp) then
                ZhuanTai.Caption := Translate('ZhuanTai22', '删除文件: "') + Fstemp + Translate('ZhuanTai14', '" 成功! ')
              else ZhuanTai.Caption := Translate('ZhuanTai22', '删除文件: "') + Fstemp + Translate('ZhuanTai15', '" 失败!');
            end;
            if ListView1.Items[i].ImageIndex = 4 then begin
              Fstemp := ComputerDir + ListView1.Items[i].Caption;
              if DoRemoveDir(Fstemp) then
                ZhuanTai.Caption := Translate('ZhuanTai23', '删除文件夹: "') + Fstemp + Translate('ZhuanTai14', '" 成功! ')
              else
                ZhuanTai.Caption := Translate('ZhuanTai23', '删除文件夹: "') + Fstemp + Translate('ZhuanTai15', '" 失败!');;
            end;
          end;
        end; 
        FileToolButton7Click(Sender);
      end; {对话框}
      Exit;
    end;
  except
  end;

  try
     Fstemp:='';
     w:=0;
     j:=0;
     for i := 0 to ListView1.Items.Count - 1 do
     begin
       if ListView1.Items[i].Selected then
         begin
            if (ListView1.Items[i].ImageIndex >= 33) then
             begin
              Fstemp :=Fstemp+CurDir+ListView1.Items[i].Caption+EOL;
              inc(j);
             end;
            if (ListView1.Items[i].ImageIndex = 32) then
             begin
              Fstemp :=Fstemp+CurDir+ListView1.Items[i].Caption+'\'+EOL;
              inc(w);
             end;
         end;
    end;
        if (w>0) and (j>0) then
        begin
          if Application.MessageBox(pchar(Translate('ZhuanTai24', '你确认要删除远程主机上') + inttostr(w) + Translate('ZhuanTai25', ' 个文件夹 ')+inttostr(j)+Translate('ZhuanTai26', ' 个选中的文件吗?')), Pchar(Translate('ZhuanTai21','警告')), mb_yesno + mb_iconquestion) = IDYES then
          ZhuDongCmdSend('005', Fstemp, False);
          Exit;
        end;
        if (w>0) then
        begin
          if Application.MessageBox(pchar(Translate('ZhuanTai24', '你确认要删除远程主机上')  + inttostr(w) + Translate('ZhuanTai27',' 个文件夹吗?')), Pchar(Translate('ZhuanTai21','警告')), mb_yesno + mb_iconquestion) = IDYES then
          ZhuDongCmdSend('005', Fstemp, False);
          Exit;
        end;
        if (j>0) then
        begin
          if Application.MessageBox(pchar(Translate('ZhuanTai24', '你确认要删除远程主机上') + inttostr(j) + Translate('ZhuanTai28',' 个文件吗?')), Pchar(Translate('ZhuanTai21','警告')), mb_yesno + mb_iconquestion) = IDYES then
          ZhuDongCmdSend('005', Fstemp, False);
          Exit;
        end;
  except
    ZhuanTai.Caption :=Translate('ZhuanTai29', '主机未连接.请到"文件管理器"中进行连接.');
  end;
end;

//刷新
procedure TViKing.FileToolButton7Click(Sender: TObject);
begin
  try
    TreeView1Change(Sender, nowfilenode);
  except
  end;
end;

//文件视图方式
procedure TViKing.FileToolButton8Click(Sender: TObject);
begin
  if N19.Checked then begin
    N16Click(Self);
    Exit;
  end;
  if N16.Checked then begin
    N17Click(Self);
    Exit;
  end;
  if N17.Checked then begin
    N18Click(Self);
    Exit;
  end;
  if N18.Checked then begin
    N19Click(Self);
  end;
end;

//大图标
procedure TViKing.N16Click(Sender: TObject);
begin
  ListView1.ViewStyle := vsIcon;
  N16.Checked := True;
  Myinifile.writestring('Operation', 'ViewStyle', 'vsIcon');
end;
//小图标
procedure TViking.N17Click(Sender: TObject);
begin
  ListView1.ViewStyle := vsSmallIcon;
  N17.Checked := True;
  Myinifile.writestring('Operation', 'ViewStyle', 'vsSmallIcon');
end;
//列表
procedure TViking.N18Click(Sender: TObject);
begin
  ListView1.ViewStyle := vsList;
  N18.Checked := True;
  Myinifile.writestring('Operation', 'ViewStyle', 'vsList');
end;
//详细资源
procedure TViking.N19Click(Sender: TObject);
begin
  ListView1.ViewStyle := vsReport;
  N19.Checked := True;
  Myinifile.writestring('Operation', 'ViewStyle', 'vsReport');
end;



//正常运行
procedure TViKing.NonerunClick(Sender: TObject);
var
  li: TListItem;
begin
  try
    li := ListView1.Selected;
    if li = nil then Exit;
    if ComputerorServer then Exit;
    ZhuDongCmdSend('010', '0' + EOL + CurFile + EOL + EOL, True);
  except
  end;
end;

{隐藏运行}
procedure TViKing.HiderunClick(Sender: TObject);
var li: TListItem;
begin
  try
    li := ListView1.Selected;
    if li = nil then Exit;
    if ComputerorServer then Exit;
    ZhuDongCmdSend('010', '1' + EOL + CurFile + EOL + EOL, True);
  except
  end;
end;

{最小化运行}
procedure TViKing.MinrunClick(Sender: TObject);
var
  li: TListItem;
begin
  try
    li := ListView1.Selected;
    if li = nil then Exit;
    if ComputerorServer then Exit;
    ZhuDongCmdSend('010', '3' + EOL + CurFile + EOL + EOL, True);
  except
  end;
end;

{最大化运行}
procedure TViKing.MaxrunClick(Sender: TObject);
var
  li: TListItem;
begin
  try
    li := ListView1.Selected;
    if li = nil then Exit;
    if ComputerorServer then Exit;
    ZhuDongCmdSend('010', '2' + EOL + CurFile + EOL + EOL, True);
  except
  end;
end;
//带参数运行
procedure TViKing.RunzClick(Sender: TObject);
var
  foldername: string;
begin
  if inputquery(Translate('ZhuanTai37','带参数运行'), Translate('ZhuanTai38','请输入运行参数:'), foldername) then
  begin
    ZhuDongCmdSend('010', '0' + EOL + CurFile + EOL + foldername, True);
  end;
end;

//本地打开
procedure TViKing.QviweClick(Sender: TObject);
var
  li: TListItem;
begin
  li := ListView1.Selected;
  if li = nil then exit;
  try
    Qviwepath := ExtractFilePath(Paramstr(0)) + Translate('ZhuanTai39','本地打开的文件');
    if not DirectoryExists(Qviwepath) then CreateDir(Qviwepath);
  except
    Qviwepath := TempPath;
  end;
  Qviwepath := Qviwepath + '\' + li.Caption;
  ZhuDongCmdSend('012', CurFile, False);
end;

//文件上传
procedure TViKing.UpFileClick(Sender: TObject);
begin
  if CurDir = '' then Exit;
  UpDownFileForm.ShowModal;
  if ViKing.UpFileNames <> '' then
  begin
    if ListView2.Items.Count = 0 then
    begin
      DonwHeader := LianlineSoc;
      with ListView2.Items.Add do
      begin
        Caption := '';
        SubItems.Add(UpFileNames);
        SubItems.Add(CurDir + Getfilename(UpFileNames));
        SubItems.Add(InttoStr(Getfilesize(UpFileNames)));
        ImageIndex := 11;
      end;
      zhuDongCmdSend('011', '', True);
    end else
    begin
      if DonwHeader <> LianlineSoc then
      begin              //不是同一连接了!
        ViKing.AddLineStr(Translate('ZhuanTai31','另一远程文件传输任务进行中,请等待完毕后再进行!'), 2, True);
      end else
      begin
        with ListView2.Items.Add do
        begin
          Caption := '';
          SubItems.Add(UpFileNames);
          SubItems.Add(CurDir + Getfilename(UpFileNames));
          SubItems.Add(InttoStr(Getfilesize(UpFileNames)));
          ImageIndex := 11;
        end;
      end;
    end;
  end;

  if UpFileFolder <> '' then
  begin
    if ListView2.Items.Count = 0 then
    begin
      DonwHeader := LianlineSoc;
      with ListView2.Items.Add do
      begin
        Caption := '';
        SubItems.Add(UpFileFolder + '\');
        SubItems.Add(CurDir + Getfilename(UpFileFolder) + '\');
        SubItems.Add('');
        ImageIndex := 13;
      end;
      ZhuDongCmdSend('011', '', True);
    end else
    begin
      if DonwHeader <> LianlineSoc then
      begin              //不是同一连接了!
        ViKing.AddLineStr(Translate('ZhuanTai31','另一远程文件传输任务进行中,请等待完毕后再进行!'), 2, True);
      end else
      begin
        with ListView2.Items.Add do
        begin
          Caption := '';
          SubItems.Add(UpFileFolder + '\');
          SubItems.Add(CurDir + UpFileFolder + '\');
          SubItems.Add('');
          ImageIndex := 13;
        end;
      end;
    end;
  end;
end;

//下载文件和文件夹
procedure TViKing.DownFileClick(Sender: TObject);
var
  li: TListItem;
  strCaption, strDirectory: string;
  wstrRoot: WideString;
begin
  li := Listview1.Selected;
  if li = nil then Exit;
  if li.ImageIndex <> 32 then
  begin    //下载文件
    if CurFile = '' then Exit;
    SaveDialog1.InitialDir := ExtractFilePath(Paramstr(0)); //远控软件所在目录
    SaveDialog1.FileName := li.Caption; //保存文件名等于所选文件名
    if SaveDialog1.Execute then
    begin         //如果保存文件
      if ViKing.ListView2.Items.Count = 0 then
      begin    //如果没有文件传输
        DonwHeader := LianlineSoc;
      

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -