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); } }
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); } }
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(); }
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())); } } }
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); }
public void Read(hsStream s) { Parse(s.Version, s.ReadUInt()); if (s.Version.IsPlasma21) fFlags = (LocFlags)s.ReadByte(); else fFlags = (LocFlags)s.ReadShort(); }
/// <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; }
public override void Read(hsStream s) { base.Read(s); fDescName = s.ReadSafeString(); fVersion = (int)s.ReadShort(); }
public void Read(hsStream s) { if (s.ReadByte() != kIoVersion) throw new NotSupportedException("Bad StateDescriptor IO Version"); fName = s.ReadSafeString(); fVersion = (int)s.ReadShort(); short count = s.ReadShort(); fVariables.Capacity = count; // Optimization for (short i = 0; i < count; i++) { plVarDescriptor var = null; bool isSD = s.ReadBool(); if (isSD) var = new plSDVarDescriptor(); else var = new plSimpleVarDescriptor(); var.Read(s); fVariables.Add(var); } }
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(); } }
public void Read(hsStream s) { if (s.ReadByte() != kIoVersion) throw new NotSupportedException("Bad StateDescriptor IO Version"); fName = s.ReadSafeString(); fVersion = (int)s.ReadShort(); short count = s.ReadShort(); fVariables.Capacity = count; // Optimization for (short i = 0; i < count; i++) { plVarDescriptor var = new plVarDescriptor(s.ReadBool() ? plAtomicType.kStateDescriptor : plAtomicType.kNone); var.Read(s); fVariables.Add(var); } }
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(); }