Skip to content

Commit

Permalink
Working on tracking NetConnection in Net tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Fujiwara committed Mar 6, 2012
1 parent 3cff44d commit 0f5ed6c
Show file tree
Hide file tree
Showing 11 changed files with 143 additions and 31 deletions.
5 changes: 3 additions & 2 deletions SWFWireDebugger/.actionScriptProperties
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="SWFWireDebugger.mxml" projectUUID="4218497d-0743-4524-af84-684840501cb6" version="10">
<compiler additionalCompilerArguments="-locale en_US -swf-version=13" autoRSLOrdering="false" copyDependentFiles="true" flexSDK="Flex 4.5.1 + AIR 3.0b" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src/classes" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="true" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compiler additionalCompilerArguments="-locale en_US -swf-version=13" autoRSLOrdering="false" copyDependentFiles="true" flexSDK="Flex 4.6.0" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src/classes" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="true" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compilerSourcePath>
<compilerSourcePathEntry kind="1" linkType="1" path="src/include"/>
</compilerSourcePath>
Expand All @@ -27,10 +27,11 @@
<flashCatalyst validateFlashCatalystCompatibility="false"/>
<buildTargets>
<buildTarget buildTargetName="default">
<airSettings airCertificatePath="F:/www/hobo.webhop.net/htdocs/workspaces/fb_i6_swfwire/swfwire.p12" airTimestamp="true" version="1">
<airSettings airCertificatePath="F:/www/hobo.webhop.net/htdocs/workspaces/fb_i6_swfwire/swfwire.p12" airTimestamp="true" anePathSet="false" version="1">
<airExcludes>
<pathEntry path="catalog.xml"/>
</airExcludes>
<anePaths/>
</airSettings>
<actionScriptSettings version="1"/>
</buildTarget>
Expand Down
5 changes: 5 additions & 0 deletions SWFWireDebugger/src/assets/style.css
Expand Up @@ -53,6 +53,11 @@ mx|DataGrid
text-roll-over-color: #000000;
}

mx|DataGrid mx|Text
{
color: #000000;
}

mx|Alert
{
modal-transparency: 0;
Expand Down
2 changes: 1 addition & 1 deletion SWFWireDebugger/src/classes/SWFWireDebugger-app.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<application xmlns="http://ns.adobe.com/air/application/3.0">
<application xmlns="http://ns.adobe.com/air/application/3.1">

<!-- Adobe AIR Application Descriptor File Template.
Expand Down
62 changes: 50 additions & 12 deletions SWFWireDebugger/src/classes/SWFWireDebugger.mxml
Expand Up @@ -286,41 +286,53 @@
var urlLoaderClass:* = injectedAppDomain.getDefinition('com.swfwire.debugger.injected.URLLoader');
urlLoaderClass.globalEvents.addEventListener(Event.OPEN, function(ev:*):void
{
logToNet(ev.instance, ev.url, 'open');
logToNet(ev.instance, ev.url, ev.data, 'open');
});
urlLoaderClass.globalEvents.addEventListener(ProgressEvent.PROGRESS, function(ev:*):void
{
logToNet(ev.instance, ev.url, 'progress');
logToNet(ev.instance, ev.url, ev.data, 'progress');
});
urlLoaderClass.globalEvents.addEventListener(Event.COMPLETE, function(ev:*):void
{
logToNet(ev.instance, ev.url, 'complete');
logToNet(ev.instance, ev.url, ev.data, 'complete');
});
urlLoaderClass.globalEvents.addEventListener(Event.CLOSE, function(ev:*):void
{
logToNet(ev.instance, ev.url, 'close');
logToNet(ev.instance, ev.url, ev.data, 'close');
});
urlLoaderClass.globalEvents.addEventListener(IOErrorEvent.IO_ERROR, function(ev:*):void
{
logToNet(ev.instance, ev.url, 'ioError');
logToNet(ev.instance, ev.url, ev.data, 'ioError');
});
urlLoaderClass.globalEvents.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function(ev:*):void
{
logToNet(ev.instance, ev.url, 'securityError');
logToNet(ev.instance, ev.url, ev.data, 'securityError');
});
var ncClass:* = injectedAppDomain.getDefinition('com.swfwire.debugger.injected.NetConnection');
ncClass.globalEvents.addEventListener('connect', function(ev:*):void
{
//logToNet(ev.command+': rtmp connect');
logToNet2(ev.instance, ev.command, ev.parameters, 'ncConnect');
});
ncClass.globalEvents.addEventListener('connected', function(ev:*):void
{
logToNet2(ev.instance, ev.command, ev.parameters, 'ncConnected');
});
ncClass.globalEvents.addEventListener('rejected', function(ev:*):void
{
logToNet2(ev.instance, ev.command, ev.parameters, 'ncRejected');
});
ncClass.globalEvents.addEventListener('disconnected', function(ev:*):void
{
logToNet2(ev.instance, ev.command, ev.parameters, 'ncDisconnected');
});
ncClass.globalEvents.addEventListener('call', function(ev:*):void
{
//logToNet(ev.command+': rtmp call');
logToNet2(ev.instance, ev.command, ev.parameters, 'ncCall');
});
ncClass.globalEvents.addEventListener('close', function(ev:*):void
{
//logToNet(ev.command+': rtmp close');
logToNet2(ev.instance, ev.command, ev.parameters, 'ncClose');
});
var socketClass:* = injectedAppDomain.getDefinition('com.swfwire.debugger.injected.Socket');
Expand Down Expand Up @@ -1186,7 +1198,7 @@
systemLog.text += message+'\n';
}
private function logToNet(instance:URLLoader, url:String, state:String):void
private function logToNet(instance:URLLoader, url:String, parameters:Object, state:String):void
{
trace(url+': '+state);
Expand All @@ -1199,13 +1211,38 @@
}
data.url = url;
data.parameters = parameters;
data.state = state;
data.current = instance.bytesLoaded;
data.total = instance.bytesTotal;
netCollection.itemUpdated(data);
}
private function logToNet2(instance:NetConnection, url:String, parameters:Object, state:String):void
{
trace(url+': '+state);
var data:Object = netObjects[instance];
if(!data)
{
data = {};
netObjects[instance] = data;
netCollection.addItem(data);
}
if(state == 'ncConnect')
{
data.url = url;
data.parameters = debug.dumpToString(parameters);
}
data.state = state;
data.current = instance.connected ? 1 : 0;
data.total = 1;
netCollection.itemUpdated(data);
}
private function updateStatus(message:String):void
{
statusLabel.htmlText = message;
Expand Down Expand Up @@ -1702,9 +1739,10 @@
<mx:Spacer width="100%"/>
<mx:Button label="Clear" click="netListClear_clickHandler(event)"/>
</mx:HBox>
<mx:DataGrid id="netList" width="100%" height="100%" horizontalScrollPolicy="auto">
<mx:DataGrid id="netList" width="100%" height="100%" horizontalScrollPolicy="auto" variableRowHeight="true">
<mx:columns>
<mx:DataGridColumn headerText="URL" dataField="url" width="500"/>
<mx:DataGridColumn headerText="URL" dataField="url" width="400"/>
<mx:DataGridColumn headerText="Parameters" dataField="parameters" width="300"/>
<mx:DataGridColumn headerText="Progress" dataField="progress"
itemRenderer="com.swfwire.debugger.ui.NetProgressRenderer"/>
</mx:columns>
Expand Down
Expand Up @@ -36,13 +36,35 @@
progressBar.label = 'Closed (%1 bytes/%2 bytes)';
progressBar.indeterminate = false;
break;
case 'ncConnect':
progressBar.label = 'Connecting...';
progressBar.indeterminate = true;
break;
case 'ncConnected':
progressBar.label = 'Connected';
break;
case 'ncRejected':
progressBar.label = 'Rejected';
break;
case 'ncDisconnected':
progressBar.label = 'Disconnected';
break;
case 'ncCall':
progressBar.label = 'Calling...';
progressBar.indeterminate = true;
break;
case 'ncClose':
progressBar.label = 'Closed';
progressBar.indeterminate = false;
break;
default:
progressBar.label = 'Unknown';
progressBar.indeterminate = true;
break;
}
progressBar.indeterminate = false;
}
]]>
</fx:Script>
<mx:ProgressBar id="progressBar" left="4" right="4" verticalCenter="0" labelPlacement="center" label="" mode="manual"/>
</mx:Canvas>
</mx:Canvas>
Expand Up @@ -3,17 +3,58 @@ package com.swfwire.debugger.injected
import com.swfwire.debugger.injected.events.DynamicEvent;

import flash.events.EventDispatcher;
import flash.events.NetStatusEvent;
import flash.net.NetConnection;

public class NetConnection extends flash.net.NetConnection
{
public static var globalEvents:EventDispatcher = new EventDispatcher();

private static const CONNECTING:String = 'connecting';
private static const CONNECTED:String = 'connected';
private static const DISCONNECTED:String = 'disconnected';

private function netStatusHandler(ev:NetStatusEvent):void
{
var previousState:String = state;
state = connected ? CONNECTED : DISCONNECTED;

if(previousState != state)
{
if(previousState == CONNECTING)
{
if(state == CONNECTED)
{
globalEvents.dispatchEvent(new DynamicEvent('connected', {instance: this}));
}
else
{
globalEvents.dispatchEvent(new DynamicEvent('rejected', {instance: this}));
}
}
else if(previousState == CONNECTED)
{
globalEvents.dispatchEvent(new DynamicEvent('disconnected', {instance: this}));
}
}
previousConnected = connected;
}

private var previousConnected:Boolean;
private var state:String;

public function NetConnection():void
{
addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
super();
}

override public function connect(command:String, ...parameters):void
{
globalEvents.dispatchEvent(new DynamicEvent('connect', {command: command, parameters: parameters}));
globalEvents.dispatchEvent(new DynamicEvent('connect', {instance: this, command: command, parameters: parameters}));
var args:Array = parameters.slice();
args.unshift(command);
state = CONNECTING;
super.connect.apply(this, args);
}
}
Expand Down
Expand Up @@ -18,26 +18,30 @@ package com.swfwire.debugger.injected
public static var applicationRoot:String = '';
public static var referer:String = '';

private static var urlMap:Dictionary = new Dictionary(true);
private static var parameters:Dictionary = new Dictionary(true);

private static function openHandler(ev:Event):void
{
globalEvents.dispatchEvent(new DynamicEvent(ev.type, {instance: ev.currentTarget, url: urlMap[ev.currentTarget]}));
var params:Object = parameters[ev.currentTarget];
globalEvents.dispatchEvent(new DynamicEvent(ev.type, {instance: ev.currentTarget, url: params.url, data: params.data}));
}

private static function progressHandler(ev:ProgressEvent):void
{
globalEvents.dispatchEvent(new DynamicEvent(ev.type, {instance: ev.currentTarget, url: urlMap[ev.currentTarget]}));
var params:Object = parameters[ev.currentTarget];
globalEvents.dispatchEvent(new DynamicEvent(ev.type, {instance: ev.currentTarget, url: params.url, data: params.data}));
}

private static function completeHandler(ev:Event):void
{
globalEvents.dispatchEvent(new DynamicEvent(ev.type, {instance: ev.currentTarget, url: urlMap[ev.currentTarget]}));
var params:Object = parameters[ev.currentTarget];
globalEvents.dispatchEvent(new DynamicEvent(ev.type, {instance: ev.currentTarget, url: params.url, data: params.data}));
}

private static function errorHandler(ev:Event):void
{
globalEvents.dispatchEvent(new DynamicEvent(ev.type, {instance: ev.currentTarget, url: urlMap[ev.currentTarget]}));
var params:Object = parameters[ev.currentTarget];
globalEvents.dispatchEvent(new DynamicEvent(ev.type, {instance: ev.currentTarget, url: params.url, data: params.data}));
}

public function URLLoader(request:URLRequest = null)
Expand All @@ -53,7 +57,7 @@ package com.swfwire.debugger.injected

override public function load(request:URLRequest):void
{
urlMap[this] = request.url;
parameters[this] = {url: request.url, data: request.data};

if(request.url.indexOf('://') == -1)
{
Expand All @@ -62,14 +66,17 @@ package com.swfwire.debugger.injected
request.url = applicationRoot + request.url;
}

request.data;

request.requestHeaders.push(new URLRequestHeader('Referer', referer));

super.load(request);
}

override public function close():void
{
globalEvents.dispatchEvent(new DynamicEvent(Event.CLOSE, {instance: this, url: urlMap[this]}));
var params:Object = parameters[this];
globalEvents.dispatchEvent(new DynamicEvent(Event.CLOSE, {instance: this, url: params.url, data: params.data}));
super.close();
}
}
Expand Down
2 changes: 1 addition & 1 deletion SWFWireDecompiler/.actionScriptProperties
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="SWFDecompiler.as" projectUUID="945a2293-8429-4718-8bc6-4382fad2d536" version="10">
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="false" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="false" flexSDK="Flex 4.6.0" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="0">
<libraryPathEntry kind="4" path="">
Expand Down

This file was deleted.

5 changes: 3 additions & 2 deletions SWFWireInspector/.actionScriptProperties
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="SWFWireInspector.mxml" projectUUID="b5d22865-1552-45e8-9a41-4cbbdab141ae" version="10">
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="false" copyDependentFiles="true" flexSDK="Flex 4.5" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src/classes" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="false" copyDependentFiles="true" flexSDK="Flex 4.6.0" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src/classes" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compilerSourcePath>
<compilerSourcePathEntry kind="1" linkType="1" path="src/include"/>
</compilerSourcePath>
Expand All @@ -25,8 +25,9 @@
<flashCatalyst validateFlashCatalystCompatibility="false"/>
<buildTargets>
<buildTarget buildTargetName="default">
<airSettings airCertificatePath="F:/www/hobo.webhop.net/htdocs/workspaces/fb_i6_swfwire/swfwire.p12" airTimestamp="true" version="1">
<airSettings airCertificatePath="F:/www/hobo.webhop.net/htdocs/workspaces/fb_i6_swfwire/swfwire.p12" airTimestamp="true" anePathSet="false" version="1">
<airExcludes/>
<anePaths/>
</airSettings>
<actionScriptSettings version="1"/>
</buildTarget>
Expand Down
2 changes: 1 addition & 1 deletion SWFWireInspector/src/classes/SWFWireInspector-app.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<application xmlns="http://ns.adobe.com/air/application/2.6">
<application xmlns="http://ns.adobe.com/air/application/3.1">

<!-- Adobe AIR Application Descriptor File Template.
Expand Down

0 comments on commit 0f5ed6c

Please sign in to comment.