本文整理汇总了C#中Plasma.hsStream.ReadShort方法的典型用法代码示例。如果您正苦于以下问题:C# hsStream.ReadShort方法的具体用法?C# hsStream.ReadShort怎么用?C# hsStream.ReadShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plasma.hsStream
的用法示例。
在下文中一共展示了hsStream.ReadShort方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public override void Read(hsStream s, hsResMgr mgr)
{
base.Read(s, mgr);
fMembers.Capacity = (int)s.ReadShort();
for (int i = 0; i < fMembers.Capacity; i++) {
plNetMsgMemberInfoHelper info = new plNetMsgMemberInfoHelper();
info.Read(s, mgr);
fMembers.Add(info);
}
}
示例2: Read
public void Read(hsStream s)
{
short count = s.ReadShort();
fDescriptors.Capacity = (int)count; // Optimization
try {
for (short i = 0; i < count; i++) {
plStateDescriptor desc = new plStateDescriptor();
desc.Read(s);
fDescriptors.Add(desc);
}
} catch (Exception e) {
throw new plSDLException("Failed to read State Descriptors", e);
}
}
示例3: VariableLengthRead
internal static int VariableLengthRead(hsStream s, int size)
{
if (size < 0x100)
return (int)s.ReadByte();
else if (size < 0x10000)
return (int)s.ReadShort();
else
return s.ReadInt();
}
示例4: Read
public override void Read(hsStream s, hsResMgr mgr)
{
base.Read(s, mgr);
fSynchFlags = (Flags)s.ReadInt();
if (s.Version.IsPlasma21)
fSynchFlags &= (Flags)~0x8;
if (s.Version.IsPlasma21 && (((int)fSynchFlags & 0x06) != 0) ||
(s.Version.IsPlasma20 && ExcludeStates)) {
short count = s.ReadShort();
for (short i = 0; i < count; i++)
fExcludeStates.Add((States)Enum.Parse(typeof(States), s.ReadStdString()));
}
//Plasma 2.1+ ends here...
if (s.Version.IsPlasma21) {
fSynchFlags = 0; // Synch Flags are pretty useless in Plasma21
return;
} else if (s.Version.IsPlasma20) {
if (VolatileStates) {
short count = s.ReadShort();
for (short i = 0; i < count; i++)
fVolatileStates.Add((States)Enum.Parse(typeof(States), s.ReadStdString()));
}
}
}
示例5: 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);
}
示例6: Read
public void Read(hsStream s)
{
Parse(s.Version, s.ReadUInt());
if (s.Version.IsPlasma21)
fFlags = (LocFlags)s.ReadByte();
else
fFlags = (LocFlags)s.ReadShort();
}
示例7: 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;
}
示例8: Read
public override void Read(hsStream s)
{
base.Read(s);
fDescName = s.ReadSafeString();
fVersion = (int)s.ReadShort();
}
示例9: Read
public virtual void Read(hsStream s)
{
if (s.ReadByte() != kIoVersion)
throw new NotSupportedException("Bad VarDescriptor IO Version");
fName = s.ReadSafeString();
string displayOptions = s.ReadStdString(); // TODO
fCount = s.ReadInt();
fType = (plAtomicType)s.ReadByte();
Default = s.ReadSafeString();
fFlags = (Flags)s.ReadInt();
// Derived class in Cyan's code, but this is cleaner
if (IsStateDesc) {
fDescName = s.ReadSafeString();
fVersion = (int)s.ReadShort();
} else {
fAtomicCount = (int)s.ReadShort();
fAtomicType = (plAtomicType)s.ReadByte();
}
}
示例10: 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();
}