Esempio n. 1
0
 public DefineFontNameTag(FlashReader reader, TagRecord header) :
     base(reader, header)
 {
     FontId = reader.ReadUInt16();
     FontName = reader.ReadNullTerminatedString();
     FontCopyright = reader.ReadNullTerminatedString();
 }
Esempio n. 2
0
        public DefineBinaryDataTag(FlashReader reader, TagRecord header)
            : base(reader, header)
        {
            CharacterId = reader.ReadUInt16();
            reader.ReadUInt32();

            BinaryData = reader.ReadBytes(header.Body.Length - 6);
        }
Esempio n. 3
0
        public SymbolClassTag(FlashReader reader, TagRecord header) :
            base(reader, header)
        {
            int symbolCount = reader.ReadUInt16();
            Symbols = new Dictionary<ushort, string>(symbolCount);

            for (int i = 0; i < symbolCount; i++)
            {
                ushort characterId = reader.ReadUInt16();
                string symbolName = reader.ReadNullTerminatedString();

                if (Symbols.ContainsKey(characterId))
                {
                    symbolName =
                        $"{Symbols[characterId]},{symbolName}";
                }
                Symbols[characterId] = symbolName;
            }
        }
Esempio n. 4
0
        public ExportAssetsTag(FlashReader reader, TagRecord header) :
            base(reader, header)
        {
            int count = reader.ReadUInt16();
            Assets = new Dictionary<ushort, string>(count);

            for (int i = 0; i < count; i++)
            {
                ushort tag = reader.ReadUInt16();
                string name = reader.ReadNullTerminatedString();

                if (Assets.ContainsKey(tag))
                {
                    throw new Exception(
                        "Duplicate tag id: " + tag);
                }
                Assets[tag] = name;
            }
        }
        public DefineBitsLossless2Tag(FlashReader reader, TagRecord header) :
            base(reader, header)
        {
            CharacterId = reader.ReadUInt16();
            BitmapFormat = reader.ReadByte();
            BitmapWidth = reader.ReadUInt16();
            BitmapHeight = reader.ReadUInt16();

            _isCompressed = true;
            switch (BitmapFormat - 3)
            {
                case 0: break;

                case 1:
                case 2:
                {
                    _compressedBitmapData =
                        reader.ReadBytes(header.Body.Length - 7);

                    break;
                }
            }
        }
Esempio n. 6
0
        public ABCFile(FlashReader reader)
        {
            _reader = reader;

            MinorVersion = _reader.ReadUInt16();
            MajorVersion = _reader.ReadUInt16();

            Constants = new ASConstants(this, _reader);
            Constants.ReadConstants();

            Methods = new List<ASMethod>(_reader.Read7BitEncodedInt());
            for (int i = 0; i < Methods.Capacity; i++)
                Methods.Add(new ASMethod(this, _reader));

            Metadata = new List<ASMetadata>(_reader.Read7BitEncodedInt());
            for (int i = 0; i < Metadata.Capacity; i++)
                Metadata.Add(new ASMetadata(this, _reader));

            Instances = new List<ASInstance>(_reader.Read7BitEncodedInt());
            for (int i = 0; i < Instances.Capacity; i++)
                Instances.Add(new ASInstance(this, _reader));

            Classes = new List<ASClass>(Instances.Capacity);
            for (int i = 0; i < Classes.Capacity; i++)
            {
                Classes.Add(new ASClass(this, _reader));
                Classes[i].Instance = Instances[i];
            }

            Scripts = new List<ASScript>(_reader.Read7BitEncodedInt());
            for (int i = 0; i < Scripts.Capacity; i++)
                Scripts.Add(new ASScript(this, _reader));

            MethodBodies = new List<ASMethodBody>(_reader.Read7BitEncodedInt());
            for (int i = 0; i < MethodBodies.Capacity; i++)
                MethodBodies.Add(new ASMethodBody(this, _reader));
        }
Esempio n. 7
0
        public TagRecord(FlashReader reader)
        {
            Start = reader.Position;

            ushort header = reader.ReadUInt16();
            TagType = (FlashTagType)(header >> 6);

            int length = (header & 63);
            if (length >= 63)
            {
                length = reader.ReadInt32();
                IsSpecialLong = (length < 63);
            }
            BodyStart = reader.Position;

            Body = reader.ReadBytes(length);
            reader.Position = BodyStart;
        }
Esempio n. 8
0
 public ScriptLimitsTag(FlashReader reader, TagRecord header) :
     base(reader, header)
 {
     MaxRecursionDepth = reader.ReadUInt16();
     ScriptTimeoutSeconds = reader.ReadUInt16();
 }