本文整理汇总了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;
}
示例2: Deserialize
internal void Deserialize( DataStream ds )
{
Magic = ds.ReadUInt16();
uint length = ds.ReadUInt32();
Index = ds.ReadUInt32();
Data = ds.ReadBytes( length );
}
示例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 );
}
}
}
示例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;
}
示例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;
}
示例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;
}