Ejemplo n.º 1
0
        public OverlayInfo ReadFrame(BinaryReader reader)
        {
            var num = reader.ReadInt32() - 1;

            if (num < 0)
            {
                return(null);
            }
            switch (Version)
            {
            case 1:
                return(new OverlayInfo
                {
                    FrameNumber = num,
                    Diff = reader.ReadInt32() / 1000.0,
                    X = reader.ReadInt16(),
                    Y = reader.ReadInt16(),
                    Width = reader.ReadInt16(),
                    Height = reader.ReadInt16(),
                    CropLeft = reader.ReadInt16(),
                    CropTop = reader.ReadInt16(),
                    CropRight = reader.ReadInt16(),
                    CropBottom = reader.ReadInt16(),
                    Angle = reader.ReadInt16()
                });

            case 2:
                return(new OverlayInfo
                {
                    FrameNumber = num,
                    Diff = reader.ReadInt32() / 10000.0,
                    X = reader.ReadInt16(),
                    Y = reader.ReadInt16(),
                    Width = reader.ReadInt16(),
                    Height = reader.ReadInt16(),
                    CropLeft = reader.ReadInt16(),
                    CropTop = reader.ReadInt16(),
                    CropRight = reader.ReadInt16(),
                    CropBottom = reader.ReadInt16(),
                    Angle = reader.ReadInt16()
                });

            case 3:
                return(new OverlayInfo
                {
                    FrameNumber = num,
                    Diff = reader.ReadDouble(),
                    X = reader.ReadInt16(),
                    Y = reader.ReadInt16(),
                    Width = reader.ReadInt16(),
                    Height = reader.ReadInt16(),
                    CropLeft = reader.ReadInt16(),
                    CropTop = reader.ReadInt16(),
                    CropRight = reader.ReadInt16(),
                    CropBottom = reader.ReadInt16(),
                    Angle = reader.ReadInt16(),
                    BaseWidth = reader.ReadInt16(),
                    BaseHeight = reader.ReadInt16(),
                    SourceWidth = reader.ReadInt16(),
                    SourceHeight = reader.ReadInt16()
                });

            case 4:
                return(new OverlayInfo
                {
                    FrameNumber = num,
                    Diff = reader.ReadDouble(),
                    X = reader.ReadInt16(),
                    Y = reader.ReadInt16(),
                    Width = reader.ReadInt16(),
                    Height = reader.ReadInt16(),
                    CropLeft = reader.ReadInt16(),
                    CropTop = reader.ReadInt16(),
                    CropRight = reader.ReadInt16(),
                    CropBottom = reader.ReadInt16(),
                    Angle = reader.ReadInt16(),
                    BaseWidth = reader.ReadInt16(),
                    BaseHeight = reader.ReadInt16(),
                    SourceWidth = reader.ReadInt16(),
                    SourceHeight = reader.ReadInt16(),
                    Warp = Warp.Read(reader)
                });

            default:
                throw new InvalidOperationException();
            }
        }