Esempio n. 1
0
            public void Read(SwfReader reader)
            {
                SlotId = (int)reader.ReadUIntEncoded();    //slot_id
                int index = (int)reader.ReadUIntEncoded(); //classi

                Class = reader.ABC.Classes[index];
            }
Esempio n. 2
0
 public AbcInstance(bool withClass)
     : this()
 {
     if (withClass)
     {
         Class = new AbcClass();
     }
 }
Esempio n. 3
0
 public static AbcTrait CreateClass(AbcClass klass)
 {
     return(new AbcTrait(AbcTraitKind.Class)
     {
         Name = klass.Instance.Name,
         Class = klass
     });
 }
Esempio n. 4
0
        private AbcInstance ImportInstanceCore(AbcInstance source, ref AbcMethod importMethod)
        {
            var instance = new AbcInstance
            {
                Name         = ImportConst(source.Name),
                IsMixin      = source.IsMixin,
                IsStyleMixin = source.IsStyleMixin,
                ImportedFrom = source
            };

            source.ImportedInstance = instance;

            var klass = new AbcClass(instance);

            AddInstance(instance);

            AbcInstance superType;

            instance.BaseTypeName       = ImportType(source.BaseTypeName, out superType);
            instance.BaseInstance       = superType;
            instance.Flags              = source.Flags;
            instance.ProtectedNamespace = ImportConst(source.ProtectedNamespace);
            instance.Type = source.Type;

            if (instance.Type != null)
            {
                SetData(instance.Type, instance);
            }

            foreach (var iname in source.Interfaces)
            {
                AbcInstance ifaceInstance;
                var         mn = ImportType(iname, out ifaceInstance);
                if (mn == null)
                {
                    throw new InvalidOperationException();
                }
                //NOTE: Flex Compiler Bug!!!
                //I found that within SWC files interface names must be always declared as multinames (with namespace set)
                //This is true for flex 3.
                if (IsSwcScript)
                {
                    mn = ToMultiname(mn);
                }
                instance.Interfaces.Add(mn);
                if (ifaceInstance != null)
                {
                    ifaceInstance.Implementations.Add(instance);
                    instance.Implements.Add(ifaceInstance);
                }
            }

            instance.Initializer = ImportMethod(source.Initializer);
            klass.Initializer    = ImportMethod(source.Class.Initializer);

            if (importMethod == source.Initializer)
            {
                importMethod = instance.Initializer;
            }

            if (importMethod == source.Class.Initializer)
            {
                importMethod = klass.Initializer;
            }

            ImportTraits(source, instance, ref importMethod);
            ImportTraits(source.Class, klass, ref importMethod);

            return(instance);
        }
Esempio n. 5
0
 /// <summary>
 /// Determines whether the given <see cref="AbcClass"/> is defined in this ABC file.
 /// </summary>
 /// <param name="klass">class to check</param>
 /// <returns></returns>
 public bool IsDefined(AbcClass klass)
 {
     return(Classes.IsDefined(klass));
 }
Esempio n. 6
0
 public void AddClass(AbcClass klass)
 {
     Add(AbcTrait.CreateClass(klass));
 }