本文整理汇总了C#中Plasma.hsStream.ReadBytes方法的典型用法代码示例。如果您正苦于以下问题:C# hsStream.ReadBytes方法的具体用法?C# hsStream.ReadBytes怎么用?C# hsStream.ReadBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plasma.hsStream
的用法示例。
在下文中一共展示了hsStream.ReadBytes方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IReadNetCliConnect
/// <summary>
/// Reads in a NetCliConnect message from the stream
/// </summary>
/// <param name="s">Stream to read the message from</param>
/// <returns>Connection YData (an array of 64 bytes) or NULL if the message is malformed</returns>
protected byte[] IReadNetCliConnect(hsStream s)
{
byte[] y_data = null;
try {
if (s.ReadByte() != plNetCore.kNetCliConnect) return null;
int size = (int)s.ReadByte() - 2;
y_data = s.ReadBytes(size);
} catch (Exception e) {
#if DEBUG
throw e;
#else
return null;
#endif
}
// Truncate the YData if it's too large
if (y_data.Length > 64) {
byte[] old = y_data;
y_data = new byte[64];
Buffer.BlockCopy(old, 0, y_data, 0, 64);
}
// The client sends us the YData in Little Endian, but
// BigNum wants Big Endian (because OpenSSL). Let's fix that.
Array.Reverse(y_data);
return y_data;
}
示例2: Read
public override void Read(hsStream s)
{
fTransID = s.ReadUInt();
fAccount = pnHelpers.ReadString(s, 64);
fHash = s.ReadBytes(20);
fSrvChg = s.ReadUInt();
fCliChg = s.ReadUInt();
}
示例3: Read
public override void Read(hsStream s, hsResMgr mgr)
{
fFlags = (BitVectorFlags)s.ReadInt();
if (HasVersion) {
fVerMajor = s.ReadByte();
fVerMinor = s.ReadByte();
}
if (HasTimeSent)
fTimeSent = plUnifiedTime.Read(s);
if (HasContext)
fContext = s.ReadUInt();
if (HasTransID)
fTransID = s.ReadUInt();
if (HasPlayerID)
fPlayerID = s.ReadUInt();
if (HasAccount)
fAcctUUID = new Guid(s.ReadBytes(16));
}
示例4: Read
public void Read(hsStream s)
{
pnVaultNodeFields f = (pnVaultNodeFields)s.ReadULong();
for (ulong bit = 1; bit != 0 && bit <= (ulong)f; bit <<= 1) {
switch (f & (pnVaultNodeFields)bit) {
case pnVaultNodeFields.Blob_1:
fBlob[0] = s.ReadBytes(s.ReadInt());
break;
case pnVaultNodeFields.Blob_2:
fBlob[1] = s.ReadBytes(s.ReadInt());
break;
case pnVaultNodeFields.CreateAgeName:
fCreateAgeName = pnHelpers.ReadString(s);
break;
case pnVaultNodeFields.CreateAgeUuid:
fCreateAgeGuid = pnHelpers.ReadUuid(s);
break;
case pnVaultNodeFields.CreateTime:
fCreateTime = plUnifiedTime.Epoch.AddSeconds((double)s.ReadInt());
break;
case pnVaultNodeFields.CreatorIdx:
fCreatorID = s.ReadUInt();
break;
case pnVaultNodeFields.CreatorUuid:
fCreatorGuid = pnHelpers.ReadUuid(s);
break;
case pnVaultNodeFields.Int32_1:
fInt32[0] = s.ReadInt();
break;
case pnVaultNodeFields.Int32_2:
fInt32[1] = s.ReadInt();
break;
case pnVaultNodeFields.Int32_3:
fInt32[2] = s.ReadInt();
break;
case pnVaultNodeFields.Int32_4:
fInt32[3] = s.ReadInt();
break;
case pnVaultNodeFields.IString64_1:
fIString64[0] = pnHelpers.ReadString(s);
break;
case pnVaultNodeFields.IString64_2:
fIString64[1] = pnHelpers.ReadString(s);
break;
case pnVaultNodeFields.ModifyTime:
fModifyTime = plUnifiedTime.Epoch.AddSeconds((double)s.ReadInt());
break;
case pnVaultNodeFields.NodeIdx:
fNodeID = s.ReadUInt();
break;
case pnVaultNodeFields.NodeType:
fNodeType = (ENodeType)s.ReadUInt();
break;
case pnVaultNodeFields.String64_1:
fString64[0] = pnHelpers.ReadString(s);
break;
case pnVaultNodeFields.String64_2:
fString64[1] = pnHelpers.ReadString(s);
break;
case pnVaultNodeFields.String64_3:
fString64[2] = pnHelpers.ReadString(s);
break;
case pnVaultNodeFields.String64_4:
fString64[3] = pnHelpers.ReadString(s);
break;
case pnVaultNodeFields.String64_5:
fString64[4] = pnHelpers.ReadString(s);
break;
case pnVaultNodeFields.String64_6:
fString64[5] = pnHelpers.ReadString(s);
break;
case pnVaultNodeFields.Text_1:
fText[0] = pnHelpers.ReadString(s);
break;
case pnVaultNodeFields.Text_2:
fText[1] = pnHelpers.ReadString(s);
break;
case pnVaultNodeFields.UInt32_1:
fUInt32[0] = s.ReadUInt();
break;
case pnVaultNodeFields.UInt32_2:
fUInt32[1] = s.ReadUInt();
break;
case pnVaultNodeFields.UInt32_3:
fUInt32[2] = s.ReadUInt();
break;
case pnVaultNodeFields.UInt32_4:
fUInt32[3] = s.ReadUInt();
break;
case pnVaultNodeFields.Uuid_1:
fGuid[0] = pnHelpers.ReadUuid(s);
break;
case pnVaultNodeFields.Uuid_2:
fGuid[1] = pnHelpers.ReadUuid(s);
break;
case pnVaultNodeFields.Uuid_3:
fGuid[2] = pnHelpers.ReadUuid(s);
break;
case pnVaultNodeFields.Uuid_4:
fGuid[3] = pnHelpers.ReadUuid(s);
//.........这里部分代码省略.........
示例5: Read
public override void Read(hsStream s)
{
fTransID = s.ReadUInt();
fPingTimeMs = s.ReadUInt();
fPayload = s.ReadBytes(s.ReadInt());
}
示例6: Read
public override void Read(hsStream s, hsResMgr mgr)
{
base.Read(s, mgr);
// Cache it.
fVersion = mgr.Version;
// Cyan stores these values, but we're just going to
// save the stream and have fun with it...
fBuffer = new byte[s.ReadInt()];
Compression type = (Compression)s.ReadByte();
uint len = s.ReadUInt();
if (type == Compression.kZlib) {
short streamType = s.ReadShort();
byte[] buf = s.ReadBytes((int)len - 2);
// Create a zlib-compatible inflator
// Note: incoming has no zlib header/footer
// System.IO.Compression sucks.
Inflater zlib = new Inflater(true);
zlib.Inflate(buf);
Buffer.BlockCopy(BitConverter.GetBytes(streamType), 0, fBuffer, 0, 2);
Buffer.BlockCopy(buf, 0, fBuffer, 2, buf.Length);
} else
fBuffer = s.ReadBytes((int)len);
}
示例7: Read
public override void Read(hsStream s, hsResMgr mgr)
{
base.Read(s, mgr);
fBuffer = s.ReadBytes((int)(s.BaseStream.Length - s.BaseStream.Position));
}
示例8: ReadUuid
public static Guid ReadUuid(hsStream s)
{
return new Guid(s.ReadBytes(16));
}
示例9: ReadString
/// <summary>
/// Reads in a UTF-16 string with an int16 size and a predefined maximum size
/// </summary>
/// <param name="s">Stream to read from</param>
/// <param name="maxSize">Maximum string size</param>
/// <returns>Resulting string</returns>
public static string ReadString(hsStream s, int maxSize)
{
int size = (int)s.ReadShort();
string data = Encoding.Unicode.GetString(s.ReadBytes(size * 2));
if (data.Length > maxSize)
return data.Remove(maxSize);
return data;
}
示例10: IReadHashUInt
private byte[] IReadHashUInt(hsStream s)
{
byte[] buf = s.ReadBytes(4);
Array.Reverse(buf);
return buf;
}
示例11: Read
public override void Read(hsStream s, hsResMgr mgr)
{
fFlags = (Flags)s.ReadShort();
if (HasAccount)
fAcctUUID = new Guid(s.ReadBytes(16));
if (HasPlayerID)
fPlayerID = s.ReadUInt();
if (HasPlayerName)
fPlayerName = s.ReadStdString();
if (HasCCRLevel)
fCCRLevel = s.ReadByte();
if (HasProtectedLogin)
fProtectedLogin = s.ReadBool();
if (HasBuildType)
fBuildType = s.ReadByte();
if (HasSrcAddr)
fSrcAddr = s.ReadUInt();
if (HasSrcPort)
fSrcPort = s.ReadUShort();
if (HasReserved)
fReserved = s.ReadUShort();
if (HasClientKey)
fClientKey = s.ReadStdString();
}