本文整理汇总了C#中Plasma.hsStream类的典型用法代码示例。如果您正苦于以下问题:C# hsStream类的具体用法?C# hsStream怎么用?C# hsStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
hsStream类属于Plasma命名空间,在下文中一共展示了hsStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteRGBA
public static void WriteRGBA(hsStream s, Color c)
{
s.WriteFloat(Convert.ToSingle(c.R) / 255.0f);
s.WriteFloat(Convert.ToSingle(c.G) / 255.0f);
s.WriteFloat(Convert.ToSingle(c.B) / 255.0f);
s.WriteFloat(Convert.ToSingle(c.A) / 255.0f);
}
示例2: Read
public override void Read(hsStream s, hsResMgr mgr)
{
base.Read(s, mgr);
fSecsRunning = s.ReadDouble();
fSession = (SessionTypes)s.ReadByte();
}
示例3: WriteRGBA8
public static void WriteRGBA8(hsStream s, Color c)
{
s.WriteByte(c.R);
s.WriteByte(c.G);
s.WriteByte(c.B);
s.WriteByte(c.A);
}
示例4: Write
public override void Write(hsStream s, hsResMgr mgr)
{
base.Write(s, mgr);
s.WriteDouble(fSecsRunning);
s.WriteByte((byte)fSession);
}
示例5: 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;
}
示例6: Write
public override void Write(hsStream s, hsResMgr mgr)
{
base.Write(s, mgr);
s.WriteInt((int)fCommand);
s.WriteStdString(fString);
}
示例7: Read
public void Read(hsStream s)
{
fX = s.ReadFloat();
fY = s.ReadFloat();
fZ = s.ReadFloat();
fW = s.ReadFloat();
}
示例8: Read
public override void Read(hsStream s, hsResMgr mgr)
{
base.Read(s, mgr);
fCommand = (Cmd)s.ReadInt();
fString = s.ReadStdString();
}
示例9: 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()));
}
}
}
示例10: ReadKey
/// <summary>
/// Reads a key reference from the stream
/// </summary>
/// <param name="s">Stream containing a key reference</param>
/// <returns>The key referenced in the stream or null (if null reference)</returns>
public plKey ReadKey(hsStream s)
{
if (!s.Version.IsPlasma21)
if (!s.ReadBool()) return null;
return ReadUoid(s);
}
示例11: Write
public void Write(hsStream s)
{
s.WriteFloat(fX);
s.WriteFloat(fY);
s.WriteFloat(fZ);
s.WriteFloat(fW);
}
示例12: ReadCreatable
/// <summary>
/// Reads an arbitrary Creatable from the current position in the stream
/// </summary>
/// <param name="s">Stream to read from</param>
/// <returns></returns>
public plCreatable ReadCreatable(hsStream s)
{
plCreatable pCre = plFactory.Create(plManagedType.Read(s));
if (pCre != null)
pCre.Read(s, this);
return pCre;
}
示例13: Write
public override void Write(hsStream s, hsResMgr mgr)
{
if (s.Version.IsMystOnline)
mgr.WriteKey(s, fpKey);
else
mgr.WriteUoid(s, fpKey);
}
示例14: Write
public override void Write(hsStream s)
{
s.WriteUInt(fTransID);
pnHelpers.WriteString(s, fAccount, 64);
s.WriteBytes(fHash);
s.WriteUInt(fSrvChg);
s.WriteUInt(fCliChg);
}
示例15: Write
public override void Write(hsStream s, hsResMgr mgr)
{
base.Write(s, mgr);
s.WriteBool(fDeliveryTime.HasValue);
if (fDeliveryTime.HasValue)
plUnifiedTime.Write(s, fDeliveryTime.Value);
}