C# Class SWFProcessing.SWFModeller.ABC.AbcCode

Represents parsed ABC bytecode, and all that it contains.
Show file Open project: WeeWorld/Swiffotron Class Usage Examples

Public Methods

Method Description
AbcCode ( ) : System

Initializes a new instance of the AbcCode class.

AddClass ( AS3ClassDef c ) : void

Adds a class to the code.

AddMetadata ( string group, string key, string value ) : void

Add some metadata to this bytecode block.

AddMultiname ( Multiname mn ) : void

Adds a multiname to the code.

AddNamespaceSet ( NamespaceSet set ) : void

Adds a set to the code.

GenerateClipClassBindingScript ( Sprite spr ) : void

Generates a script that binds a class to a clip.

GetClass ( int idx ) : AS3ClassDef

Gets a class from a class index.

GetNamespaceSet ( int idx ) : NamespaceSet

Gets a set from a set index.

MethodProc ( MethodProcessor mp ) : void

Run code on all methods in this code

Private Methods

Method Description
AddNamespace ( Namespace ns ) : void
AddScript ( Script s ) : void

Adds a script to the code.

CreateClass ( ) : AS3ClassDef
CreateMethod ( string sourceFile, uint maxStack, uint localCount, uint initScopeDepth, uint maxScopeDepth ) : Method
CreateMultiname ( Multiname kind, string name, Namespace ns, NamespaceSet set ) : Multiname
CreateNamespace ( Namespace kind, string name, string prefix = null ) : Namespace
CreateNamespaceSet ( Namespace nsRefs ) : NamespaceSet
Disassemble ( ) : void

When reading code, references to things like functions and methods are all done with indices into arrays. This is a bit restrictive, so after the code is loaded, a call to this will transform all the code to use object references. E.g a reference to constant string number 7, will become a string obejct. This is a first step towards merging abc files together.

GetClassByQName ( string className ) : AS3ClassDef
GetMetadata ( string key ) : string>.Dictionary

Gets the metadata associated with a key

GetMethod ( int idx ) : Method

Gets a method at a given index

GetMultiname ( int idx ) : Multiname
GetNamespace ( int idx ) : Namespace
MarkCodeAsTampered ( ) : void

At first glance, this does the same as Disassemble(). The difference is that merely disassembling the code doesn't clear out the bytecode that was disassembled. Marking code as tampered disassembles it and then discards the source bytecode, forcing it to require reassembly.

Op ( Opcode mnemonic ) : Opcode

Technically, from an OO perspective, this isn't the most logical place for this method. It's a factory method for opcodes used when building up new methods, bytecode by bytecode. It's here because this is the place that makes calling it require the least typing, which is good when you're creating lists of loads of these things.

SetClasses ( AS3ClassDef as3Classes ) : void

Replaces the classes with a new set of classes

SetDoubleCount ( uint count ) : void

Creates a new, sized double constant array

SetIntCount ( uint count ) : void

Creates a new, sized integer constant array

SetMethods ( Method methods ) : void

Replaces the methods with a new set of methods

SetMultinames ( Multiname multinames ) : void
SetNamespaceSets ( NamespaceSet sets ) : void
SetNamespaces ( Namespace namespaces ) : void
SetStringCount ( uint count ) : void

Creates a new, sized string constant array

SetUintCount ( uint count ) : void

Creates a new, sized unsigned integer constant array

ToStringModelView ( int nest, StringBuilder sb ) : void

Method Details

AbcCode() public method

Initializes a new instance of the AbcCode class.
public AbcCode ( ) : System
return System

AddClass() public method

Adds a class to the code.
public AddClass ( AS3ClassDef c ) : void
c AS3ClassDef The class to add.
return void

AddMetadata() public method

Add some metadata to this bytecode block.
public AddMetadata ( string group, string key, string value ) : void
group string Data group name
key string Data key name
value string The data value
return void

AddMultiname() public method

Adds a multiname to the code.
public AddMultiname ( Multiname mn ) : void
mn Multiname The multiname to add.
return void

AddNamespaceSet() public method

Adds a set to the code.
public AddNamespaceSet ( NamespaceSet set ) : void
set NamespaceSet The set to add.
return void

GenerateClipClassBindingScript() public method

Generates a script that binds a class to a clip.
public GenerateClipClassBindingScript ( Sprite spr ) : void
spr SWFProcessing.SWFModeller.Characters.Sprite The sprite to create the class for.
return void

GetClass() public method

Gets a class from a class index.
public GetClass ( int idx ) : AS3ClassDef
idx int The index of the class, usually found as a parameter /// on some ABC opcode.
return AS3ClassDef

GetNamespaceSet() public method

Gets a set from a set index.
public GetNamespaceSet ( int idx ) : NamespaceSet
idx int The index of the set, usually found as a parameter /// on some ABC opcode.
return NamespaceSet

MethodProc() public method

Run code on all methods in this code
public MethodProc ( MethodProcessor mp ) : void
mp MethodProcessor A delegate to run on each method.
return void