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); }
public override void Read(hsStream s, hsResMgr mgr) { base.Read(s, mgr); fSecsRunning = s.ReadDouble(); fSession = (SessionTypes)s.ReadByte(); }
public static void WriteRGBA8(hsStream s, Color c) { s.WriteByte(c.R); s.WriteByte(c.G); s.WriteByte(c.B); s.WriteByte(c.A); }
public override void Write(hsStream s, hsResMgr mgr) { base.Write(s, mgr); s.WriteDouble(fSecsRunning); s.WriteByte((byte)fSession); }
/// <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; }
public override void Write(hsStream s, hsResMgr mgr) { base.Write(s, mgr); s.WriteInt((int)fCommand); s.WriteStdString(fString); }
public void Read(hsStream s) { fX = s.ReadFloat(); fY = s.ReadFloat(); fZ = s.ReadFloat(); fW = s.ReadFloat(); }
public override void Read(hsStream s, hsResMgr mgr) { base.Read(s, mgr); fCommand = (Cmd)s.ReadInt(); fString = s.ReadStdString(); }
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())); } } }
/// <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); }
public void Write(hsStream s) { s.WriteFloat(fX); s.WriteFloat(fY); s.WriteFloat(fZ); s.WriteFloat(fW); }
/// <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; }
public override void Write(hsStream s, hsResMgr mgr) { if (s.Version.IsMystOnline) mgr.WriteKey(s, fpKey); else mgr.WriteUoid(s, fpKey); }
public override void Write(hsStream s) { s.WriteUInt(fTransID); pnHelpers.WriteString(s, fAccount, 64); s.WriteBytes(fHash); s.WriteUInt(fSrvChg); s.WriteUInt(fCliChg); }
public override void Write(hsStream s, hsResMgr mgr) { base.Write(s, mgr); s.WriteBool(fDeliveryTime.HasValue); if (fDeliveryTime.HasValue) plUnifiedTime.Write(s, fDeliveryTime.Value); }
public override void Write(hsStream s, hsResMgr mgr) { base.Write(s, mgr); s.WriteBool(fIsInitialState); s.WriteBool(fPersistOnServer); s.WriteBool(fIsAvatarState); }
public override void Read(hsStream s, hsResMgr mgr) { base.Read(s, mgr); fIsInitialState = s.ReadBool(); fPersistOnServer = s.ReadBool(); fIsAvatarState = s.ReadBool(); }
public override void Read(hsStream s) { fTransID = s.ReadUInt(); fAccount = pnHelpers.ReadString(s, 64); fHash = s.ReadBytes(20); fSrvChg = s.ReadUInt(); fCliChg = s.ReadUInt(); }
public void Write(hsStream s) { s.WriteByte((byte)fType); s.WriteUShort(kHeaderSize); s.WriteUInt(fBuildID); s.WriteUInt((uint)fBuildType); s.WriteUInt(fBranchID); pnHelpers.WriteUuid(s, fProductUuid); }
public override void Write(hsStream s, hsResMgr mgr) { base.Write(s, mgr); mgr.WriteUoid(s, fObjectHelper); s.WriteBool(fIsPlayer); s.WriteBool(fIsLoading); s.WriteBool(fIsInitialState); }
public static Color ReadRGBA8(hsStream s) { int r = (int)s.ReadByte(); int g = (int)s.ReadByte(); int b = (int)s.ReadByte(); int a = (int)s.ReadByte(); return Color.FromArgb(a, r, g, b); }
protected void IWriteNetCliEncrypt(hsStream s, byte[] seed) { if (seed.Length != 7) throw new ArgumentException("seed should be an array of exactly 7 bytes"); s.WriteByte(plNetCore.kNetCliEncrypt); s.WriteByte(9); s.WriteBytes(seed); }
public override void Read(hsStream s, hsResMgr mgr) { base.Read(s, mgr); fObjectHelper = mgr.ReadUoid(s); // Yes, ReadUoid. Not ReadKey. fIsPlayer = s.ReadBool(); fIsLoading = s.ReadBool(); fIsInitialState = s.ReadBool(); }
private void IAcceptConnection(Socket cli) { hsStream s = new hsStream(new NetworkStream(cli, false)); pnCli2Srv_Connect hdr = new pnCli2Srv_Connect(); hdr.Read(s); s.Close(); IAcceptConnection(cli, hdr); }
public void WriteCreatable(hsStream s, plCreatable pCre) { if (pCre == null) plManagedType.Write(s, plCreatableID.NULL); else { plManagedType.Write(s, plFactory.ClassIndex(pCre)); pCre.Write(s, this); } }
public override void Read(hsStream s, hsResMgr mgr) { plKey key = null; if (s.Version.IsMystOnline) key = mgr.ReadKey(s); else key = mgr.ReadUoid(s); fpKey = key; }
public void Read(hsStream s) { fType = (ENetProtocol)s.ReadByte(); if (s.ReadUShort() != kHeaderSize) throw new NotSupportedException(); fBuildID = s.ReadUInt(); fBuildType = (EBuildType)s.ReadUInt(); fBranchID = s.ReadUInt(); fProductUuid = pnHelpers.ReadUuid(s); }
public static Color ReadRGB(hsStream s) { float r = s.ReadFloat(); float g = s.ReadFloat(); float b = s.ReadFloat(); return Color.FromArgb(Convert.ToInt32(r * 255.0f), Convert.ToInt32(g * 255.0f), Convert.ToInt32(b * 255.0f)); }
public override void Read(hsStream s, hsResMgr mgr) { base.Read(s, mgr); fInvisLevel = s.ReadInt(); fLeavingAge = s.ReadBool(); fLinkKey = mgr.ReadKey(s); fEffects = s.ReadInt(); fLinkAnimKey = mgr.ReadKey(s); }
public override void Write(hsStream s, hsResMgr mgr) { base.Write(s, mgr); s.WriteInt(fInvisLevel); s.WriteBool(fLeavingAge); mgr.WriteKey(s, fLinkKey); s.WriteInt(fEffects); mgr.WriteKey(s, fLinkAnimKey); }