Skip to content
Permalink
Browse files
Removing unwanted event listeners.
Adding a smaller block size for bytearray chunks for MD5 processing
  • Loading branch information
bigosmallm committed Jun 17, 2013
1 parent fcd3f59 commit d7697146739e984a73c6fbcb42c63bd1c5243ed9
Showing 4 changed files with 277 additions and 2 deletions.
@@ -37,7 +37,7 @@ public class Constants
public static const APPLICATION_EXTENSION_MAC:String = ".dmg";
public static const APPLICATION_EXTENSION_WIN:String = ".exe";

public static const CONFIG_XML_NAME:String = "sdk-installer-config-3.0.xml";
public static const CONFIG_XML_NAME:String = "installer/sdk-installer-config-3.0.xml";
public static const DISCLAIMER_PATH:String = "about-binaries.html";
public static const INSTALLER_TRACK_SUCCESS:String = "track-installer.html";

@@ -161,6 +161,7 @@ variables are not required because the locations of these pieces are known.
private const WINDOWS_OS:String = "windows";
private const MAC_OS:String = "mac";
private const LINUX_OS:String = "linux";
<<<<<<< HEAD
[Bindable]
private var _flexHome:String;
@@ -422,6 +423,268 @@ variables are not required because the locations of these pieces are known.
if (APACHE_FLEX_BIN_DISTRO_PATH.indexOf("http") == 0) {
_useMirror = false;
}
=======
[Bindable]
private var _flexHome:String;
private var _flexTemp:String;
private var _flexHomeDir:File;
private var _flexTempDir:File;
private var _apacheFlexSDKCompressedFile:File;
private var _adobeAIRSDKZipFile:File;
private var _fbGlobalPlayerDir:File;
private var _fbGlobalPlayerFile:File;
private var _blazeDSJarFile:File;
private var _afeJarFile:File;
private var _aglj40JarFile:File;
private var _flexFontKitJarFile:File;
private var _rideauJarFile:File;
private var _osmfFile:File;
private var _os:String;
private var _loader:URLLoader;
private var _process:NativeProcess;
private var _previousDisplayedPercent:int = 0;
private var _fileUnzipErrorFunction:Function;
private var _numOptionalComponents:int = 4;
private var _numOptionalComponentsPermissions:int = 0;
private var languageOverride:String;
private var configOverride:String = "";
[Bindable]
private var _viewResourceConstants:ViewResourceConstants;
[Bindable]
private var _installationSteps:ArrayCollection = new ArrayCollection();
[Bindable]
private var _installerComponentsDataProvider:ArrayCollection = new ArrayCollection();
[Bindable]
private var _currentLicenseURL:String;
[Bindable]
private var _currentLicenseLabel:String;
[Bindable]
public var _messages:ArrayCollection = new ArrayCollection();
private function getInvoke():void {
var nativeApplication:NativeApplication = NativeApplication.nativeApplication;
nativeApplication.addEventListener(InvokeEvent.INVOKE, parseArgs);
}
private var _logButtonWidth:Number = 110;
[Bindable("logButtonWidthChanged")]
public function get logButtonWidth():Number {
return _logButtonWidth;
}
private var _folderButtonWidth:Number = 225;
[Bindable("folderButtonWidthChanged")]
public function get folderButtonWidth():Number {
return _folderButtonWidth;
}
private var _standardButtonWidth:Number = 88;
[Bindable("buttonWidthChanged")]
public function get standardButtonWidth():Number {
return _standardButtonWidth;
}
public function computeStandardButtonWidth():void {
// designer set english width at 88 so factor
// in the different between english strings and 88
var fudgeFactor:Number = 10;
var logFudgeFactor:Number = 3;
var folderFudgeFactor:Number = 17;
var w:Number;
hiddenButton.label = installLogBtn.label;
hiddenButton.validateNow();
w = hiddenButton.measuredWidth;
w += logFudgeFactor;
if (_logButtonWidth != w) {
_logButtonWidth = w;
dispatchEvent(new Event("logButtonWidthChanged"));
}
hiddenButton.label = openApacheFlexFolderBtn.label;
hiddenButton.validateNow();
w = hiddenButton.measuredWidth;
w += folderFudgeFactor;
if (_folderButtonWidth != w) {
_folderButtonWidth = w;
dispatchEvent(new Event("folderButtonWidthChanged"));
}
w = 0;
hiddenButton.label = installBtn.label;
hiddenButton.validateNow();
w = Math.max(w, hiddenButton.measuredWidth);
hiddenButton.label = browseBtn.label;
hiddenButton.validateNow();
w = Math.max(w, hiddenButton.measuredWidth);
hiddenButton.label = closeBtn.label;
hiddenButton.validateNow();
w = Math.max(w, hiddenButton.measuredWidth);
hiddenButton.label = nextBtn.label;
hiddenButton.validateNow();
w = Math.max(w, hiddenButton.measuredWidth);
w += fudgeFactor;
if (_standardButtonWidth != w) {
_standardButtonWidth = w;
dispatchEvent(new Event("buttonWidthChanged"));
}
}
private function parseArgs(event:InvokeEvent):void {
for each (var s:String in event.arguments) {
if (s.indexOf("-language=") == 0) {
languageOverride = s.substring(10);
}
if (s.indexOf("-config=") == 0) {
configOverride = s.substring(8);
}
}
}
protected function handleApplicationComplete(event:FlexEvent):void {
_langSelect.dataProvider = ViewResourceConstants.supportedLanguages;
_langSelect.selectedIndex = 0;
defineResourceManagerDefaultLanguage();
updateWindow();
loadXML();
}
/**
* Define on ResourceManager all keys for translation.
* If some key is not present on any other language selected by user, the default value will be displayed
* on the screen
*/
private function defineResourceManagerDefaultLanguage():void {
resourceManager.localeChain = [ ViewResourceConstants.DEFAULT_LANGUAGE ];
_viewResourceConstants = ViewResourceConstants.instance;
_viewResourceConstants.update();
computeStandardButtonWidth();
selectDefaultLanguage();
}
private function updateWindowTitle():void {
this.nativeWindow.title = StringUtil.substitute(_viewResourceConstants.INFO_WINDOW_TITLE, [APACHE_FLEX_BIN_DISTRO_VERSION]);
}
protected function selectDefaultLanguage():void {
var supportedLanguages:ArrayCollection = ViewResourceConstants.supportedLanguages;
var userLocale:String = new StringTools(LocaleID.DEFAULT).actualLocaleIDName.replace("-", "_");
if (languageOverride) {
userLocale = languageOverride;
}
var n:int = supportedLanguages.length;
for (var i:int = 0; i < n; i++) {
if (supportedLanguages[i].data == userLocale) {
_langSelect.selectedIndex = i;
resourceManager.localeChain = [ userLocale, "en_US" ];
break;
}
}
resourceManager.addEventListener(Event.CHANGE, _viewResourceConstants.update);
_viewResourceConstants.update();
computeStandardButtonWidth();
}
protected function updateWindow():void {
updateWindowTitle();
this.nativeWindow.x = Screen.mainScreen.bounds.width / 2 - this.nativeWindow.width / 2;
this.nativeWindow.y = Screen.mainScreen.bounds.height / 2 - this.nativeWindow.height / 2;
}
protected function loadXML():void {
var request:URLRequest;
if (configOverride != "") {
request = new URLRequest(configOverride);
} else {
//request = new URLRequest(Constants.APACHE_FLEX_URL + Constants.CONFIG_XML_NAME);
request = new URLRequest(Constants.CONFIG_XML_NAME);
}
_loader = new URLLoader();
try {
_loader.load(request);
} catch (error:Error) {
log(_viewResourceConstants.ERROR_CONFIG_XML_LOAD + error.errorID + " " + error.message);
abortInstallation();
}
_loader.addEventListener(IOErrorEvent.IO_ERROR, xmlError, false, 0, true);
_loader.addEventListener(Event.COMPLETE, xmlLoaded, false, 0, true);
}
protected function xmlError(event:IOErrorEvent):void {
log(_viewResourceConstants.ERROR_CONFIG_XML_LOAD + event.errorID);
abortInstallation();
}
protected function xmlLoaded(event:Event):void {
setOSSpecificVariables();
if (setXMLVariables()) {
updateWindowTitle();
_mirrorURLUtil.logMessages = new LogMessagesVO(_viewResourceConstants.FETCH_MIRROR_CGI, _viewResourceConstants.FETCH_MIRROR_CGI_DONE,
_viewResourceConstants.FETCH_MIRROR_CGI_ERROR);
_mirrorURLUtil.getMirrorURL(Constants.APACHE_FLEX_URL + _mirrorURLCGI, getMirrorURLResultHandler);
}
}
protected function setXMLVariables():Boolean {
var data:XML = XML(_loader.data);
var version:Number = Number(data.version.toString());
var files:XMLList = data.files.file;
var keepGoing:Boolean = true;
_latestVersion = data.version.latest.toString();
installerAppPath = files.(@name == 'SDKInstallerApp').@path.toString();
installerAppFileName = files.(@name == 'SDKInstallerApp').@file.toString();
_mirrorURLCGI = files.(@name == 'MirrorURLCGI').@file.toString();
var fileName:String = files.(@name == 'ApacheFlexSDK').@file.toString();
/* Tmp solution to remove the file extension if present in the config XML */
var winExtension:String = Constants.ARCHIVE_EXTENSION_WIN;
if (fileName.indexOf(winExtension) > -1) {
fileName = fileName.substring(0, fileName.length - winExtension.length);
}
APACHE_FLEX_BIN_DISTRO_FILE_SHORT = fileName;
APACHE_FLEX_BIN_DISTRO_VERSION = fileName.substr(Constants.SDK_BINARY_FILE_NAME_PREFIX.length).split("-")[0];
fileName += (_os == MAC_OS) ? Constants.ARCHIVE_EXTENSION_MAC : winExtension;
APACHE_FLEX_BIN_DISTRO_FILE = fileName;
APACHE_FLEX_BIN_DISTRO_PATH = files.(@name == 'ApacheFlexSDK').@path.toString();
if (!APACHE_FLEX_BIN_DISTRO_FILE || !APACHE_FLEX_BIN_DISTRO_PATH) {
log(_viewResourceConstants.ERROR_INVALID_SDK_URL);
keepGoing = false;
}
// ApacheFlex is full URL so download directly and dont use mirror useful for testing release candidates
if (APACHE_FLEX_BIN_DISTRO_PATH.indexOf("http") == 0) {
_useMirror = false;
}
>>>>>>> fd493c9... Removing unwanted event listeners.
var airVersions:Array = files.(@name == 'Versions').@airVersions.toString().split(",");
var selected:String = files.(@name == 'Versions').@airDefault.toString();
@@ -40,7 +40,8 @@ limitations under the License.
- path is relative to mirror URL
- don't use starting slash
- for the second and later releases, remove the extension from the file name -->
<file name="ApacheFlexSDK" path="flex/4.9.1/binaries/" file="apache-flex-sdk-4.9.1-bin"/>
<!-- <file name="ApacheFlexSDK" path="flex/4.9.1/binaries/" file="apache-flex-sdk-4.9.1-bin"/> -->
<file name="ApacheFlexSDK" path="https://builds.apache.org/job/flex-sdk_release/lastSuccessfulBuild/artifact/out/" file="apache-flex-sdk-4.10.0-bin" />

<!-- All the versions! -->
<file name="Versions" airVersions="3.8,3.7,3.6,3.5,3.4,3.3,3.2,3.1,3.0,2.7,2.6" flashPlayerVersions="11.8,11.7,11.6,11.5,11.4,11.3,11.2,11.1,11.0,10.3,10.2" airDefault="3.7" flashPlayerDefault="11.7" />
@@ -152,6 +152,7 @@ public class MD5CompareUtil extends EventDispatcher
_md5Stream = new MD5Stream();

_fileStream = new FileStream();
_fileStream.readAhead = 16384;
_fileStream.addEventListener(Event.COMPLETE, fileStreamOpenHandler);
_fileStream.addEventListener(ProgressEvent.PROGRESS, fileStreamOpenHandler);
_fileStream.addEventListener(OutputProgressEvent.OUTPUT_PROGRESS, fileStreamOpenHandler);
@@ -179,6 +180,7 @@ public class MD5CompareUtil extends EventDispatcher
{
_fileIsVerified = (_md5Stream.complete(data) == _remoteMD5Value);

removeEventListeners();
_callback();
}
}
@@ -238,6 +240,15 @@ public class MD5CompareUtil extends EventDispatcher
}
}

private function removeEventListeners():void
{
_fileStream.removeEventListener(Event.COMPLETE, fileStreamOpenHandler);
_fileStream.removeEventListener(ProgressEvent.PROGRESS, fileStreamOpenHandler);
_fileStream.removeEventListener(OutputProgressEvent.OUTPUT_PROGRESS, fileStreamOpenHandler);
_urlLoader.removeEventListener(Event.COMPLETE, urlLoaderResultHandler);
_urlLoader.removeEventListener(IOErrorEvent.IO_ERROR, urlLoaderResultHandler);
}

}
}

0 comments on commit d769714

Please sign in to comment.