多次启动 Adob​​e AIR 应用程序 [英] starting an Adobe AIR application multiple times

查看:20
本文介绍了多次启动 Adob​​e AIR 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Adobe air runtime 可防止同时启动多个 air 应用程序实例.通过任意更改发布商 ID 来规避此限制是否安全?有谁知道 Adob​​e 是否计划在 Air 2.0 中允许多个并发实例?

Adobe air runtime prevents more than one instance of an air application to be started at the same time. Is it safe to circumvent this restriction by arbitrarily changing the publisher ID? Does anyone know if Adobe plans to allow multiple concurrent instances in Air 2.0?

推荐答案

我们成功地实施了一个 hack 来绕过这个限制,以纯 AIR 方式,而无需更改发布者 ID(我认为这需要多个证书).

We successful implemented a hack to circumvent this limitation, in a pure AIR way, without having to change the publisher id (which needs multiple certificates, I think).

如您所知,AIR 正在通过使用唯一的应用程序标识符来实现其互斥锁.此标识符是使用应用程序 ID 和发布者标识符(从签署应用程序的证书中提取的)计算得出的.

As you know, AIR is implementing its Mutex by using a unique application identifier. This identifier is calculated using the application id, and the publisher identifier (extracted from the certificate that signed the application).

在 AIR 应用程序的安装目录中,有一个 META-INF 文件夹(或在/share/使用 Linux).此 META-INF 文件夹包含一个 AIR 文件夹,其中包含一个application.xml"文件.该文件包含一个 <id/> 标签,用于定义应用程序标识符,用于计算互斥锁标识符.如果你的应用程序可以写入安装文件夹,你可以在运行时使用File API对其进行编辑,随机改变标签,允许多个进程同一应用程序同时运行.

In the installation directory of an AIR application, there is a META-INF folder (or in /share/ using Linux). This META-INF folder contains an AIR folder, which contains an "application.xml" file. This file contains a <id /> tag that defines the application identifier, which is used in the calculation of the mutex identifier. If your application can write in the installation folder, you can use the File API to edit it at runtime, randomly changing the <id /> tag, allowing multiple processes of the same application to be run at the same time.

这会产生一些烦人的副作用,例如每次都在 File.applicationStorageDirectory 文件夹中创建一个新文件夹.但是使用 LocalConnection,您可以通过记录哪些标识符可以自由重复使用来多次重复使用相同的标识符,从而最大限度地减少这种情况.此外,SharedObject 存储在此文件夹中,因此无法使用(或必须在每次创建新实例时复制,并通过 LocalConnection 进行同步).

This is having some annoying side effects, like creating a new folder in the File.applicationStorageDirectory folder every time. But using a LocalConnection, you can minimize this by reusing the same identifier multiple times by logging which ones are free to be reused. Also, SharedObject are stored in this folder, so cannot be used (or have to be copied every time a new instance is created, and synchronized though LocalConnection).

据我所知,Adobe 不打算移除这个原生限制.它是为多平台目的而实现的,特别是在 MacOS 上,其中 Dock 使事情变得更加复杂(使用 Dock 两次启动同一个应用程序并不容易).

As far as I know, Adobe isn't planning to remove this native limitation. It was implemented for multi-platforming purposes, specifically on MacOS, where the dock is making that more complicated (it's not very easy to start the same application twice with the dock).

官方的做法是捕获 InvokeEvent.INVOKE 事件,并执行诸如打开新窗口之类的操作.AIR 2.0 没有计划在此行为方面进行更改.

The official way to do that is to catch the InvokeEvent.INVOKE event, and do stuff like opening a new window. And there's no change planned for AIR 2.0 in this behaviour.

这篇关于多次启动 Adob​​e AIR 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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