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


C# DataStream.ReadBytes方法代码示例

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


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

示例1: Deserialize

                internal void Deserialize( DataStream ds )
                {
                    ChunkGID = ds.ReadBytes( 20 );

                    CRC = ds.ReadBytes( 4 );

                    Offset = ds.ReadUInt64();

                    DecompressedSize = ds.ReadUInt32();
                    CompressedSize = ds.ReadUInt32();
                }
开发者ID:KimimaroTsukimiya,项目名称:SteamBot-1,代码行数:11,代码来源:Manifest.cs

示例2: GetAuthServerList

        /// <summary>
        /// Gets an auth server list for a specific username.
        /// </summary>
        /// <param name="userName">The username.</param>
        /// <returns>A list of servers on success; otherwise, <c>null</c>.</returns>
        public IPEndPoint[] GetAuthServerList( string userName )
        {
            userName = userName.ToLower();

            byte[] userHash = CryptoHelper.JenkinsHash( Encoding.ASCII.GetBytes( userName ) );
            uint userData = BitConverter.ToUInt32( userHash, 0 ) & 1;

            TcpPacket packet = base.GetRawServerList( ESteam2ServerType.ProxyASClientAuthentication, NetHelpers.EndianSwap( userData ) );

            if ( packet == null )
                return null;

            DataStream ds = new DataStream( packet.GetPayload(), true );

            ushort numAddrs = ds.ReadUInt16();

            IPEndPoint[] serverList = new IPEndPoint[ numAddrs ];
            for ( int x = 0 ; x < numAddrs ; ++x )
            {
                IPAddrPort ipAddr = IPAddrPort.Deserialize( ds.ReadBytes( 6 ) );

                serverList[ x ] = ipAddr;
            }

            return serverList;
        }
开发者ID:KimimaroTsukimiya,项目名称:SteamBot-1,代码行数:31,代码来源:GeneralDSClient.cs

示例3: Deserialize

            internal void Deserialize( DataStream ds )
            {
                Magic = ds.ReadUInt16();

                uint length = ds.ReadUInt32();
                Index = ds.ReadUInt32();

                Data = ds.ReadBytes( length );
            }
开发者ID:Top-Cat,项目名称:SteamBot,代码行数:9,代码来源:Steam2Ticket.cs

示例4: GetContentServerList

        /// <summary>
        /// Gets a list of all currently active content servers.
        /// </summary>
        /// <returns>A list of servers on success; otherwise, <c>null</c>.</returns>
        public IPEndPoint[] GetContentServerList()
        {
            TcpPacket packet = base.GetRawServerList( 3 ); // command 3

            if ( packet == null )
                return null;

            DataStream ds = new DataStream( packet.GetPayload(), true );

            ushort numAddrs = ds.ReadUInt16();

            IPEndPoint[] serverList = new IPEndPoint[ numAddrs ];
            for ( int x = 0 ; x < numAddrs ; ++x )
            {
                IPAddrPort ipAddr = IPAddrPort.Deserialize( ds.ReadBytes( 6 ) );
                serverList[ x ] = ipAddr;
            }

            return serverList;
        }
开发者ID:KimimaroTsukimiya,项目名称:SteamBot-1,代码行数:24,代码来源:ContentServerDSClient.cs

示例5: GetServerList

        /// <summary>
        /// Gets the server list for a specific server type.
        /// </summary>
        /// <param name="type">The server type.</param>
        /// <returns>A list of servers on success; otherwise, <c>null</c>.</returns>
        public IPEndPoint[] GetServerList( ESteam2ServerType type )
        {
            TcpPacket packet = this.GetRawServerList( ( byte )type );

            if ( packet == null )
                return null;

            DataStream ds = new DataStream( packet.GetPayload(), true );

            ushort numAddrs = ds.ReadUInt16();

            IPEndPoint[] serverList = new IPEndPoint[ numAddrs ];
            for ( int x = 0 ; x < numAddrs ; ++x )
            {
                IPAddrPort ipAddr = IPAddrPort.Deserialize( ds.ReadBytes( 6 ) );

                serverList[ x ] = ipAddr;
            }

            return serverList;

        }
开发者ID:hekar,项目名称:Vaporized,代码行数:27,代码来源:DSClient.cs

示例6: 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

示例7: GetServersFromPacket

        static ContentServer[] GetServersFromPacket( TcpPacket packet )
        {
            DataStream ds = new DataStream( packet.GetPayload(), true );

            ushort numAddrs = ds.ReadUInt16();

            ContentServer[] serverList = new ContentServer[ numAddrs ];
            for ( int x = 0 ; x < numAddrs ; ++x )
            {
                uint weighedLoad = ds.ReadUInt32();

                IPAddrPort ipAddr = IPAddrPort.Deserialize( ds.ReadBytes( 6 ) );
                IPAddrPort ipAddr2 = IPAddrPort.Deserialize( ds.ReadBytes( 6 ) );

                serverList[ x ] = new ContentServer()
                {
                    Load = weighedLoad,
                    PackageServer = ipAddr,
                    StorageServer = ipAddr2,
                };

            }

            return serverList;
        }
开发者ID:KimimaroTsukimiya,项目名称:SteamBot-1,代码行数:25,代码来源:ContentServerDSClient.cs


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