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


C# DataStream.ReadUInt16方法代码示例

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


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

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

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

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

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