Exemplo n.º 1
0
        /// <summary>
        /// 图形控制扩展
        /// </summary>
        /// <param name="data">当前解析数据</param>
        internal unsafe PraphicControl(byte *data)
        {
            byte flag = *data;

            MethodType            = (PraphicControlMethodType)((flag >> 2) & 7);
            IsUseInput            = (byte)(flag & 2);
            IsTransparentColor    = (byte)(flag & 1);
            DelayTime             = *(short *)(data + 1);
            TransparentColorIndex = *(data + 3);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加图形控制扩展
        /// </summary>
        /// <param name="delayTime">延迟时间,单位1/100秒</param>
        /// <param name="method">图形处置方法</param>
        /// <param name="isUseInput">用户输入标志,指出是否期待用户有输入之后才继续进行下去,置位表示期待,值否表示不期待。</param>
        /// <returns>图形控制扩展是否添加成功</returns>
        public unsafe bool AddGraphicControl(short delayTime, PraphicControlMethodType method = PraphicControlMethodType.None
                                             , bool isUseInput = false)
        {
            if (fileBuffer == null)
            {
                return(false);
            }
            if (delayTime <= 0)
            {
                delayTime = 1;
                fixed(byte *bufferFixed = fileBuffer)
                {
                    byte *currentBuffer = bufferFixed + bufferIndex;

                    *(int *)currentBuffer       = 0x4f921 | ((int)method << 26) | (isUseInput ? (0x2000000) : 0);
                    *(int *)(currentBuffer + 4) = delayTime <= 0 ? 1 : (int)delayTime;
                    return(checkBuffer(bufferFixed, 8));
                }
        }