萌梦动作编辑器自动更新功能思路



  • 自动更新主要借助的是Qt Installer Framework的思想。我看过Qt Installer Framework的文档,里面介绍了如何写xml配置文件和.js控制文件。大致知道,使用最新版本的Qt Installer Framework,有自动更新的可能性,而不必借助第三方框架或者是自己写一套。

    很有意思,在已经安装的萌梦安装包实例中,找到maintanenceTool.exe文件,然后使用命令行输入,发现这样一些选项:

    Usage: G:\QtDreamProject\test_qtdream\maintenancetool.exe [options] Key=Value
    
    Options:
      -?, -h, --help                           Displays this help.
      --version                                Displays version information.
      --framework-version                      Displays the version of the Qt
                                               Installer Framework.
      -v, --verbose                            Verbose mode. Prints out more
                                               information.
      --proxy                                  Use system proxy on Windows and
                                               Linux. This option has no effect on
                                               OS X.
      --script <file>                          Execute the script given as
                                               argument.
      --checkupdates                           Check for updates and return an XML
                                               description.
      --updater                                Start application in updater mode.
      --manage-packages                        Start application in package manager
                                               mode.
      --no-force-installations                 Allow deselecting components that
                                               are marked as forced.
      --show-virtual-components                Show virtual components in installer
                                               and package manager.
      --logging-rules <rules>                  Enables logging according to passed
                                               rules. Comma separated logging rules
                                               have the following syntax:
                                               loggingCategory=true/false. Passing
                                               empty logging rules enables all
                                               logging categories. The following
                                               rules enable a single category:
                                               ifw.*=false,ifw.category=true The
                                               following logging categories are
                                               available:
                                               ifw.componentChecker
                                               ifw.resources
                                               ifw.translations
                                               ifw.network
      --create-local-repository                Create a local repository inside the
                                               installation directory. This option
                                               has no effect on online installers.
      --addRepository <URI,...>                Add a local or remote repository to
                                               the list of user defined
                                               repositories.
      --addTempRepository <URI,...>            Add a local or remote repository to
                                               the list of temporary available
                                               repositories.
      --setTempRepository <URI,...>            Set a local or remote repository as
                                               temporary repository, it is the only
                                               one used during fetch.
                                               Note: URI must be prefixed with the
                                               protocol, i.e. file:///, https://,
                                               http:// or ftp://.
      --startserver <mode,socketname,key>      Starts the application as headless
                                               process waiting for commands to
                                               execute. Mode can be DEBUG or
                                               PRODUCTION. In DEBUG mode, the option
                                               values can be omitted.Note: The
                                               server will not shutdown on his own,
                                               you need to quit the process by hand.
      --startclient <socketname,key>           Starts the application to debug the
                                               client-server communication. If a
                                               value is omitted, the client will use
                                               a default instead. Note: The server
                                               process is not started by the client
                                               application in that case, you need to
                                               start it on your own.
      --installCompressedRepository <URI,...>  Installs QBSP or 7z file. The QBSP
                                               (Board Support Package) file must be
                                               a .7z file which contains a valid
                                               repository.
      --silentUpdate                           Updates all packages silently.
      --platform <plugin>                      Use the specified platform plugin.
    
    Arguments:
      Key=Value                                Key Value pair to be set.
    

    其中--checkupdates--silentUpdate这两个选项正是我需要的,于是我开始尝试将这个功能做到我们的应用中去。具体来说,我倾向于做到我们的launcher中去,因为launcher之后还有一个职责,就是上传崩溃的日志什么的。

    比方说,输入./maintenancetool.exe --checkupdates就可以获取更新模块的内容:
    0_1524653647526_88888.png

    然后我输入了maintenancetool.exe --silentUpdate,直接就在原有安装包的基础上更新组件了,非常简单。
    原本想做自动更新功能困难重重呢,没想到很大一部分的难点被Qt Installer Framework搞定了,还真是幸运呢。



  • @jiangcaiyang 这样可以每天启动程序时候检测,是否有更新 ,提示安装更新



  • @青山白云 现在正在尝试将自动更新的功能放在launcher中做,然后就可以维持一个匿名管道进行IPC通讯,可以获取到是否有更新并且进行静默更新。😍
    有希望,加紧干!
    🥝 🍎



  • @jiangcaiyang qq的效果是,默默下载后提醒,可以立刻开始重启安装,或者下次启动安装



  • @jiangcaiyang萌梦动作编辑器自动更新功能思路 中说:

    Qt Installer Framework

    Qt Installer Framework这个linux能用吗?



  • @大黄老鼠 当然可以用了。这个没有任何问题。Qt默认的安装包也是这么做的。

    @青山白云 这个嘛。Qt Installer Framework根据我刚刚列举的选项,暂时不能够做到,因为这里有一个考量。根据Qt Installer Framework的思路,一旦安装了,就要替换掉原有的旧文件,这样以来,原本静默安装了,要再想回滚到安装之前的状态(如果用户不打算安装的话),那么对于Qt Installer Framework没有这样的操作,估计以后的版本才会支持吧。


 

走马观花

最近的回复

关注我们

微博
QQ群











召唤伊斯特瓦尔