示例#1
0
 public override void WriteTo(ShockwaveWriter output)
 {
     output.WriteBigEndian(Unknown);
     output.WriteBigEndian(Id);
     output.WriteBigEndian(Flags);
     output.WriteBigEndian(Link);
 }
示例#2
0
        public override void WriteBodyTo(ShockwaveWriter output)
        {
            const short HEADER_LENGTH = 92;

            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());

            output.WriteBigEndian(HEADER_LENGTH + Pool.GetBodySize());
            output.WriteBigEndian(HEADER_LENGTH + Pool.GetBodySize());

            output.WriteBigEndian(HEADER_LENGTH);
            output.WriteBigEndian(ScriptNumber);

            output.WriteBigEndian((short)Remnants.Dequeue());
            output.Write((int)Remnants.Dequeue());
            output.Write((int)Remnants.Dequeue());
            output.Write((int)Remnants.Dequeue());
            output.Write((int)Remnants.Dequeue());

            output.WriteBigEndian(BehaviourScript);

            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());

            output.Write((short)Remnants.Dequeue());

            Pool.WriteTo(output);
        }
        public override void WriteTo(ShockwaveWriter output)
        {
            output.WriteBigEndian(21); //TODO: "compress"

            int currentOffset = 0;

            int[] propertyOffsets = new int[22];

            output.Position += 22 * sizeof(int);

            for (int i = 0; i < 22; i++)
            {
                propertyOffsets[i] = currentOffset;
                WriteProperty(output, i, ref currentOffset);
            }

            output.Position -= 22 * sizeof(int);
            output.Position -= currentOffset;

            for (int i = 0; i < 22; i++)
            {
                output.WriteBigEndian(propertyOffsets[i]);
            }

            output.Position += currentOffset; //We are finished here, go to end
        }
示例#4
0
        public override void WriteTo(ShockwaveWriter output)
        {
            //TODO:

            byte op = (byte)OP;

            if (Value > byte.MaxValue)
            {
                op += 0x40;
            }

            if (Value > short.MaxValue)
            {
                op += 0x40;
            }

            output.Write(op);

            if (op > 0xC0)
            {
                output.WriteBigEndian(Value);
            }
            else if (op > 0x80)
            {
                output.WriteBigEndian((short)Value);
            }
            else if (op > 0x40)
            {
                output.Write((byte)Value);
            }
        }
示例#5
0
        public void WriteTo(ShockwaveWriter output)
        {
            output.WriteBigEndian((ushort)TotalWidth | 0x8000);

            output.Write(Rectangle);
            output.Write(AlphaThreshold);
            output.Write(OLE);

            output.WriteBigEndian((short)RegistrationPoint.X);
            output.WriteBigEndian((short)RegistrationPoint.Y);

            output.Write((byte)Flags);

            if (BitDepth == 1)
            {
                return;
            }
            output.Write(BitDepth);

            if (Palette != 0)
            {
                return;
            }
            if (!IsSystemPalette)
            {
                Palette |= 0x8000;
            }
            output.WriteBigEndian(Palette);
        }
示例#6
0
 public override void WriteTo(ShockwaveWriter output)
 {
     throw new NotImplementedException();
     output.WriteBigEndian(StartFrame);
     output.WriteBigEndian(EndFrame);
     output.WriteBigEndian(0);
     output.WriteBigEndian(Channel);
     output.WriteBigEndian(SpritePropertiesOffsetsOffset);
 }
示例#7
0
 public override void WriteTo(ShockwaveWriter output)
 {
     output.Write(Name);
     output.Write(FilePath);
     output.WriteBigEndian(PreloadSettings);
     output.WriteBigEndian(MemberMin);
     output.WriteBigEndian(MemberCount);
     output.WriteBigEndian(Id);
 }
示例#8
0
 public override void WriteTo(ShockwaveWriter output)
 {
     output.WriteBigEndian(Offset);
     output.WriteBigEndian(Height);
     output.WriteBigEndian(Ascent);
     output.WriteBigEndian(FontId);
     output.Write(Slant);
     output.Write(Padding);
     output.WriteBigEndian(FontSize);
     output.Write(Color);
 }
示例#9
0
        public void WriteTo(ShockwaveWriter output)
        {
            throw new NotImplementedException(nameof(TextCastProperties));
            output.WriteBigEndian((short)Alignment);
            output.Write(BackgroundColor);

            output.WriteBigEndian(Font);
            output.Write(Rectangle);
            output.WriteBigEndian(LineHeight);

            output.WriteBigEndian(ButtonType);
        }
示例#10
0
        public override void WriteBodyTo(ShockwaveWriter output)
        {
            output.WriteBigEndian(BitField.Length);
            output.Write(BitField);

            output.WriteBigEndian((ushort)Offsets.Count);
            for (int i = 0; i < Offsets.Count; i++)
            {
                output.WriteBigEndian(Offsets[i]);
            }
            //TODO
        }
示例#11
0
        public void WriteTo(ShockwaveWriter output)
        {
            output.WriteBigEndian((short)Type);
            output.Write(Rectangle);

            output.WriteBigEndian(Pattern);
            output.Write(ForegroundColor);
            output.Write(BackgroundColor);

            output.Write(IsFilled);
            output.Write(LineSize);
            output.Write(LineDirection);
        }
示例#12
0
 public override void WriteBodyTo(ShockwaveWriter output)
 {
     for (int i = 0; i < Members.Length; i++)
     {
         output.WriteBigEndian(Members[i]);
     }
 }
示例#13
0
        public override void WriteBodyTo(ShockwaveWriter output)
        {
            const int TEXT_OFFSET      = 12; //I guess
            const int TEXT_FORMAT_SIZE = 20;

            output.WriteBigEndian(TEXT_OFFSET);
            output.WriteBigEndian(Text.Length);
            output.WriteBigEndian(sizeof(short) + (Formattings.Length * TEXT_FORMAT_SIZE));

            output.Write(Text.ToCharArray());

            output.WriteBigEndian((short)(Formattings?.Length ?? 0));
            for (int i = 0; i < Formattings?.Length; i++)
            {
                Formattings[i].WriteTo(output);
            }
        }
示例#14
0
        public override void WriteTo(ShockwaveWriter output)
        {
            output.WriteBigEndian(NameIndex);
            output.WriteBigEndian((short)HandlerVectorPosition);

            output.WriteBigEndian(Body.Code.Length);
            output.WriteBigEndian(0);

            output.WriteBigEndian((short)Arguments.Capacity);
            output.WriteBigEndian(0);

            output.WriteBigEndian((short)Locals.Capacity);
            output.WriteBigEndian(0);
        }
示例#15
0
        public override void WriteBodyTo(ShockwaveWriter output)
        {
            output.WriteBigEndian((int)Type);
            output.WriteBigEndian(Common.GetBodySize()); //TODO:
            output.WriteBigEndian(Properties.GetBodySize());

            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());

            Common.WriteTo(output); //TODO:
            Properties.WriteTo(output);
        }
示例#16
0
        public override void WriteBodyTo(ShockwaveWriter output)
        {
            const short ENTRY_OFFSET = 24;
            const short UNKNOWN      = 8;

            output.WriteBigEndian(0);
            output.WriteBigEndian(0);

            output.WriteBigEndian(Entries.Count);
            output.WriteBigEndian(Entries.Count);

            output.WriteBigEndian(ENTRY_OFFSET);
            output.WriteBigEndian(UNKNOWN);

            output.WriteBigEndian((int)Remnants.Dequeue());
            foreach (var entry in Entries)
            {
                output.WriteBigEndian(entry.Key);
                output.WriteBigEndian(entry.Value);
            }
        }
        public override void WriteBodyTo(ShockwaveWriter output)
        {
            output.WriteBigEndian(CompressionTypeId);
            output.WriteBigEndian(ImageQuality);
            output.WriteBigEndian(ImageTypes);
            output.WriteBigEndian(DirTypes);
            output.WriteBigEndian(CompressionLevel);
            output.WriteBigEndian(Speed);

            if (CompressionTypeId == 256)
            {
                output.WriteNullString(Name);
            }
        }
示例#18
0
        public override void WriteBodyTo(ShockwaveWriter output)
        {
            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());

            output.WriteBigEndian(Entries.Count);

            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());

            for (int i = 0; i < Entries.Count; i++)
            {
                output.WriteBigEndian(Entries[i]);
            }
        }
示例#19
0
        public override void WriteBodyTo(ShockwaveWriter output)
        {
            const short NAME_OFFSET = 20;
            int         namesLength = Names?.Sum(n => sizeof(byte) + n.Length) ?? 0;

            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian(namesLength);
            output.WriteBigEndian(namesLength);
            output.WriteBigEndian(NAME_OFFSET);
            output.WriteBigEndian((short)Names.Count);

            foreach (string name in Names)
            {
                output.Write(name);
            }
        }
示例#20
0
        public override void WriteBodyTo(ShockwaveWriter output)
        {
            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian(Entries.Count);
            output.WriteBigEndian((int)Remnants.Dequeue());

            output.WriteBigEndian(Unknowns.Length);
            for (int i = 0; i < Remnants.Count; i++)
            {
                output.WriteBigEndian(Unknowns[i]);
            }

            output.WriteBigEndian(ENTRY_SIZE);
            for (int i = 0; i < Entries.Count; i++)
            {
                Entries[i].WriteTo(output);
            }
        }
示例#21
0
        private void WriteProperty(ShockwaveWriter output, int index, ref int endOffset)
        {
            //TODO: Better checks & possibly "compression"?
            switch (index)
            {
            case 0 when !string.IsNullOrEmpty(ScriptText):
                output.Write(ScriptText.ToCharArray());
                endOffset += ScriptText.Length;
                break;

            case 1 when !string.IsNullOrEmpty(Name):
                output.Write(Name);
                endOffset += Name.Length + 1;
                break;

            case 2 when !string.IsNullOrEmpty(FilePath):
                output.Write(FilePath.ToCharArray());
                endOffset += FilePath.Length;
                break;

            case 3 when !string.IsNullOrEmpty(FileName):
                output.Write(FileName.ToCharArray());
                endOffset += FileName.Length;
                break;

            case 4 when !string.IsNullOrEmpty(FileType):
                output.Write(FileType.ToCharArray());
                endOffset += FileType.Length;
                break;

            case 9 when XtraGUID != null:
                output.Write(XtraGUID.ToByteArray());
                endOffset += 16;
                break;

            case 10 when !string.IsNullOrEmpty(XtraName):
                output.WriteNullString(XtraName);
                endOffset += XtraName.Length + 1;
                break;

            case 12 when RegistrationPoints != null:
                for (int i = 0; i < RegistrationPoints.Length; i++)
                {
                    output.WriteBigEndian(RegistrationPoints[i]);
                    endOffset += sizeof(int);
                }
                break;

            case 16 when !string.IsNullOrEmpty(ClipboardFormat):
                output.Write(ClipboardFormat.ToCharArray());
                endOffset += ClipboardFormat.Length;
                break;

            case 17 when CreationDate != 0:
                output.WriteBigEndian(CreationDate / 1000);
                endOffset += sizeof(int);
                break;

            case 18 when ModifiedDate != 0:
                output.WriteBigEndian(ModifiedDate / 1000);
                endOffset += sizeof(int);
                break;

            case 19 when !string.IsNullOrEmpty(ModifiedBy):
                output.WriteNullString(ModifiedBy);
                endOffset += ModifiedBy.Length + 1;     //TODO:
                break;

            case 20 when !string.IsNullOrEmpty(Comments):
                output.Write(Comments.ToCharArray());
                endOffset += Comments.Length;
                break;

            case 21 when ImageCompression != 0 || ImageQuality != 0:
                output.Write((byte)(ImageCompression << 4));
                output.Write((byte)ImageQuality);
                output.Write((byte)0);
                output.Write((byte)0);
                endOffset += 4;
                break;

            default:
                break;
            }
        }
示例#22
0
 public override void WriteTo(ShockwaveWriter output)
 {
     output.WriteBigEndian((short)NameIndex);
 }
示例#23
0
 public void WriteTo(ShockwaveWriter output)
 {
     output.WriteBigEndian(ScriptNumber);
 }
示例#24
0
 public override void WriteTo(ShockwaveWriter output)
 {
     output.WriteBigEndian((int)Kind);
     output.WriteBigEndian(Offset);
 }
示例#25
0
        public override void WriteBodyTo(ShockwaveWriter output)
        {
            const short LENGTH = 100;

            output.WriteBigEndian(LENGTH);
            output.WriteBigEndian((ushort)Version);

            output.Write(StageRectangle);

            output.WriteBigEndian(MinMember);
            output.WriteBigEndian(MaxMember);

            output.Write(Tempo);
            output.WriteBigEndian((byte)Remnants.Dequeue());

            output.Write(StageBackgroundColor.G);
            output.Write(StageBackgroundColor.B);

            output.WriteBigEndian((short)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());

            output.Write(StageBackgroundColor.R);

            output.Write((byte)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());
            output.Write((byte)Remnants.Dequeue());
            output.Write((byte)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());

            output.WriteBigEndian((short)MovieVersion);
            output.WriteBigEndian((short)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());
            output.Write((byte)Remnants.Dequeue());
            output.Write((byte)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());

            output.WriteBigEndian(RandomNumber);

            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());

            output.WriteBigEndian(OldDefaultPalette);

            output.WriteBigEndian((short)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian(DefaultPalette);
            output.WriteBigEndian((short)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());

            output.WriteBigEndian(DownloadFramesBeforePlaying);

            output.WriteBigEndian((short)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());
        }
示例#26
0
        public override void WriteBodyTo(ShockwaveWriter output)
        {
            const short ENTRY_OFFSET = 48;

            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian(Sections?.Count ?? 0); //TODO:
            output.WriteBigEndian(Sections?.Count ?? 0); //TODO:

            output.WriteBigEndian(ENTRY_OFFSET);
            output.WriteBigEndian(SECTION_SIZE);

            output.WriteBigEndian((int)Remnants.Dequeue());
            output.WriteBigEndian(Type);
            output.WriteBigEndian((int)Remnants.Dequeue());

            output.WriteBigEndian(NameListChunkId);

            output.WriteBigEndian((short)Remnants.Dequeue());
            output.Write((byte[])Remnants.Dequeue());
            output.WriteBigEndian((short)Remnants.Dequeue());

            foreach (ScriptContextSection section in Sections)
            {
                section.WriteTo(output);
            }
        }