コード例 #1
0
ファイル: TO8CHLI.cs プロジェクト: mhwu95/HyoutaTools
        private bool LoadFile(Stream stream)
        {
            string magic                    = stream.ReadAscii(8);
            uint   fileSize                 = stream.ReadUInt32().SwapEndian();
            uint   skitInfoCount            = stream.ReadUInt32().SwapEndian();
            uint   skitInfoOffset           = stream.ReadUInt32().SwapEndian();
            uint   conditionForwarderCount  = stream.ReadUInt32().SwapEndian();
            uint   conditionForwarderOffset = stream.ReadUInt32().SwapEndian();
            uint   conditionCount           = stream.ReadUInt32().SwapEndian();
            uint   conditionOffset          = stream.ReadUInt32().SwapEndian();
            uint   uCount4                  = stream.ReadUInt32().SwapEndian();
            uint   uOffset4                 = stream.ReadUInt32().SwapEndian();
            uint   uCount5                  = stream.ReadUInt32().SwapEndian();
            uint   uOffset5                 = stream.ReadUInt32().SwapEndian();
            uint   refStringStart           = stream.ReadUInt32().SwapEndian();

            SkitInfoList    = new List <SkitInfo>((int)skitInfoCount);
            stream.Position = skitInfoOffset;
            for (uint i = 0; i < skitInfoCount; ++i)
            {
                SkitInfo s = new SkitInfo(stream, refStringStart);
                SkitInfoList.Add(s);
            }

            SkitConditionForwarderList = new List <SkitConditionForwarder>((int)conditionForwarderCount);
            stream.Position            = conditionForwarderOffset;
            for (uint i = 0; i < conditionForwarderCount; ++i)
            {
                var s = new SkitConditionForwarder(stream);
                SkitConditionForwarderList.Add(s);
            }

            SkitConditionList = new List <SkitCondition>((int)conditionCount);
            stream.Position   = conditionOffset;
            for (uint i = 0; i < conditionCount; ++i)
            {
                var s = new SkitCondition(stream);
                SkitConditionList.Add(s);
            }

            UnknownSkitData4List = new List <UnknownSkitData4>((int)uCount4);
            stream.Position      = uOffset4;
            for (uint i = 0; i < uCount4; ++i)
            {
                var s = new UnknownSkitData4(stream);
                UnknownSkitData4List.Add(s);
            }

            UnknownSkitData5List = new List <UnknownSkitData5>((int)uCount5);
            stream.Position      = uOffset5;
            for (uint i = 0; i < uCount5; ++i)
            {
                var s = new UnknownSkitData5(stream);
                UnknownSkitData5List.Add(s);
            }

            return(true);
        }
コード例 #2
0
ファイル: TO8CHLI.cs プロジェクト: AdmiralCurtiss/HyoutaTools
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint fileSize = stream.ReadUInt32().SwapEndian();
            uint skitInfoCount = stream.ReadUInt32().SwapEndian();
            uint skitInfoOffset = stream.ReadUInt32().SwapEndian();
            uint conditionForwarderCount = stream.ReadUInt32().SwapEndian();
            uint conditionForwarderOffset = stream.ReadUInt32().SwapEndian();
            uint conditionCount = stream.ReadUInt32().SwapEndian();
            uint conditionOffset = stream.ReadUInt32().SwapEndian();
            uint uCount4 = stream.ReadUInt32().SwapEndian();
            uint uOffset4 = stream.ReadUInt32().SwapEndian();
            uint uCount5 = stream.ReadUInt32().SwapEndian();
            uint uOffset5 = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            SkitInfoList = new List<SkitInfo>( (int)skitInfoCount );
            stream.Position = skitInfoOffset;
            for ( uint i = 0; i < skitInfoCount; ++i ) {
                SkitInfo s = new SkitInfo( stream, refStringStart );
                SkitInfoList.Add( s );
            }

            SkitConditionForwarderList = new List<SkitConditionForwarder>( (int)conditionForwarderCount );
            stream.Position = conditionForwarderOffset;
            for ( uint i = 0; i < conditionForwarderCount; ++i ) {
                var s = new SkitConditionForwarder( stream );
                SkitConditionForwarderList.Add( s );
            }

            SkitConditionList = new List<SkitCondition>( (int)conditionCount );
            stream.Position = conditionOffset;
            for ( uint i = 0; i < conditionCount; ++i ) {
                var s = new SkitCondition( stream );
                SkitConditionList.Add( s );
            }

            UnknownSkitData4List = new List<UnknownSkitData4>( (int)uCount4 );
            stream.Position = uOffset4;
            for ( uint i = 0; i < uCount4; ++i ) {
                var s = new UnknownSkitData4( stream );
                UnknownSkitData4List.Add( s );
            }

            UnknownSkitData5List = new List<UnknownSkitData5>( (int)uCount5 );
            stream.Position = uOffset5;
            for ( uint i = 0; i < uCount5; ++i ) {
                var s = new UnknownSkitData5( stream );
                UnknownSkitData5List.Add( s );
            }

            return true;
        }
コード例 #3
0
ファイル: TO8CHLI.cs プロジェクト: asker1982/HyoutaTools
        private bool LoadFile(Stream stream, EndianUtils.Endianness endian, BitUtils.Bitness bits)
        {
            string magic = stream.ReadAscii(8);

            if (magic != "TO8CHLI\0")
            {
                throw new Exception("Invalid magic.");
            }
            uint fileSize                 = stream.ReadUInt32().FromEndian(endian);
            uint skitInfoCount            = stream.ReadUInt32().FromEndian(endian);
            uint skitInfoOffset           = stream.ReadUInt32().FromEndian(endian);
            uint conditionForwarderCount  = stream.ReadUInt32().FromEndian(endian);
            uint conditionForwarderOffset = stream.ReadUInt32().FromEndian(endian);
            uint conditionCount           = stream.ReadUInt32().FromEndian(endian);
            uint conditionOffset          = stream.ReadUInt32().FromEndian(endian);
            uint uCount4        = stream.ReadUInt32().FromEndian(endian);
            uint uOffset4       = stream.ReadUInt32().FromEndian(endian);
            uint uCount5        = stream.ReadUInt32().FromEndian(endian);
            uint uOffset5       = stream.ReadUInt32().FromEndian(endian);
            uint refStringStart = stream.ReadUInt32().FromEndian(endian);

            SkitInfoList    = new List <SkitInfo>((int)skitInfoCount);
            stream.Position = skitInfoOffset;
            for (uint i = 0; i < skitInfoCount; ++i)
            {
                SkitInfo s = new SkitInfo(stream, refStringStart, endian, bits);
                SkitInfoList.Add(s);
            }

            SkitConditionForwarderList = new List <SkitConditionForwarder>((int)conditionForwarderCount);
            stream.Position            = conditionForwarderOffset;
            for (uint i = 0; i < conditionForwarderCount; ++i)
            {
                var s = new SkitConditionForwarder(stream, endian, bits);
                SkitConditionForwarderList.Add(s);
            }

            SkitConditionList = new List <SkitCondition>((int)conditionCount);
            stream.Position   = conditionOffset;
            for (uint i = 0; i < conditionCount; ++i)
            {
                var s = new SkitCondition(stream, endian);
                SkitConditionList.Add(s);
            }

            UnknownSkitData4List = new List <UnknownSkitData4>((int)uCount4);
            stream.Position      = uOffset4;
            for (uint i = 0; i < uCount4; ++i)
            {
                var s = new UnknownSkitData4(stream, endian, bits);
                UnknownSkitData4List.Add(s);
            }

            UnknownSkitData5List = new List <UnknownSkitData5>((int)uCount5);
            stream.Position      = uOffset5;
            for (uint i = 0; i < uCount5; ++i)
            {
                var s = new UnknownSkitData5(stream, endian, bits);
                UnknownSkitData5List.Add(s);
            }

            return(true);
        }