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


C# DataStream.SizeRemaining方法代码示例

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


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

示例1: Steam2Ticket

        internal Steam2Ticket( byte[] blob )
        {
            Entries = new List<Entry>();

            using ( var ds = new DataStream( blob ) )
            {
                Magic = ds.ReadUInt16();

                Length = ds.ReadUInt32();
                unknown1 = ds.ReadUInt32();

                while ( ds.SizeRemaining() > 0 )
                {
                    var entry = new Entry();
                    entry.Deserialize( ds );

                    Entries.Add( entry );
                }
            }
        }
开发者ID:Top-Cat,项目名称:SteamBot,代码行数:20,代码来源:Steam2Ticket.cs

示例2: HandleMulti

        void HandleMulti( IPacketMsg packetMsg )
        {
            if ( !packetMsg.IsProto )
            {
                DebugLog.WriteLine( "CMClient", "HandleMulti got non-proto MsgMulti!!" );
                return;
            }

            var msgMulti = new ClientMsgProtobuf<CMsgMulti>( packetMsg );

            byte[] payload = msgMulti.Body.message_body;

            if ( msgMulti.Body.size_unzipped > 0 )
            {
                try
                {
                    payload = ZipUtil.Decompress( payload );
                }
                catch ( Exception ex )
                {
                    DebugLog.WriteLine( "CMClient", "HandleMulti encountered an exception when decompressing.\n{0}", ex.ToString() );
                    return;
                }
            }

            DataStream ds = new DataStream( payload );

            while ( ds.SizeRemaining() != 0 )
            {
                uint subSize = ds.ReadUInt32();
                byte[] subData = ds.ReadBytes( subSize );

                OnClientMsgReceived( GetPacketMsg( subData ) );
            }

        }
开发者ID:wheybags,项目名称:steamirc,代码行数:36,代码来源:CMClient.cs

示例3: Deserialize

        void Deserialize(byte[] data)
        {
            using ( DataStream ds = new DataStream( data ) )
            {
                while ( ds.SizeRemaining() > 0 )
                {
                    uint magic = ds.ReadUInt32();
                    ds.Seek( -4, SeekOrigin.Current );

                    switch ( magic )
                    {
                        case Steam3Manifest.MAGIC:
                            Steam3Manifest binaryManifest = new Steam3Manifest( ds );
                            ParseBinaryManifest( binaryManifest );
                            break;

                            // todo: handle protobuf manifest?

                        default:
                            throw new NotImplementedException( string.Format( "Unrecognized magic value {0:X} in depot manifest.", magic ) );
                    }

                    uint marker = ds.ReadUInt32();
                    if ( marker != magic )
                        throw new InvalidDataException( "Unable to find end of message marker for depot manifest" );
                }
            }
        }
开发者ID:KimimaroTsukimiya,项目名称:SteamBot-1,代码行数:28,代码来源:DepotManifest.cs


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