public RecordHeader(ShockwaveFlash flash) { _headerStart = flash.Position; _header = flash.ReadUI16(); _tag = (FlashTagType)(_header >> 6); _length = (uint)(_header & 0x3f); if (_length >= 63) { _length = flash.ReadUI32(); } _headerEnd = flash.Position; _isLong = (_length >= 0x3f); }
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; }
public static byte[] ConstructTagData(FlashTagType tag, byte[] body, bool forceLong = false) { var header = ((uint)tag) << 6; bool isLong = (forceLong || body.Length >= 0x3f); header |= (isLong ? 0x3f : (uint)body.Length); var buffer = new List <byte>(); buffer.AddRange(BitConverter.GetBytes((ushort)header)); if (isLong) { buffer.AddRange(BitConverter.GetBytes(body.Length)); } buffer.AddRange(body); return(buffer.ToArray()); }
public FlashTag(FlashTagType tagType) { Header = new TagRecord(tagType); }
public TagRecord(FlashTagType tagType) { TagType = tagType; Body = new byte[0]; }