コード例 #1
0
        /// <summary>
        /// 如果文件是STFS包,获取包中游戏识别符
        /// </summary>
        /// <returns>返回STFS包中游戏识别符</returns>
        public uint TitleID()
        {
            Streams.Reader sReader = new Streams.Reader(PackageStream);
            sReader.BaseStream.Position = (long)Geometry.STFSOffsets.TitleID;

            return(sReader.ReadUInt32());
        }
コード例 #2
0
        /// <summary>
        /// 计算文件魔数(Magic Number),确认文件的类型
        /// CON/LIVE/PIRS/NIGR 类型
        /// </summary>
        public bool IsSTFSPackage()
        {
            // 1010 0000 0000 0000
            if (PackageStream.Length >= 0xA000)
            {
                uint sVal = 0;

                Streams.Reader sReader = new Streams.Reader(PackageStream);
                sReader.BaseStream.Position = 0;
                // 512 Bytes
                byte[] Buffer = sReader.ReadBytes(0x200);

                sReader = new Streams.Reader(new System.IO.MemoryStream(Buffer));
                sVal    = sReader.ReadUInt32();

                switch (sVal)
                {
                // CON ‭ 1010 0011 0100 1111 0100 1110 0010 0000‬
                case 0x434F4E20:
                    return(true);

                // LIVE ‭0100 1100 0100 1001 0101 0110 0100 0101‬
                case 0x4C495645:
                    return(true);

                // PIRS ‭0101 0000 0100 1001 0101 0010 0101 0011‬
                case 0x50495253:
                    return(true);

                // NIGR
                default:
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }