Beispiel #1
0
        public static bool IsSpDvdSup(string fileName)
        {
            using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                var buffer = new byte[SpHeader.SpHeaderLength];
                if (fs.Read(buffer, 0, buffer.Length) != buffer.Length)
                {
                    return(false);
                }

                var header = new SpHeader(buffer);
                if (header.Identifier != "SP" || header.NextBlockPosition < 5)
                {
                    return(false);
                }

                buffer = new byte[header.NextBlockPosition];
                if (fs.Read(buffer, 0, buffer.Length) != buffer.Length)
                {
                    return(false);
                }

                buffer = new byte[SpHeader.SpHeaderLength];
                if (fs.Read(buffer, 0, buffer.Length) != buffer.Length)
                {
                    return(false);
                }

                header = new SpHeader(buffer);
                return(header.Identifier == "SP");
            }
        }
Beispiel #2
0
        protected override void NextFrameCore()
        {
            _currentPlayer = ServiceLocator.ClientEngine.GetCurrentPlayer();
            if (_walk == null)
            {
                ServiceLocator.WasManager.TryGetSpWas("shape.wdf", 0x54F3FC94, out _walk);
            }

            if (_stand == null)
            {
                ServiceLocator.WasManager.TryGetSpWas("shape.wdf", 0x49386FCE, out _stand);
            }

            if (_walk == null || _stand == null || _currentPlayer == null)
            {
                return;
            }

            //计算显示哪一帧
            _frameIndex = (_frameIndex + 1) % TotalFrame;
            _frame      = _currentPlayer.Moving
                ? _walk.GetFrame((int)_currentPlayer.FaceTo, _frameIndex)
                : _stand.GetFrame((int)_currentPlayer.FaceTo, _frameIndex);
            _header = _currentPlayer.Moving ? _walk.SpHeader : _stand.SpHeader;
        }
        public static bool IsSpDvdSup(string fileName)
        {
            using (var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                var buffer = new byte[SpHeader.SpHeaderLength];
                var header = new SpHeader(buffer);

                if (fileStream.Read(buffer, 0, buffer.Length) != buffer.Length)
                {
                    return false;
                }

                if (header.Identifier != "SP" || header.NextBlockPosition < 5)
                {
                    return false;
                }

                buffer = new byte[header.NextBlockPosition];

                if (fileStream.Read(buffer, 0, buffer.Length) != buffer.Length)
                {
                    return false;
                }

                buffer = new byte[SpHeader.SpHeaderLength];

                if (fileStream.Read(buffer, 0, buffer.Length) != buffer.Length)
                {
                    return false;
                }

                header = new SpHeader(buffer);

                return header.Identifier == "SP";
            }
        }