sm

立即登录 | 账号注册

积分: 0 |用户组: 游客

搜索
服务器租用 传奇3一条龙 支付平台源码 无法下载点击此处反馈
查看: 1333|回复: 2

[传奇3源码] 华立3.56登录器源码lyy冷雨夜登录器Delphi源码

[复制链接]

826

主题

36

回帖

23万

积分

霸王教主

积分
235297
发表于 2022-9-12 16:58:13 | 显示全部楼层 |阅读模式
HL3.56插件的lyy登录器主程序源码,网络家园定制版,适配的华立插件3.56 编译通过
hl356.png
  1. type
  2.   TUpdateing = record
  3.     TempFile: string;
  4.     FromURL: string;
  5.     ToPathFile: string;
  6.     FileDateTime: TDateTime;
  7.   end;
  8.   PTUpdateing = ^TUpdateing;

  9. type
  10.   TForm_Update = class(TForm)
  11.     Timer1: TTimer;
  12.     suiForm1: TsuiForm;
  13.     ListView_files: TsuiListView;
  14.     Label4: TLabel;
  15.     Button2: TsuiButton;
  16.     suiThemeManager1: TsuiThemeManager;
  17.     Label1: TLabel;
  18.     IdHTTP1: TIdHTTP;
  19.     Timer2: TTimer;
  20.     ProgressBarCount: TsuiProgressBar;
  21.     VCLUnZip1: TVCLUnZip;
  22.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  23.     procedure Timer1Timer(Sender: TObject);
  24.     procedure FormShow(Sender: TObject);
  25.     procedure Button2Click(Sender: TObject);
  26.     procedure Timer2Timer(Sender: TObject);
  27.     procedure IdHTTP1WorkBegin(ASender: TObject; AWorkMode: TWorkMode;
  28.       AWorkCountMax: Int64);
  29.     procedure IdHTTP1Work(ASender: TObject; AWorkMode: TWorkMode;
  30.       AWorkCount: Int64);
  31.   private
  32.     Tuping: TList;
  33.     //IsReStart: Boolean;                 //是否当前文件
  34.     //AppFilseName: string;               //当前文件名
  35.     m_BoStopDown: Boolean;              //停止下载
  36.     sWorkCount: Integer;

  37.     function HttpDownLoad(aURL, aFile: string; var ErrorMsg: string): Boolean;
  38.     procedure StartUP();
  39.   public
  40.     DownUrl: string;                    //HTTP下载目录
  41.     Runexe: string;                     //更新完毕后运行的文件
  42.   end;

  43. var
  44.   Form_Update       : TForm_Update;

  45. implementation

  46. uses Mir3, Func, MAIN;

  47. {$R *.dfm}

  48. //http方式下载

  49. function TForm_Update.HttpDownLoad(aURL, aFile: string; var ErrorMsg: string): Boolean;
  50. var
  51.   TStream           : TFileStream;
  52. begin                                   //Http方式下载
  53.   try
  54.     TStream := TFileStream.Create(aFile, fmCreate);
  55.     try
  56.       IdHTTP1.Request.ContentRangeStart := 0;
  57.       IdHTTP1.Get(aURL, TStream);       //开始下载
  58.       Result := True;
  59.     finally
  60.       TStream.Free;
  61.     end;
  62.   except
  63.     on e: exception do
  64.     begin
  65.       ErrorMsg := e.message;
  66.       Result := False;
  67.     end;
  68.   end;
  69. end;

  70. function Zip(ZipFile,UnzipDir:String):Boolean;   //压缩或解压缩文件
  71. var
  72.   vcluzip:TVCLUnZip;
  73. begin
  74.   Result:=False;
  75.   vcluzip:=TVCLUnZip.Create(nil);
  76.   try
  77.     with vcluzip do
  78.     begin
  79.       try
  80.         ZipName:=ZipFile;
  81.         ReadZip;
  82.         FilesList.Add('*.*');
  83.         DoAll := True;
  84.         DestDir := UnzipDir;
  85.         RecreateDirs := False;
  86.         RetainAttributes := True;
  87.         Unzip;
  88.         Result:=True;
  89.       except
  90.         Application.MessageBox('解压文件失败','错误',MB_OK+MB_ICONINFORMATION);
  91.         Result:=False;
  92.         exit;
  93.       end;
  94.     end;
  95.   finally
  96.     vcluzip.Free;
  97.   end;
  98. end;


  99. procedure TForm_Update.StartUP();
  100. var
  101.   NFile, TFile      : string;
  102.   PUDL              : PTUpdateList;
  103.   PUIN              : PTUpdateing;
  104.   PUOUT             : PTUpdateing;
  105.   SelfPath          : string;
  106.   SelfDir           : string;
  107.   SelfFileTime      : TDateTime;
  108.   SelfFile          : string;
  109.   FormURL           : string;
  110.   i                 : Integer;
  111.   AddFile           : TListItem;
  112.   FileCount         : Integer;
  113.   ErrorMsg          : string;
  114.   sToFile           : string;
  115.   zpName            : string;
  116.   zpDir             : string;
  117. begin
  118.   Label4.Caption := '正在分析更新信息...';
  119.   SelfPath := FullPath;
  120.   SelfPath := copy(SelfPath, 1, Length(SelfPath) - 1);
  121.   //Delay(1000);
  122.   for i := 0 to UPList.Count - 1 do
  123.   begin
  124.     PUDL := UPList.Items;
  125.     NFile := SelfPath + PUDL^.FilePath + PUDL^.ToFile;
  126.     //Label4.Caption := '正在分析:' + NFile;
  127.     Application.ProcessMessages;
  128.     try
  129.       if not FileExists(NFile) then     //文件不存在
  130.       begin
  131.         TFile := FullPath + 'update\' + PUDL^.FromFile;
  132.         FormURL := _sDefUrl + PUDL^.FilePath + PUDL^.FromFile;
  133.         FormURL := Q_ReplaceStr(FormURL, '\', '/');
  134.         New(PUIN);
  135.         PUIN^.TempFile := TFile;
  136.         PUIN^.FromURL := FormURL;
  137.         PUIN^.ToPathFile := NFile;
  138.         PUIN^.FileDateTime := PUDL^.FileDateTime;
  139.         Tuping.Add(PUIN);

  140.         sToFile := PUDL^.ToFile;
  141.         if Q_LowerCase(ExtractFileExt(PUDL^.FromFile)) = '.zip' then
  142.         begin
  143.            sToFile := PUDL^.ToFile + '(zip)';
  144.         end;
  145.         ListView_files.Items.BeginUpdate;
  146.         AddFile := ListView_files.Items.Add;
  147.         AddFile.Caption := sToFile;
  148.         AddFile.SubItems.Add(DateTimeToStr(PUDL^.FileDateTime));
  149.         AddFile.SubItems.Add('△等待下载..');
  150.         ListView_files.Items.EndUpdate;

  151.         continue;
  152.       end;
  153.       SelfFileTime := GetFileDateTime(NFile, fttLastWrite);
  154.       if SecondsBetween(SelfFileTime, PUDL^.FileDateTime) > 30 then
  155.       begin
  156.         TFile := FullPath + 'update\' + PUDL^.FromFile;
  157.         FormURL := _sDefUrl + PUDL^.FilePath + PUDL^.FromFile;
  158.         FormURL := Q_ReplaceStr(FormURL, '\', '/');
  159.         New(PUIN);
  160.         PUIN^.TempFile := TFile;
  161.         PUIN^.FromURL := FormURL;
  162.         PUIN^.ToPathFile := NFile;
  163.         PUIN^.FileDateTime := PUDL^.FileDateTime;
  164.         Tuping.Add(PUIN);

  165.         sToFile := PUDL^.ToFile;
  166.         if Q_LowerCase(ExtractFileExt(PUDL^.FromFile)) = '.zip' then
  167.         begin
  168.            sToFile := PUDL^.ToFile + '(zip)';
  169.         end;
  170.         ListView_files.Items.BeginUpdate;
  171.         AddFile := ListView_files.Items.Add;
  172.         AddFile.Caption := sToFile;
  173.         AddFile.SubItems.Add(DateTimeToStr(PUDL^.FileDateTime));
  174.         AddFile.SubItems.Add('△等待下载..');
  175.         ListView_files.Items.EndUpdate;

  176.         continue;
  177.       end;
  178.     except
  179.     end;
  180.   end;
  181.   Label4.Caption := '更新信息分析完毕...';
  182.   FileCount := Tuping.Count;
  183.   if FileCount = 0 then
  184.   begin
  185.     Close;
  186.     Exit;
  187.   end;
  188.   for i := 0 to FileCount - 1 do
  189.   begin
  190.     Application.ProcessMessages;
  191.     if m_BoStopDown then Exit;
  192.     PUOUT := Tuping.Items;
  193.     Label4.Caption := '正在连接服务器...';
  194.     Label1.Caption := '正在下载(' + Q_IntToStr(i + 1) + '/' + Q_IntToStr(FileCount) + '):' + PUOUT^.ToPathFile;
  195.     SelfDir := ExtractFileDir(PUOUT^.ToPathFile);
  196.     if not DirectoryExists(SelfDir) then CreateDir(SelfDir);
  197.     if m_BoStopDown then Exit;
  198.     ErrorMsg := '';
  199.     ListView_files.Items.SubItems[1] := '↓正在下载...';
  200.     DelFile(PUOUT^.TempFile);
  201.     if not HttpDownLoad(PUOUT^.FromURL, PUOUT^.TempFile, ErrorMsg) then
  202.     begin
  203.       ListView_files.Items.SubItems[1] := '×' + ErrorMsg;
  204.       if Q_PosStr('timed out.', ErrorMsg) <> 0 then
  205.       begin
  206.         MessShow(2, '连接自动更新服务器超时,无法完成更新!');
  207.         m_BoStopDown := True;
  208.         Exit;
  209.       end;
  210.       continue;
  211.     end;
  212.     if m_BoStopDown then
  213.     begin
  214.       ListView_files.Items.SubItems[1] := '♀更新被终止.'
  215.     end
  216.     else
  217.     begin
  218.       if Q_LowerCase(ExtractFileExt(PUOUT^.TempFile)) = '.zip' then
  219.       begin
  220.         //RAR压缩文件
  221.         try
  222.           Label4.Caption := '正在解压文件...';
  223.           SelfFile := ExtractFileName(PUOUT^.TempFile);
  224.           SelfFile := ChangeFileExt(SelfFile, '');
  225.           SelfFile := FullPath + 'update\' + SelfFile;
  226.           ProgressBarCount.Min := 0;
  227.           ProgressBarCount.Max := 100;
  228.           zpDir := FullPath + 'update';
  229.           ZpName := PUOUT^.TempFile;
  230.           if Zip(ZpName,zpDir) then
  231.           begin
  232.             ListView_files.Items.SubItems[1] := '√解压成功.';
  233.             Label4.Caption := '正在复制文件...';
  234.             if FileExists(SelfFile) then
  235.             begin
  236.               SetFileDateTime(SelfFile, fttLastWrite, PUOUT^.FileDateTime);
  237.               DelFile(PUOUT^.ToPathFile); //删除目标文件
  238.               CopyFile(PChar(SelfFile), PChar(PUOUT^.ToPathFile), False);
  239.               DelFile(PUOUT^.TempFile); //删除update目录中的RAR文件
  240.               DelFile(SelfFile);        //删除update目录中解压出的文件
  241.               Label4.Caption := '更新完成.';
  242.               ListView_files.Items.SubItems[1] := '√更新完成.';
  243.             end
  244.             else
  245.             begin
  246.               ListView_files.Items.SubItems[1] := '×压缩文件内部文件名不正确.';
  247.             end;
  248.           end
  249.           else
  250.           begin
  251.             ListView_files.Items.SubItems[1] := '×解压失败.';
  252.           end;
  253.         except
  254.           on e: exception do
  255.           begin
  256.             ListView_files.Items.SubItems[1] := '×' + e.message;
  257.           end;
  258.         end;
  259.       end
  260.       else
  261.       begin
  262.         //非压缩文件
  263.         try
  264.           Label4.Caption := '正在复制文件...';
  265.           if FileExists(PUOUT^.TempFile) then
  266.           begin
  267.             SetFileDateTime(PUOUT^.TempFile, fttLastWrite, PUOUT^.FileDateTime);
  268.             DelFile(PUOUT^.ToPathFile); //删除目标文件
  269.             CopyFile(PChar(PUOUT^.TempFile), PChar(PUOUT^.ToPathFile), False);
  270.             DelFile(PUOUT^.TempFile);   //删除update目录中的升级文件
  271.             Label4.Caption := '更新完成.';
  272.             ListView_files.Items.SubItems[1] := '√更新完成.';
  273.           end
  274.           else
  275.           begin
  276.             ListView_files.Items.SubItems[1] := '×下载文件意外丢失.';
  277.           end;
  278.         except
  279.           on e: exception do
  280.           begin
  281.             ListView_files.Items.SubItems[1] := '×' + e.message;
  282.           end;
  283.         end;
  284.       end;
  285.     end;
  286.   end;
  287.   m_BoStopDown := True;
  288. end;

  289. procedure TForm_Update.Timer1Timer(Sender: TObject);
  290. begin
  291.   Timer1.Enabled := False;
  292.   ProgressBarCount.Max := 0;
  293.   ProgressBarCount.Min := 0;
  294.   StartUP();
  295. end;

  296. procedure TForm_Update.FormShow(Sender: TObject);
  297. begin
  298.   Tuping := TList.Create;
  299.   m_BoStopDown := False;
  300.   //IsReStart := False;
  301.   suiThemeManager1.FileTheme := Form1.suiFileTheme1;
  302.   suiThemeManager1.UIStyle := Form1.suiThemeManager_form.UIStyle;
  303.   Label1.Caption := '';
  304.   Label4.Caption := '正在分析更新信息..';
  305.   suiForm1.Caption := Mir3ServerName + '补丁自动更新...';
  306.   ListView_files.Items.Clear;
  307.   Timer1.Enabled := True;
  308.   Timer2.Enabled := True;
  309. end;

  310. procedure TForm_Update.FormClose(Sender: TObject;
  311.   var Action: TCloseAction);
  312. var
  313.   i                 : Integer;
  314. begin
  315.   try
  316.     for i := 0 to Tuping.Count - 1 do
  317.     begin
  318.       Dispose(PTUpdateing(Tuping.Items));
  319.     end;
  320.     FreeAndNil(Tuping);
  321.     // ClientSocket1.Active := False;
  322.     ProgressBarCount.Position := 0;
  323.     ListView_files.Items.Clear;
  324.    except
  325.    end;
  326.   {finally
  327.     if IsReStart then
  328.     begin
  329.       ShellExecute(Handle, 'open', PChar(FullPath + 'Mir3Up.exe'), PChar(ExtractFileName(ParamStr(0))), PChar(FullPath), SW_NORMAL);
  330.       Application.Terminate;
  331.     end
  332.     else
  333.     begin
  334.       if (UpperCase(Runexe) <> AppFilseName) and FileExists(Runexe) then
  335.       begin
  336.         ShellExecute(Handle, 'open', PChar(FullPath + Runexe), nil, PChar(FullPath), SW_NORMAL);
  337.         Application.Terminate;
  338.       end;
  339.     end;
  340.   end; }
  341. end;

  342. procedure TForm_Update.Button2Click(Sender: TObject);
  343. begin
  344.   m_BoStopDown := True;
  345. end;

  346. procedure TForm_Update.Timer2Timer(Sender: TObject);
  347. begin
  348.   if m_BoStopDown then
  349.   begin
  350.     Timer2.Enabled := False;
  351.     IdHTTP1.Disconnect;
  352.     Close;
  353.   end;
  354. end;

  355. procedure TForm_Update.IdHTTP1WorkBegin(ASender: TObject;
  356.   AWorkMode: TWorkMode; AWorkCountMax: Int64);
  357. begin
  358.   ProgressBarCount.Min := 0;
  359.   ProgressBarCount.Position := 0;
  360.   ProgressBarCount.Max := AWorkCountMax;
  361.   sWorkCount := AWorkCountMax;
  362. end;

  363. procedure TForm_Update.IdHTTP1Work(ASender: TObject; AWorkMode: TWorkMode;
  364.   AWorkCount: Int64);
  365. begin
  366.   if m_BoStopDown then IdHTTP1.Disconnect; //中断下载
  367.   Application.ProcessMessages;
  368.   Label4.Caption := '下载进度:' + Format('%d/%d', [AWorkCou[sale=200]1[/sale]nt, sWorkCount]);
  369.   ProgressBarCount.Position := AWorkCount;
  370. end;

  371. end.
复制代码
游客,如果您要查看本帖隐藏内容请回复






上一篇:新1.4C登录器Delphi源码冷雨夜适配King1.4c插件
下一篇:冷雨夜Ei3.0登录器源码Delphi全套+网关+反外挂插件
回复

使用道具 举报

1

主题

20

回帖

289

积分

旋风流星刀

积分
289
发表于 2023-7-2 03:25:20 | 显示全部楼层
瞧瞧这个代码
回复 支持 反对

使用道具 举报

0

主题

7

回帖

31

积分

旋风流星刀

积分
31
发表于 2023-7-11 08:26:10 | 显示全部楼层
谢谢老大,看看这个代码喽。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|美林GM论坛 ( 蜀ICP备2020030293号-2 )|网站地图

禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.如遇版权问题,请及时QQ联系

GMT+8, 2024-4-26 15:27 , Processed in 0.341541 second(s), 63 queries .

Powered by Discuz! X3.5

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表