Menu

[r11]: / trunk / SWFInvestigator / src / decompiler / ABCXML.as  Maximize  Restore  History

Download this file

89 lines (78 with data), 2.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/****************************************************************************
* ADOBE SYSTEMS INCORPORATED
* Copyright 2012 Adobe Systems Incorporated and it’s licensors
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file
* in accordance with the terms of the license agreement accompanying it.
* ****************************************************************************/
package decompiler
{
import mx.collections.XMLListCollection;
/**
* This manages the XML representation of the SWF for AS3Navigator
*/
public class ABCXML
{
[Bindable]
public var abcXML:XML;
[Bindable]
public var abcData:XMLListCollection;
/**
* Constructor -- Create the default abcXML definition
*/
public function ABCXML()
{
this.abcXML =
<list>
<pckg name="(default)" type="pckg"/>
</list>;
}
/**
* Used by the Navigator to get the name for a particular item.
*
* @param item The Object sent by the Tree label function to be cast as XML
* @return A string representing the node's name.
*/
public function abcTreeLabel(item:Object):String {
var node:XML = XML(item);
return node.@name;
}
/**
* Add a Class to the specified package
*
* @param packageName The string containing the package that will be updated
* @param className The string containing the name of the new class
* @param classData The string containing the decompiled code for the class
*/
public function addClass(packageName:String,className:String,classData:String):void {
var newNode:XML = <class type="class"/>;
newNode.@name = className;
newNode.@data = classData;
var pckg:XMLList = this.abcXML.pckg.(@name == packageName);
if (pckg.length() > 0) {
pckg[0].appendChild(newNode);
}
}
/**
* Add a package level element to the tree
*
* @param packageName The string containing the package name.
*/
public function addPackage(packageName:String):void {
var pckg:XMLList = this.abcXML.pckg.(@name == packageName);
if (pckg.length() > 0) {
return;
}
var newNode:XML = <pckg type="pckg"/>
newNode.@name = packageName;
this.abcXML.appendChild(newNode);
}
/**
* Create an XMLListCollection to host the ABC data
*/
public function createCollection():void {
this.abcData = new XMLListCollection(this.abcXML.pckg)
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.