当前位置: 首页>>代码示例>>C#>>正文


C# Stream.ReadAscii方法代码示例

本文整理汇总了C#中Stream.ReadAscii方法的典型用法代码示例。如果您正苦于以下问题:C# Stream.ReadAscii方法的具体用法?C# Stream.ReadAscii怎么用?C# Stream.ReadAscii使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stream的用法示例。


在下文中一共展示了Stream.ReadAscii方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint strategySetCount = stream.ReadUInt32().SwapEndian();
            uint strategyOptionCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            StrategySetList = new List<StrategySet>( (int)strategySetCount );
            for ( uint i = 0; i < strategySetCount; ++i ) {
                StrategySet ss = new StrategySet( stream, refStringStart );
                StrategySetList.Add( ss );
            }
            StrategyOptionList = new List<StrategyOption>( (int)strategyOptionCount );
            for ( uint i = 0; i < strategyOptionCount; ++i ) {
                StrategyOption so = new StrategyOption( stream, refStringStart );
                StrategyOptionList.Add( so );
            }

            StrategyOptionDict = new Dictionary<uint, StrategyOption>( StrategyOptionList.Count );
            foreach ( var option in StrategyOptionList ) {
                StrategyOptionDict.Add( option.InGameID, option );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:25,代码来源:T8BTTA.cs

示例2: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 4 );
            switch ( magic ) {
                case "G1TG": Endian = Util.Endianness.BigEndian; break;
                case "GT1G": Endian = Util.Endianness.LittleEndian; break;
                default: throw new Exception( "Not a g1t file!" );
            }

            uint version = stream.ReadUInt32().FromEndian( Endian );

            switch ( version ) {
                case 0x30303530: break;
                case 0x30303630: break;
                default: throw new Exception( "Unsupported g1t version!" );
            }

            uint fileSize = stream.ReadUInt32().FromEndian( Endian );
            uint headerSize = stream.ReadUInt32().FromEndian( Endian );
            uint numberTextures = stream.ReadUInt32().FromEndian( Endian );
            uint unknown = stream.ReadUInt32().FromEndian( Endian );

            stream.Position = headerSize;
            uint bytesUnknownData = stream.ReadUInt32().FromEndian( Endian );
            stream.Position = headerSize + bytesUnknownData;
            Textures = new List<g1tTexture>( (int)numberTextures );
            for ( uint i = 0; i < numberTextures; ++i ) {
                var g = new g1tTexture( stream, Endian );
                Textures.Add( g );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:33,代码来源:g1t.cs

示例3: LoadFile

        private bool LoadFile( Stream stream, uint textPointerLocationDiff )
        {
            string magic = stream.ReadAscii( 8 );
            uint alwaysSame = stream.ReadUInt32().SwapEndian();
            uint filesize = stream.ReadUInt32().SwapEndian();

            uint lengthSection1 = stream.ReadUInt32().SwapEndian();

            stream.Position = 0x50;
            int textPointerDiffDiff = (int)stream.ReadUInt32().SwapEndian();
            stream.Position = 0x20;
            uint textStart = stream.ReadUInt32().SwapEndian();
            int textPointerDiff = (int)stream.ReadUInt32().SwapEndian() - textPointerDiffDiff;

            EntryList = new List<ScenarioFileEntry>();

            // i wonder what the actual logic behind this is...
            uint textPointersLocation = ( lengthSection1 + 0x80 ).Align( 0x10 ) + textPointerLocationDiff;
            // + 0x1888; // + 0x1B4C // diff of 2C4 // Actually this isn't constant, dammit.

            if ( textStart != textPointersLocation ) {
                stream.Position = textPointersLocation;

                while ( true ) {
                    long loc = stream.Position;
                    stream.DiscardBytes( 8 );
                    uint[] ptrs = new uint[4];
                    ptrs[0] = stream.ReadUInt32().SwapEndian();
                    ptrs[1] = stream.ReadUInt32().SwapEndian();
                    ptrs[2] = stream.ReadUInt32().SwapEndian();
                    ptrs[3] = stream.ReadUInt32().SwapEndian();

                    if ( stream.Position > textStart ) { break; }
                    if ( ptrs.Any( x => x == 0 ) ) { break; }
                    if ( ptrs.Any( x => x + textPointerDiff < textStart ) ) { break; }
                    if ( ptrs.Any( x => x + textPointerDiff >= filesize ) ) { break; }

                    var s = new ScenarioFileEntry();
                    s.Pointer = (uint)loc;
                    stream.Position = ptrs[0] + textPointerDiff;
                    s.JpName = stream.ReadShiftJisNullterm();
                    stream.Position = ptrs[1] + textPointerDiff;
                    s.JpText = stream.ReadShiftJisNullterm();
                    stream.Position = ptrs[2] + textPointerDiff;
                    s.EnName = stream.ReadShiftJisNullterm();
                    stream.Position = ptrs[3] + textPointerDiff;
                    s.EnText = stream.ReadShiftJisNullterm();
                    EntryList.Add( s );

                    stream.Position = loc + 0x18;
                }
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:55,代码来源:SCFOMBIN.cs

示例4: LoadFile

        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;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:53,代码来源:TO8CHLI.cs

示例5: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint blockCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            Blocks = new List<T8BTVABlock>( (int)blockCount );
            for ( uint i = 0; i < blockCount; ++i ) {
                Blocks.Add( new T8BTVABlock( stream, refStringStart ) );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:13,代码来源:T8BTVA.cs

示例6: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint entryCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            GradeShopEntryList = new List<GradeShopEntry>( (int)entryCount );
            for ( uint i = 0; i < entryCount; ++i ) {
                GradeShopEntry e = new GradeShopEntry( stream, refStringStart );
                GradeShopEntryList.Add( e );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:14,代码来源:T8BTGR.cs

示例7: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint unknown = stream.ReadUInt32().SwapEndian();
            uint recipeCount = stream.ReadUInt32().SwapEndian();

            RecipeList = new List<Recipe>( (int)recipeCount );
            for ( uint i = 0; i < recipeCount; ++i ) {
                Recipe r = new Recipe( stream );
                RecipeList.Add( r );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:14,代码来源:COOKDAT.cs

示例8: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint unknown = stream.ReadUInt32().SwapEndian();
            uint titleCount = stream.ReadUInt32().SwapEndian();

            TitleList = new List<Title>( (int)titleCount );
            for ( uint i = 0; i < titleCount; ++i ) {
                Title t = new Title( stream );
                TitleList.Add( t );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:14,代码来源:FAMEDAT.cs

示例9: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint floorInfoCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            FloorList = new List<FloorInfo>( (int)floorInfoCount );
            for ( uint i = 0; i < floorInfoCount; ++i ) {
                FloorInfo fi = new FloorInfo( stream, refStringStart );
                FloorList.Add( fi );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:14,代码来源:T8BTXTMA.cs

示例10: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint infoCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            TreasureInfoList = new List<TreasureInfo>( (int)infoCount );
            for ( uint i = 0; i < infoCount; ++i ) {
                TreasureInfo ti = new TreasureInfo( stream, refStringStart );
                TreasureInfoList.Add( ti );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:14,代码来源:T8BTXTMT.cs

示例11: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint entrySize = stream.ReadUInt32().SwapEndian();
            uint synopsisCount = stream.ReadUInt32().SwapEndian();
            uint unknown = stream.ReadUInt32().SwapEndian();
            stream.DiscardBytes( 0xC );

            SynopsisList = new List<SynopsisEntry>( (int)synopsisCount );
            for ( uint i = 0; i < synopsisCount; ++i ) {
                SynopsisEntry l = new SynopsisEntry( stream );
                SynopsisList.Add( l );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:16,代码来源:SYNPDAT.cs

示例12: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint fileSize = stream.ReadUInt32().SwapEndian();
            uint dataStart = stream.ReadUInt32().SwapEndian();
            uint dataCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            stream.Position = dataStart;
            NpcFileList = new List<NpcFileReference>( (int)dataCount );
            for ( uint i = 0; i < dataCount; ++i ) {
                NpcFileReference n = new NpcFileReference( stream, refStringStart );
                NpcFileList.Add( n );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:17,代码来源:TOVNPCL.cs

示例13: ScenarioDat

        public ScenarioDat( Stream data )
        {
            Magic = data.ReadAscii( 8 );
            Filesize = data.ReadUInt32().SwapEndian();
            Unknown = data.ReadUInt32().SwapEndian();

            Filecount = data.ReadUInt32().SwapEndian();
            FilesOffset = data.ReadUInt32().SwapEndian();
            uint FilesizeAgain = data.ReadUInt32();
            uint Padding = data.ReadUInt32();

            Entries = new List<ScenarioDatEntry>( (int)Filecount );
            for ( uint i = 0; i < Filecount; ++i ) {
                data.Position = 0x20u + i * 0x20u;
                var e = new ScenarioDatEntry( data, FilesOffset );
                Entries.Add( e );
            }
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:18,代码来源:ScenarioDat.cs

示例14: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint unknown = stream.ReadUInt32().SwapEndian();
            uint locationCount = stream.ReadUInt32().SwapEndian();

            LocationList = new List<Location>( (int)locationCount );
            for ( uint i = 0; i < locationCount; ++i ) {
                Location l = new Location( stream );
                LocationList.Add( l );
            }

            LocationIdDict = new Dictionary<uint, Location>( LocationList.Count );
            foreach ( Location l in LocationList ) {
                LocationIdDict.Add( l.LocationID, l );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:19,代码来源:WRLDDAT.cs

示例15: LoadFile

        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint skillCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            SkillList = new List<Skill>( (int)skillCount );
            for ( uint i = 0; i < skillCount; ++i ) {
                Skill s = new Skill( stream, refStringStart );
                SkillList.Add( s );
            }

            SkillIdDict = new Dictionary<uint, Skill>( SkillList.Count );
            foreach ( Skill s in SkillList ) {
                SkillIdDict.Add( s.InGameID, s );
            }

            return true;
        }
开发者ID:AdmiralCurtiss,项目名称:HyoutaTools,代码行数:19,代码来源:T8BTSK.cs


注:本文中的Stream.ReadAscii方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。