InnoTools Downloader无法与Inno 5.5一起使用 [英] InnoTools Downloader not working with Inno 5.5

查看:97
本文介绍了InnoTools Downloader无法与Inno 5.5一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此处有关SO的几篇文章的建议,我一直在与InnoTools Downloader一起尝试在Inno设置中的Install脚本期间为我们的应用安装第三方依赖.

On the recommendation of several posts here on SO, I've been working with the InnoTools Downloader to try to install a 3rd party dependency for our app during the Install script in Inno setup.

不幸的是,InnoTools Downloader几年没有更新,并且开始看起来与当前的Inno Tools设置(当前在我的计算机上为5.5.2(u))不兼容. ITD中的PChar参数已被PAnsiChar参数取代,当我尝试运行各种ITD_xxx过程时,它给了我不同程度的失败:

Unfortunately the InnoTools Downloader hasn't been updated in a few years, and is starting to look like it's incompatible with the current Inno Tools setup (5.5.2 (u) on my machine at present). The PChar parameters in ITD have been replaced by PAnsiChar parameters, and when I try to run the various ITD_xxx procedures it gives me varying degrees of fail:

  • ITD_DownloadFiles给出类型不匹配错误,并且不会在Inno Setup中编译
  • ITD_DownloadFile可以编译,但是显示的文件长度为6KB,并且无法运行.
  • ITD_DownloadFiles gives a type mismatch error and won't compile in Inno Setup
  • ITD_DownloadFile compiles, but the file that shows up is 6KB in length and not runnable.

有人让ITP与更新的Inno(5.3.0版之后)unicode版本一起运行吗?还是应该寻找其他解决方案?

Has anyone gotten ITP to run with newer Inno (post-5.3.0) unicode versions? Or should I look around for another solution?

编辑 为了澄清一点,我尝试进入it_download.iss文件,并用PAnsiChar替换了所有PChar实例.当我第一次尝试将ITD与安装脚本集成时,这使我克服了编译错误.

EDIT Just to clarify things a bit, I have tried going into the it_download.iss file and replacing all instances of PChar with PAnsiChar. This got me past the compile errors when I first tried to integrate ITD with my setup script.

以下是Inno脚本的示例部分:

Here is a sample section of the Inno script:

[Code]
procedure InitializeWizard();
begin
  ITD_Init; // initialize the InnoTools Downloader
  // install 3rd party tool (ex. Git) from the internet.
  if ITD_DownloadFile('http://git-scm.com/download/win',expandconstant('{tmp}\GitInstaller.exe'))=ITDERR_SUCCESS then begin
     MsgBox(expandconstant('{tmp}\GitInstaller.exe'), mbInformation, MB_OK);
     Exec(ExpandConstant('{tmp}\GitInstaller.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, tmpResult);
  end
end;

运行此命令时,它将弹出一个对话框,指出其下载"并存储文件的位置-在我的计算机上,该文件位于c:\ Users \\ AppData \ Local \ Temp的子目录中.该文件为6KB,与从 http://git-scm.com/download/win下载的文件相反,目前为15,221KB.

When this is run, it will bring up a dialog stating where it "downloaded" and stored the file -- on my machine it's in a subdirectory of c:\Users\\AppData\Local\Temp. This file is 6KB, as opposed to the file downloaded from http://git-scm.com/download/win, which is currently 15,221KB.

ITP_DownloadAfter方法给出类似的结果.

The ITP_DownloadAfter method gives a similar result.

推荐答案

除了用PAnsiChar替换所有PChar类型的出现以外,您还需要在it_download.iss中用AnsiString替换所有string类型的出现.文件.下一个问题是您要获取的URL.文件的大小与预期的有所不同,因为您正在下载HTML文档而不是该站点重定向到的二进制文件.因此,如果您已准备好使用Unicode的ITD,请将脚本中的URL更改为

Except replacing all PChar type occurrences with PAnsiChar you will need to replace all occurrences of string type with AnsiString in the it_download.iss file. The next problem is the URL you're trying to get. The size of a file differs from expectation, because you are downloading a HTML document instead of the binary file on which that site redirects. So, if you have your ITD ready for Unicode, change the URL in your script to a direct binary URL. Note, that I didn't used HTTPS because ITD doesn't currently support SSL. A code proof may look like this:

[Code]
const
  GitSetupURL = 'http://msysgit.googlecode.com/files/Git-1.8.4-preview20130916.exe';

procedure InitializeWizard;
var
  Name: string;
  Size: Integer;
begin
  Name := ExpandConstant('{tmp}\GitInstaller.exe');

  ITD_Init;  
  if ITD_DownloadFile(GitSetupURL, Name) = ITDERR_SUCCESS then
  begin
    if FileSize(Name, Size) then
      MsgBox(Name + #13#10 + 'Size: ' + IntToStr(Size) + ' B',
        mbInformation, MB_OK)
    else
      MsgBox('FileSize function failed!', mbError, MB_OK);
  end;
end;

这篇关于InnoTools Downloader无法与Inno 5.5一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆