Пример #1
0
 public void StartClass(string name,
                        AccessSpecifier specifier,
                        ClassFlags flags            = ClassFlags.None,
                        IList <string>?superClasses = null)
 {
     Write(ToString(specifier));
     if (flags.HasFlag(ClassFlags.Partial))
     {
         Write(" partial");
     }
     if (flags.HasFlag(ClassFlags.Static))
     {
         Write(" static");
     }
     WriteLine(" class {0}", name);
     if ((superClasses != null) && (superClasses.Count > 0))
     {
         Indent();
         Write(": {0}", superClasses[0]);
         for (int i = 1; i < superClasses.Count; i++)
         {
             Write(" , {0}", superClasses[i]);
         }
         WriteLine();
         UnIndent();
     }
     StartBlock();
 }
Пример #2
0
        public ASInstance(ABCFile abc, FlashReader reader)
            : this(abc)
        {
            TypeIndex      = reader.Read7BitEncodedInt();
            SuperTypeIndex = reader.Read7BitEncodedInt();
            ClassInfo      = (ClassFlags)reader.ReadByte();

            if ((ClassInfo & ClassFlags.ProtectedNamespace) != 0)
            {
                ProtectedNamespaceIndex = reader.Read7BitEncodedInt();
            }

            InterfaceIndices.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < InterfaceIndices.Capacity; i++)
            {
                InterfaceIndices.Add(reader.Read7BitEncodedInt());
            }

            ConstructorIndex = reader.Read7BitEncodedInt();
            if (Constructor != null)
            {
                Constructor.IsConstructor = true;
            }

            Traits.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < Traits.Capacity; i++)
            {
                Traits.Add(new ASTrait(abc, reader));
            }
        }
Пример #3
0
 private void SetFlag(ClassFlags f, bool value)
 {
     if (value)
     {
         _flags |= f;
     }
     else
     {
         _flags &= ~f;
     }
 }
Пример #4
0
        public override bool Deserialize()
        {
            var result = base.Deserialize();

            ClassFlags = (ClassFlags)Data.ReadInt32();

            _OuterClassIndex = Data.ReadInt32();
            ConfigNameIndex = Data.ReadInt32();

            InterfaceCount = Data.ReadInt32();
            for (int i = 0; i < InterfaceCount; i++)
            {
                var interfaceRef = new InterfaceMapEntry();
                interfaceRef.ClassIndex = Data.ReadInt32();
                interfaceRef.PropertyPointer = Data.ReadInt32();
                _ImplInterfaces.Add(interfaceRef);
            }

            ComponentCount = Data.ReadInt32();
            for (int i = 0; i < ComponentCount; i++)
            {
                var componentRef = new ComponentMapEntry();
                componentRef.NameRef = Data.ReadNameRef();
                componentRef.ComponentObjectIndex = Data.ReadInt32();
                _Components.Add(componentRef);
            }

            DLLBindIndex = Data.ReadInt32();

            _unkn1 = Data.ReadInt32();
            _unkn2 = Data.ReadInt32();
            _unkn3 = Data.ReadInt32();
            DefaultPropertyIndex = Data.ReadInt32();

            FunctionRefCount = Data.ReadInt32();
            for (int i = 0; i < FunctionRefCount; i++)
            {
                _FunctionRefs.Add(Data.ReadInt32());
            }

            return result;
        }
Пример #5
0
        public override bool Deserialize()
        {
            var result = base.Deserialize();

            ClassFlags = (ClassFlags)Data.ReadInt32();

            _OuterClassIndex = Data.ReadInt32();
            ConfigNameIndex  = Data.ReadInt32();

            InterfaceCount = Data.ReadInt32();
            for (int i = 0; i < InterfaceCount; i++)
            {
                var interfaceRef = new InterfaceMapEntry();
                interfaceRef.ClassIndex      = Data.ReadInt32();
                interfaceRef.PropertyPointer = Data.ReadInt32();
                _ImplInterfaces.Add(interfaceRef);
            }

            ComponentCount = Data.ReadInt32();
            for (int i = 0; i < ComponentCount; i++)
            {
                var componentRef = new ComponentMapEntry();
                componentRef.NameRef = Data.ReadNameRef();
                componentRef.ComponentObjectIndex = Data.ReadInt32();
                _Components.Add(componentRef);
            }

            DLLBindIndex = Data.ReadInt32();

            _unkn1 = Data.ReadInt32();
            _unkn2 = Data.ReadInt32();
            _unkn3 = Data.ReadInt32();
            DefaultPropertyIndex = Data.ReadInt32();

            FunctionRefCount = Data.ReadInt32();
            for (int i = 0; i < FunctionRefCount; i++)
            {
                _FunctionRefs.Add(Data.ReadInt32());
            }

            return(result);
        }
Пример #6
0
        public ASInstance(ABCFile abc, FlashReader reader)
            : this(abc)
        {
            TypeIndex = reader.Read7BitEncodedInt();
            SuperTypeIndex = reader.Read7BitEncodedInt();
            ClassInfo = (ClassFlags)reader.ReadByte();

            if ((ClassInfo & ClassFlags.ProtectedNamespace) != 0)
                ProtectedNamespaceIndex = reader.Read7BitEncodedInt();

            InterfaceIndices.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < InterfaceIndices.Capacity; i++)
                InterfaceIndices.Add(reader.Read7BitEncodedInt());

            ConstructorIndex = reader.Read7BitEncodedInt();
            if (Constructor != null) Constructor.IsConstructor = true;

            Traits.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < Traits.Capacity; i++)
                Traits.Add(new ASTrait(abc, reader));
        }
Пример #7
0
        public ASInstance(ABCFile abc, FlashReader reader)
        {
            _abc = abc;

            NameIndex = reader.Read7BitEncodedInt();
            SuperNameIndex = reader.Read7BitEncodedInt();
            ClassInfo = (ClassFlags)reader.ReadByte();

            if ((ClassInfo & ClassFlags.ProtectedNamespace) != 0)
                ProtectedNamespaceIndex = reader.Read7BitEncodedInt();

            InterfaceIndices = new List<int>(reader.Read7BitEncodedInt());
            for (int i = 0; i < InterfaceIndices.Capacity; i++)
                InterfaceIndices.Add(reader.Read7BitEncodedInt());

            ConstructorIndex = reader.Read7BitEncodedInt();
            Traits = new List<ASTrait>(reader.Read7BitEncodedInt());

            for (int i = 0; i < Traits.Capacity; i++)
                Traits.Add(new ASTrait(abc, reader));
        }
 public bool HasClassFlag(ClassFlags flag)
 {
     return((ClassFlags & (uint)flag) != 0);
 }
Пример #9
0
			public bool HasClassFlag(ClassFlags flag)
			{
				if (Class.Contains(flag.ToString()))
					return true;
				return false;
				//if ((Class & flag) == flag) return true;
				//return false;
			}
Пример #10
0
 public ClassFlagsMapAttribute(ClassFlags flags = ClassFlags.None)
 {
     Flags = flags;
 }
Пример #11
0
        public static bool IsNativeClass(TypeDefinition type)
        {
            ClassFlags classFlags = (ClassFlags)MetadataBase.GatherFlags(type, "ClassFlagsMapAttribute");

            return(0 != (classFlags & ClassFlags.Native));
        }
Пример #12
0
 public bool HasClassFlag( ClassFlags flag )
 {
     return (ClassFlags & (uint)flag) != 0;
 }