SWFProcessing.SWFModeller.ABC.AbcCode.SetMethods C# (CSharp) Method

SetMethods() private method

Replaces the methods with a new set of methods
private SetMethods ( Method methods ) : void
methods Method An array of methods to set in the code.
return void
        internal void SetMethods(Method[] methods)
        {
            this.methods = new List<Method>();
            this.methods.AddRange(methods);
        }

Usage Example

Ejemplo n.º 1
0
        private void ReBuildTables(AbcCode code, string mainClassName)
        {
            /* These objects will keep track of the new IDs generated for all sorts of things... */

            this.intMarshal = new IDMarshaller<int>(0, 0);
            this.uintMarshal = new IDMarshaller<uint>(0, 0);
            this.stringMarshal = new IDMarshaller<string>(0, ABCValues.AnyName);
            this.doubleMarshal = new IDMarshaller<ulong>(0, 0L);
            this.nsMarshal = new IDMarshaller<Namespace>(0, Namespace.GlobalNS);
            this.nsSetMarshal = new IDMarshaller<NamespaceSet>(0, NamespaceSet.EmptySet);
            this.multinameMarshal = new IDMarshaller<Multiname>(0, Multiname.GlobalMultiname);
            this.classMarshal = new IDMarshaller<AS3ClassDef>(0);
            this.methodMarshal = new IDMarshaller<Method>(0);

            AS3ClassDef mainClass = null;
            foreach (AS3ClassDef clazz in code.Classes)
            {
                if (clazz.Name.QualifiedName == mainClassName && mainClassName != null)
                {
                    /* To make sure the main class is last.
                     *
                     * Note that we do this out of paranoia and observation, not out of
                     * any kind of understanding that it's necessary. As far as I know, it
                     * probably doesn't matter.
                     *
                     * Note that even without the check for the main class, we'd still need to take
                     * all the classes and register them in the marshal.
                     */
                    mainClass = clazz;
                }
                else
                {
                    this.classMarshal.Register(clazz);
                }
            }

            if (mainClass != null)
            {
                this.classMarshal.Register(mainClass);
            }

            code.SetClasses(this.classMarshal.ToArray());

            foreach (AS3ClassDef clazz in code.Classes)
            {
                this.ProcessClass(clazz);
            }

            foreach (Script s in code.Scripts)
            {
                this.AssembleMethod(s.Method);
                using (IEnumerator<Trait> i = s.Traits)
                {
                    while (i.MoveNext())
                    {
                        this.ProcessTrait(i.Current);
                    }
                }
            }

            code.SetMethods(this.methodMarshal.ToArray());
        }