【问题标题】:Launch Inno Setup Update from within AIR从 AIR 中启动 Inno Setup Update
【发布时间】:2020-12-13 06:10:37
【问题描述】:

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

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

谢谢!

【问题讨论】:

    标签: actionscript-3 air


    【解决方案1】:
    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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-19
      • 1970-01-01
      • 1970-01-01
      • 2016-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-09
      相关资源
      最近更新 更多