本文整理汇总了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 );
}
}
}
示例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 ) );
}
}
示例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" );
}
}
}