コード例 #1
0
    public FlicFile(ISerializer s)
    {
        if (s == null)
        {
            throw new ArgumentNullException(nameof(s));
        }
        if (s.IsWriting())
        {
            throw new NotImplementedException("FLIC file writing not currently supported");
        }

        long startOffset = s.Offset;

        Size        = s.UInt32(null, 0);                 // Size of FLIC including this header
        Type        = (FlicHeaderType)s.UInt16(null, 0); // File type 0xAF11, 0xAF12, 0xAF30, 0xAF44, ...
        Frames      = s.UInt16(null, 0);                 // Number of frames in first segment
        Width       = s.UInt16(null, 0);                 // FLIC width in pixels
        Height      = s.UInt16(null, 0);                 // FLIC height in pixels
        Depth       = s.UInt16(null, 0);                 // Bits per pixel (usually 8)
        Flags       = s.UInt16(null, 0);                 // Set to zero or to three
        Speed       = s.UInt32(null, 0);                 // Delay between frames in jiffies (1/70 s)
        Reserved1   = s.UInt16(null, 0);                 // Set to zero
        Created     = s.UInt32(null, 0);                 // Date of FLIC creation (FLC only)
        Creator     = s.UInt32(null, 0);                 // Serial number or compiler id (FLC only)
        Updated     = s.UInt32(null, 0);                 // Date of FLIC update (FLC only)
        Updater     = s.UInt32(null, 0);                 // Serial number (FLC only), see creator
        AspectDx    = s.UInt16(null, 0);                 // Width of square rectangle (FLC only)
        AspectDy    = s.UInt16(null, 0);                 // Height of square rectangle (FLC only)
        ExtFlags    = s.UInt16(null, 0);                 // EGI: flags for specific EGI extensions
        KeyFrames   = s.UInt16(null, 0);                 // EGI: key-image frequency
        TotalFrames = s.UInt16(null, 0);                 // EGI: total number of frames (segments)
        ReqMemory   = s.UInt32(null, 0);                 // EGI: maximum chunk size (uncompressed)
        MaxRegions  = s.UInt16(null, 0);                 // EGI: max. number of regions in a CHK_REGION chunk
        TranspNum   = s.UInt16(null, 0);                 // EGI: number of transparent levels
        Reserved2   = s.Bytes(null, null, 24);           // Set to zero
        OFrame1     = s.UInt32(null, 0);                 // Offset to frame 1 (FLC only)
        OFrame2     = s.UInt32(null, 0);                 // Offset to frame 2 (FLC only)
        Reserved3   = s.Bytes(null, null, 40);           // Set to zero

        var finalOffset = startOffset + Size;

        while (s.Offset < finalOffset)
        {
            Chunks.Add(FlicChunk.Load(s, Width, Height));
        }
    }