Beispiel #1
0
        public CastListEntry(ShockwaveReader input)
        {
            Name     = input.ReadString();
            FilePath = input.ReadString();

            PreloadSettings = input.ReadBigEndian <short>();
            MemberMin       = input.ReadBigEndian <short>();
            MemberCount     = input.ReadBigEndian <short>();

            Id = input.ReadBigEndian <int>();
        }
Beispiel #2
0
        public CastListEntry(ref ShockwaveReader input)
        {
            Name     = input.ReadString();
            FilePath = input.ReadString();

            PreloadSettings = input.ReadInt16();
            MemberMin       = input.ReadInt16();
            MemberCount     = input.ReadInt16();

            Id = input.ReadInt32();
        }
Beispiel #3
0
        public FileInfoChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            /*
             * def parseSubstrings(self, data, hasHeader=True):
             *  if hasHeader:
             *          ci_offset = read32(data)
             *          unk2 = read32(data) # not int!
             *          unk3 = read32(data) # not int!
             *          entryType = read32(data)
             *          data.seek(ci_offset)
             *  else:
             *          unk2 = 0
             *          unk3 = 0
             *          entryType = 0
             *
             *  count = read16(data) + 1
             *  entries = []
             *  for i in range(count):
             *          entries.append(read32(data))
             *  rawdata = data.read(entries[-1])
             *  assert entries[0] == 0
             *  assert entries[-1] == len(rawdata)
             *
             *  strings = []
             *  for i in range(count-1):
             *          strings.append(rawdata[entries[i]:entries[i+1]])
             *
             *  return (strings, unk2, unk3, entryType)
             *
             *
             * */

            BitField = input.ReadBytes(input.ReadInt32()).ToArray();

            Offsets = new List <int>(input.ReadInt16());

            input.ReadByte();

            for (short i = 0; i < Offsets.Capacity; i++)
            {
                Offsets.Add(input.ReadInt32());
            }

            input.ReadByte();
            CreatedBy = input.ReadString();
            input.ReadByte();
            ModifiedBy = input.ReadString();
            input.ReadByte();
            FilePath = input.ReadString();
        }
Beispiel #4
0
        public XtraListChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            Remnants.Enqueue(input.ReadInt32());

            int xtraCount = input.ReadInt32();

            for (int i = 0; i < xtraCount; i++)
            {
                long xtraEndOffset = input.Position + input.ReadInt32() + 4;

                int  unk2 = input.ReadInt32();
                int  unk3 = input.ReadInt32(); //Flags or just booleans?
                Guid guid = new Guid(input.ReadBytes(16));

                int[] offsets = new int[input.ReadInt16() + 1];
                for (int j = 0; j < offsets.Length; j++)
                {
                    offsets[j] = input.ReadInt32();
                }

                do
                {
                    byte unk4 = input.ReadByte(); // 1 when kind = URL
                    byte kind = input.ReadByte(); // 2 -> Name | 0 -> URL, 5 -> File, x32 ?!? no idea

                    string str = input.ReadString();
                    input.ReadByte();
                }while (input.Position != xtraEndOffset);
            }
        }
Beispiel #5
0
        public FileVersionChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            var unknown  = input.ReadBytes(3); // likely varints?
            var unknown2 = input.ReadBytes(2);

            Version = input.ReadString(); //TOOD: => DirectorVersion
        }
Beispiel #6
0
        public FileInfoChunk(ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            int bitfieldLen = input.ReadBigEndian <int>();

            BitField = input.ReadBytes(bitfieldLen);

            Offsets = new List <int>(input.ReadBigEndian <short>());

            input.ReadByte();

            for (short i = 0; i < Offsets.Capacity; i++)
            {
                Offsets.Add(input.ReadBigEndian <int>());
            }

            input.ReadByte();
            CreatedBy = input.ReadString();
            input.ReadByte();
            ModifiedBy = input.ReadString();
            input.ReadByte();
            FilePath = input.ReadString();
        }
Beispiel #7
0
        public FileInfoChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.IsBigEndian = true;

            //TODO: VList
            BitField = input.ReadBytes(input.ReadInt32()).ToArray();

            Offsets = new List <int>(input.ReadInt16());

            input.ReadByte();

            for (short i = 0; i < Offsets.Capacity; i++)
            {
                Offsets.Add(input.ReadInt32());
            }

            input.ReadByte();
            CreatedBy = input.ReadString();
            input.ReadByte();
            ModifiedBy = input.ReadString();
            input.ReadByte();
            FilePath = input.ReadString();
        }
Beispiel #8
0
        public StyledTextChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.IsBigEndian = true;

            input.ReadInt32();
            int textLength = input.ReadInt32();

            input.ReadInt32();

            Text = input.ReadString(textLength);

            Formattings = new TextFormat[input.ReadInt16()];
            for (int i = 0; i < Formattings.Length; i++)
            {
                Formattings[i] = new TextFormat(ref input);
            }
        }
Beispiel #9
0
        public NameTableChunk(ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            Remnants.Enqueue(input.ReadBigEndian <int>());
            Remnants.Enqueue(input.ReadBigEndian <int>());
            input.ReadBigEndian <int>();
            input.ReadBigEndian <int>();

            short nameOffset = input.ReadBigEndian <short>();

            Names = new List <string>(input.ReadBigEndian <short>());

            input.Position = Header.Offset + nameOffset;
            for (int i = 0; i < Names.Capacity; i++)
            {
                Names.Add(input.ReadString());
            }
        }
Beispiel #10
0
        public void ReadValue(ref ShockwaveReader input, int dataOffset)
        {
            if (Kind != LiteralKind.Integer)
            {
                input.Position = dataOffset + Offset;

                int length = input.ReadInt32();
                Value = Kind switch
                {
                    LiteralKind.String => input.ReadString(length),
                    LiteralKind.FloatingPoint => input.ReadDouble(),
                    LiteralKind.CompiledJavascript => input.ReadBytes(length).ToArray()
                };
            }
            else
            {
                Value = Offset;
            }
        }
        public VideoCastProperties(ShockwaveReader input)
        {
            Type            = input.ReadString((int)input.ReadBigEndian <uint>());
            input.Position += 10;

            byte videoFlags = input.ReadByte();

            Streaming = ((videoFlags & 1) == 1);

            videoFlags    = input.ReadByte();
            HasSound      = ((videoFlags & 1) == 1);
            PausedAtStart = ((videoFlags & 2) == 2);

            Flags           = (VideoCastFlags)input.ReadByte();
            input.Position += 3;
            Framerate       = input.ReadByte();
            input.Position += 32;
            Rectangle       = input.ReadRect();
        }
Beispiel #12
0
        public void ReadValue(ShockwaveReader input, long dataOffset)
        {
            if (Kind != LiteralKind.Integer)
            {
                input.Position = dataOffset + Offset;

                int length = input.ReadBigEndian <int>();
                Value = Kind switch
                {
                    LiteralKind.String => input.ReadString(length),
                    LiteralKind.Float => input.ReadBigEndian <long>(),
                    LiteralKind.CompiledJavascript => input.ReadBytes(length)
                };
            }
            else
            {
                Value = Offset;
            }
        }
Beispiel #13
0
        public VideoCastProperties(ref ShockwaveReader input)
        {
            //TODO: A lot of unknown values.
            Type = input.ReadString((int)input.ReadUInt32());
            input.Advance(10);

            byte videoFlags = input.ReadByte();

            Streaming = ((videoFlags & 1) == 1);

            videoFlags    = input.ReadByte();
            HasSound      = ((videoFlags & 1) == 1);
            PausedAtStart = ((videoFlags & 2) == 2);

            Flags = (VideoCastFlags)input.ReadByte();
            input.Advance(3);
            Framerate = input.ReadByte();
            input.Advance(32);
            Rectangle = input.ReadRect();
        }
        public LingoNameChunk(ref ShockwaveReader input, ChunkHeader header)
            : base(header)
        {
            input.IsBigEndian = true;

            Remnants.Enqueue(input.ReadInt32());
            Remnants.Enqueue(input.ReadInt32());
            input.ReadInt32();
            input.ReadInt32();

            short nameOffset = input.ReadInt16();

            Names = new List <string>(input.ReadInt16());

            input.Position = nameOffset;

            for (int i = 0; i < Names.Capacity; i++)
            {
                Names.Add(input.ReadString());
            }
        }
Beispiel #15
0
        public static LingoLiteral Read(ref ShockwaveReader input, LiteralKind entryKind, int entryOffset)
        {
            if (entryKind != LiteralKind.Integer)
            {
                input.Position = entryOffset;

                int    length = input.ReadInt32();
                object value  = entryKind switch
                {
                    LiteralKind.String => input.ReadString(length),
                    LiteralKind.FloatingPoint => input.ReadDouble(),
                    LiteralKind.CompiledJavascript => input.ReadBytes(length).ToArray(),

                    _ => throw new ArgumentException(nameof(Kind))
                };

                return(new LingoLiteral(entryKind, value));
            }
            else
            {
                return(new LingoLiteral(LiteralKind.Integer, entryOffset));
            }
        }
Beispiel #16
0
 public FileVersionChunk(ShockwaveReader input, ChunkHeader header)
     : base(header)
 {
     What    = input.ReadBytes(5);
     Version = input.ReadString();
 }
Beispiel #17
0
        private void ReadProperty(ref ShockwaveReader input, int index, int length)
        {
            switch (index)
            {
            case 0:
                ScriptText = input.ReadString(length);
                break;

            case 1:
                Name = input.ReadString();
                break;

            case 2:
                FilePath = input.ReadString(length);
                break;

            case 3:
                FileName = input.ReadString(length);
                break;

            case 4:
                FileType = input.ReadString(length);
                break;

            case 9:
                XtraGUID = new Guid(input.ReadBytes(length));
                //XtraGUID = input.Read<Guid>();
                break;

            case 10:
                XtraName = input.ReadNullString();
                break;

            case 11:     //TODO:
                break;

            case 12:
                RegistrationPoints = new int[length / 4];
                for (int i = 0; i < RegistrationPoints.Length; i++)
                {
                    RegistrationPoints[i] = input.ReadInt32();
                }
                break;

            case 16:
                ClipboardFormat = input.ReadString(length);
                break;

            case 17:
                CreationDate = input.ReadInt32() * 1000;
                break;

            case 18:
                ModifiedDate = input.ReadInt32() * 1000;
                break;

            case 19:
                ModifiedBy = input.ReadNullString();
                break;

            case 20:
                Comments = input.ReadString(length);
                break;

            case 21:
                ReadOnlySpan <byte> imageFlags = input.ReadBytes(length);    //4

                ImageCompression = imageFlags[0] >> 4;
                ImageQuality     = imageFlags[1];
                break;

            case 7:     //TODO:
            default:
                ReadOnlySpan <byte> unknown = input.ReadBytes(length);
                break;
            }
        }