Example #1
0
 public override void Write(hsStream s)
 {
     s.WriteUInt(fTransID);
     pnHelpers.WriteString(s, fAccount, 64);
     s.WriteBytes(fHash);
     s.WriteUInt(fSrvChg);
     s.WriteUInt(fCliChg);
 }
Example #2
0
        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);
        }
Example #3
0
        public override void Write(hsStream s, hsResMgr mgr)
        {
            s.WriteInt((int)fFlags);

            if (HasVersion) {
                s.WriteByte(fVerMajor);
                s.WriteByte(fVerMinor);
            }

            if (HasTimeSent)
                plUnifiedTime.Write(s, fTimeSent);
            if (HasContext)
                s.WriteUInt(fContext);
            if (HasTransID)
                s.WriteUInt(fTransID);
            if (HasPlayerID)
                s.WriteUInt(fPlayerID);
            if (HasAccount)
                s.WriteBytes(fAcctUUID.ToByteArray());
        }
Example #4
0
 public void Write(hsStream s)
 {
     pnVaultNodeFields f = Fields;
     s.WriteULong((ulong)f);
     for (ulong bit = 1; bit != 0 && bit <= (ulong)f; bit <<= 1) {
         switch (f & (pnVaultNodeFields)bit) {
             case pnVaultNodeFields.Blob_1:
                 s.WriteInt(fBlob[0].Length);
                 s.WriteBytes(fBlob[0]);
                 break;
             case pnVaultNodeFields.Blob_2:
                 s.WriteInt(fBlob[1].Length);
                 s.WriteBytes(fBlob[1]);
                 break;
             case pnVaultNodeFields.CreateAgeName:
                 pnHelpers.WriteString(s, fCreateAgeName);
                 break;
             case pnVaultNodeFields.CreateAgeUuid:
                 pnHelpers.WriteUuid(s, fCreateAgeGuid.Value);
                 break;
             case pnVaultNodeFields.CreateTime:
                 TimeSpan cts = fCreateTime.Value - plUnifiedTime.Epoch;
                 s.WriteUInt((uint)cts.Seconds);
                 break;
             case pnVaultNodeFields.CreatorIdx:
                 s.WriteUInt(fCreatorID.Value);
                 break;
             case pnVaultNodeFields.CreatorUuid:
                 pnHelpers.WriteUuid(s, fCreatorGuid.Value);
                 break;
             case pnVaultNodeFields.Int32_1:
                 s.WriteInt(fInt32[0].Value);
                 break;
             case pnVaultNodeFields.Int32_2:
                 s.WriteInt(fInt32[1].Value);
                 break;
             case pnVaultNodeFields.Int32_3:
                 s.WriteInt(fInt32[2].Value);
                 break;
             case pnVaultNodeFields.Int32_4:
                 s.WriteInt(fInt32[3].Value);
                 break;
             case pnVaultNodeFields.IString64_1:
                 pnHelpers.WriteString(s, fIString64[0]);
                 break;
             case pnVaultNodeFields.IString64_2:
                 pnHelpers.WriteString(s, fIString64[1]);
                 break;
             case pnVaultNodeFields.ModifyTime:
                 TimeSpan mts = fModifyTime.Value - plUnifiedTime.Epoch;
                 s.WriteUInt((uint)mts.Seconds);
                 break;
             case pnVaultNodeFields.NodeIdx:
                 s.WriteUInt(fNodeID.Value);
                 break;
             case pnVaultNodeFields.NodeType:
                 s.WriteUInt((uint)fNodeType);
                 break;
             case pnVaultNodeFields.String64_1:
                 pnHelpers.WriteString(s, fString64[0]);
                 break;
             case pnVaultNodeFields.String64_2:
                 pnHelpers.WriteString(s, fString64[1]);
                 break;
             case pnVaultNodeFields.String64_3:
                 pnHelpers.WriteString(s, fString64[2]);
                 break;
             case pnVaultNodeFields.String64_4:
                 pnHelpers.WriteString(s, fString64[3]);
                 break;
             case pnVaultNodeFields.String64_5:
                 pnHelpers.WriteString(s, fString64[4]);
                 break;
             case pnVaultNodeFields.String64_6:
                 pnHelpers.WriteString(s, fString64[5]);
                 break;
             case pnVaultNodeFields.Text_1:
                 pnHelpers.WriteString(s, fText[0]);
                 break;
             case pnVaultNodeFields.Text_2:
                 pnHelpers.WriteString(s, fText[1]);
                 break;
             case pnVaultNodeFields.UInt32_1:
                 s.WriteUInt(fUInt32[0].Value);
                 break;
             case pnVaultNodeFields.UInt32_2:
                 s.WriteUInt(fUInt32[1].Value);
                 break;
             case pnVaultNodeFields.UInt32_3:
                 s.WriteUInt(fUInt32[2].Value);
                 break;
             case pnVaultNodeFields.UInt32_4:
                 s.WriteUInt(fUInt32[3].Value);
                 break;
             case pnVaultNodeFields.Uuid_1:
                 pnHelpers.WriteUuid(s, fGuid[0].Value);
                 break;
             case pnVaultNodeFields.Uuid_2:
                 pnHelpers.WriteUuid(s, fGuid[1].Value);
                 break;
             case pnVaultNodeFields.Uuid_3:
                 pnHelpers.WriteUuid(s, fGuid[2].Value);
                 break;
             case pnVaultNodeFields.Uuid_4:
                 pnHelpers.WriteUuid(s, fGuid[3].Value);
                 break;
         }
     }
 }
Example #5
0
 public override void Write(hsStream s)
 {
     s.WriteUInt(fTransID);
     s.WriteUInt(fPingTimeMs);
     s.WriteInt(fPayload.Length);
     s.WriteBytes(fPayload);
 }
Example #6
0
 public override void Write(hsStream s)
 {
     s.WriteUInt(fTransID);
     s.WriteInt((int)fResult);
     if (fNode == null)
         s.WriteInt(0);
     else {
         byte[] buf = fNode.ToArray();
         s.WriteInt(buf.Length);
         s.WriteBytes(buf);
     }
 }
Example #7
0
        public override void Write(hsStream s, hsResMgr mgr)
        {
            base.Write(s, mgr);

            // We're not going to compress the stream...
            // Hope this is okay!
            s.WriteInt(fBuffer.Length);
            s.WriteByte((byte)Compression.kNone);
            s.WriteInt(fBuffer.Length);
            s.WriteBytes(fBuffer);
        }
Example #8
0
 public override void Write(hsStream s, hsResMgr mgr)
 {
     base.Write(s, mgr);
     if (fBuffer != null)
         s.WriteBytes(fBuffer);
 }
Example #9
0
 public static void WriteUuid(hsStream s, Guid uuid)
 {
     s.WriteBytes(uuid.ToByteArray());
 }
Example #10
0
        public static void WriteString(hsStream s, string data, int maxSize)
        {
            if (data == null) {
                s.WriteShort(0);
                return;
            }

            byte[] buf;
            if (data.Length > maxSize)
                buf = Encoding.Unicode.GetBytes(data.Remove(maxSize));
            else
                buf = Encoding.Unicode.GetBytes(data);

            s.WriteShort((short)(buf.Length / 2));
            s.WriteBytes(buf);
        }
Example #11
0
 /// <summary>
 /// Writes a UTF-16 string with an int32 size
 /// </summary>
 /// <param name="s">Stream to write to</param>
 /// <param name="data">String to write to the stream</param>
 public static void WriteString(hsStream s, string data)
 {
     byte[] str = Encoding.Unicode.GetBytes(data);
     s.WriteInt(str.Length + 2);
     s.WriteBytes(str);
     s.WriteUShort((ushort)0);
 }
Example #12
0
 public override void Write(hsStream s)
 {
     s.WriteUInt(fTransID);
     if (fPattern == null)
         s.WriteInt(0);
     else {
         byte[] buf = fPattern.ToArray();
         s.WriteInt(buf.Length);
         s.WriteBytes(buf);
     }
 }
Example #13
0
 public override void Write(hsStream s)
 {
     s.WriteUInt(fTransID);
     s.WriteUInt(fNodeID);
     pnHelpers.WriteUuid(s, fRevision);
     if (fNode == null)
         s.WriteInt(0);
     else {
         byte[] buf = fNode.ToArray();
         s.WriteInt(buf.Length);
         s.WriteBytes(buf);
     }
 }
Example #14
0
        public override void Write(hsStream s, hsResMgr mgr)
        {
            s.WriteShort((short)fFlags);

            if (HasAccount)
                s.WriteBytes(fAcctUUID.ToByteArray());
            if (HasPlayerID)
                s.WriteUInt(fPlayerID);
            if (HasPlayerName)
                s.WriteStdString(fPlayerName);
            if (HasCCRLevel)
                s.WriteByte(fCCRLevel);
            if (HasProtectedLogin)
                s.WriteBool(fProtectedLogin);
            if (HasBuildType)
                s.WriteByte(fBuildType);
            if (HasSrcAddr)
                s.WriteUInt(fSrcAddr);
            if (HasSrcPort)
                s.WriteUShort(fSrcPort);
            if (HasReserved)
                s.WriteUShort(fReserved);
            if (HasClientKey)
                s.WriteStdString(fClientKey);
        }