从 AIR 中启动 Inno Setup Update

Launch Inno Setup Update from within AIR

我正在使用 Inno Setup 为桌面 AIR 应用程序创建安装程序。我让我的桌面应用程序检查我的数据库中的应用程序版本号,让用户知道是否有更新可供安装。我希望为用户提供一个非常无缝的更新过程,所以如果他们想要更新,我希望 AIR 下载 EXE,然后 运行 它。

1.) 如何在 AIR 中从网上下载 EXE 等大文件,是否需要将其放置在特定的位置? 2.) 下载文件后,如何让 AIR 执行 EXE?

谢谢!

public static function download(sourceURL:String, destinationPath:String, complete:Function = null, progress:Function = null, error:Function = null):void
{
    var urlReq:URLRequest = new URLRequest(sourceURL);
    var urlStream:URLStream = new URLStream();
    var fileData:ByteArray = new ByteArray();

    if(progress != null) urlStream.addEventListener(ProgressEvent.PROGRESS, progress);
    if(error != null) urlStream.addEventListener(IOErrorEvent.IO_ERROR, error);
    urlStream.addEventListener(Event.COMPLETE, loaded);
    urlStream.load(urlReq);

    function loaded(event:*):void
    {
        urlStream.readBytes(fileData, 0, urlStream.bytesAvailable);
        writeFile();
    }

    function writeFile():void
    {
        var file:File = new File(destinationPath + sourceURL.slice(sourceURL.lastIndexOf("/"), sourceURL.length));
        var fileStream:FileStream = new FileStream();
        fileStream.open(file, FileMode.WRITE);
        fileStream.writeBytes(fileData, 0, fileData.length);
        fileStream.close();

            if(complete != null) complete();
    }
}

var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = file;
process = new NativeProcess();
process.closeInput();
process.start(nativeProcessStartupInfo);