コード例 #1
0
 public override void Serialize(ref byte[] buffer, Pointer p)
 {
     base.Serialize(ref buffer, p);
     BitPacker.AddInt(ref buffer, p, PhaseID);
     BitPacker.AddString(ref buffer, p, PhaseName);
     BitPacker.AddLong(ref buffer, p, ResponseTime);
 }
コード例 #2
0
 public override void SerializeValue(ref byte[] dat, Pointer p)
 {
     BitPacker.AddInt(ref dat, p, m_Value.Length);
     for (int i = 0; i < m_Value.Length; i++)
     {
         BitPacker.AddString(ref dat, p, Name);
         BitPacker.AddLong(ref dat, p, m_Value[i].Ticks);
     }
 }
コード例 #3
0
ファイル: PacketStream.cs プロジェクト: Amitkapadi/WISP
 public override byte[] Serialize(Pointer p)
 {
     base.Serialize(p);
     BitPacker.AddString(ref m_SerializeBuffer, p, Description);
     BitPacker.AddLong(ref m_SerializeBuffer, p, TotalLength);
     BitPacker.AddBool(ref m_SerializeBuffer, p, Final);
     BitPacker.AddBool(ref m_SerializeBuffer, p, Initial);
     BitPacker.AddString(ref m_SerializeBuffer, p, Arg);
     BitPacker.AddBytes(ref m_SerializeBuffer, p, Buffer);
     return(m_SerializeBuffer);
 }
コード例 #4
0
ファイル: PerfHistory.cs プロジェクト: Amitkapadi/WISP
 public void Serialize(ref byte[] buffer, Pointer p)
 {
     BitPacker.AddBool(ref buffer, p, IsEnabled);
     BitPacker.AddLong(ref buffer, p, SampleInterval.Ticks);
     BitPacker.AddString(ref buffer, p, Category);
     BitPacker.AddString(ref buffer, p, CounterName);
     BitPacker.AddString(ref buffer, p, InstanceName);
     BitPacker.AddString(ref buffer, p, HelpText);
     BitPacker.AddInt(ref buffer, p, History.Count);
     for (int i = 0; i < History.Count; i++)
     {
         BitPacker.AddSingle(ref buffer, p, History[i].Value);
         BitPacker.AddLong(ref buffer, p, History[i].Timestamp.Ticks);
     }
 }
コード例 #5
0
ファイル: WispUserDetail.cs プロジェクト: Amitkapadi/WISP
        public void Serialize(ref byte[] buffer, Pointer p)
        {
            BitPacker.AddLong(ref buffer, p, LastLogin.Ticks);
            BitPacker.AddLong(ref buffer, p, UserSince.Ticks);
            BitPacker.AddLong(ref buffer, p, LastPasswordChange.Ticks);

            BitPacker.AddString(ref buffer, p, ID.ToString());

            BitPacker.AddString(ref buffer, p, Email);
            BitPacker.AddString(ref buffer, p, Username);

            BitPacker.AddBool(ref buffer, p, IsLocked);
            BitPacker.AddBool(ref buffer, p, IsOnline);
            BitPacker.AddBool(ref buffer, p, IsApproved);

            BitPacker.AddStringList(ref buffer, p, Roles);

            BitPacker.AddInt(ref buffer, p, ServiceNotes.Count);
            for (int i = 0; i < ServiceNotes.Count; i++)
            {
                ServiceLogEntry sle = ServiceNotes[i];
                BitPacker.AddString(ref buffer, p, sle.EntryBy);
                BitPacker.AddString(ref buffer, p, sle.Note);
                BitPacker.AddString(ref buffer, p, sle.EntryType);
                BitPacker.AddInt(ref buffer, p, sle.CharacterId);
                BitPacker.AddLong(ref buffer, p, sle.TimeStampUTC.Ticks);
            }

            BitPacker.AddPropertyBag(ref buffer, p, AddedProperties);

            BitPacker.AddInt(ref buffer, p, LoginSessions.Count);
            for (int i = 0; i < LoginSessions.Count; i++)
            {
                AccountProfile.Session s = LoginSessions[i];
                BitPacker.AddLong(ref buffer, p, s.LoginUTC.Ticks);
                BitPacker.AddLong(ref buffer, p, s.LogoutUTC.Ticks);
                BitPacker.AddString(ref buffer, p, s.IP);
            }

            BitPacker.AddLong(ref buffer, p, CurrentLoginTime.Ticks);

            BitPacker.AddInt(ref buffer, p, Characters.Count);
            for (int i = 0; i < Characters.Count; i++)
            {
                ICharacterInfo ci = Characters[i];
                BitPacker.AddComponent(ref buffer, p, ci);
            }
        }
コード例 #6
0
ファイル: WispUsersInfo.cs プロジェクト: Amitkapadi/WISP
        public void Serialize(ref byte[] buffer, Pointer p)
        {
            BitPacker.AddBool(ref buffer, p, AllowRemoteConnections);
            BitPacker.AddInt(ref buffer, p, TotalUserCount);
            BitPacker.AddString(ref buffer, p, UserDataStore);
            BitPacker.AddInt(ref buffer, p, Users.Count);

            foreach (User su in Users)
            {
                BitPacker.AddString(ref buffer, p, su.Username);
                BitPacker.AddStringList(ref buffer, p, new List <string>(su.Roles));
                BitPacker.AddBool(ref buffer, p, su.IsLocked);
                BitPacker.AddString(ref buffer, p, su.ID.ToString());
                BitPacker.AddString(ref buffer, p, su.Email);
                BitPacker.AddLong(ref buffer, p, su.LastLogin.Ticks);
            }
        }
コード例 #7
0
        public virtual void Serialize(ref byte[] buffer, Pointer p)
        {
#if !IS_CLIENT
            BitPacker.AddString(ref buffer, p, CurrentSessionID.ToString());
            BitPacker.AddString(ref buffer, p, Username);
#endif
            BitPacker.AddInt(ref buffer, p, MaxCharacters);

            // Add roles
            BitPacker.AddInt(ref buffer, p, UserRoles.Length);
            for (int i = 0; i < UserRoles.Length; i++)
            {
                BitPacker.AddString(ref buffer, p, UserRoles[i]);
            }

#if !IS_CLIENT
            // Login IPs
            BitPacker.AddInt(ref buffer, p, LoginHistoryIP.Count);
            for (int i = 0; i < LoginHistoryIP.Count; i++)
            {
                BitPacker.AddString(ref buffer, p, LoginHistoryIP.ElementAt(i));
            }

            // Login Times
            BitPacker.AddInt(ref buffer, p, LoginHistoryTime.Count);
            for (int i = 0; i < LoginHistoryTime.Count; i++)
            {
                BitPacker.AddLong(ref buffer, p, LoginHistoryTime.ElementAt(i).Ticks);
            }

            // Logout Times
            BitPacker.AddInt(ref buffer, p, LogoffHistoryTime.Count);
            for (int i = 0; i < LogoffHistoryTime.Count; i++)
            {
                BitPacker.AddLong(ref buffer, p, LogoffHistoryTime.ElementAt(i).Ticks);
            }

            BitPacker.AddString(ref buffer, p, m_CurrentSessionID.ToString());
            BitPacker.AddLong(ref buffer, p, m_CurrentLoginTime.Ticks);
            BitPacker.AddString(ref buffer, p, m_CurrentIP);
#endif
        }
コード例 #8
0
 public void Serialize(ref byte[] buffer, Pointer p)
 {
     BitPacker.AddLong(ref buffer, p, EffectStart);
     BitPacker.AddLong(ref buffer, p, LastTick);
     BitPacker.AddLong(ref buffer, p, TimeRemaining);
 }
コード例 #9
0
 public override byte[] Serialize(Pointer p)
 {
     base.Serialize(p);
     BitPacker.AddLong(ref m_SerializeBuffer, p, StartTime);
     return(m_SerializeBuffer);
 }
コード例 #10
0
ファイル: Packet.cs プロジェクト: Amitkapadi/WISP
        /*/ ENVELOPE (never encrypted) - always 10 bytes long
         * /// =========================
         * /// Int64 message length
         * /// BOOL IsHeaderEncrypted
         * /// byte HeaderLength
         * ///
         * /// HEADER (if encrypted, then it's always encrypted with the "connection" key,)
         * /// ==========
         * /// Int64 BodyLength (Body) in bytes - anything longer than Int32.MaxValue will need to be sent via stream
         * /// Int32 PacketType
         * /// BYTE PacketFlags (IsBodyEncrypted, IsP2PTransmission, IsCompressed)
         * /// string EndpointID
         *
         * /// BODY (if encrypted, then it's always encrypted with the EndpointID's key)
         * /// ==========
         * // byte[] data */

        /// <summary>
        /// Returns a binary representation of this packet suitable for transmission across the wire.  Override this method to control the
        /// serialization process.  The byte array returned by this function is likely bigger than the actual data required.  Read Pointer.Position
        /// after the operation to see where exactly the data ends
        /// </summary>
        /// <param name="p">the pointer indicating where in the return array the actual data stops.  We use this to keep from having to copy the data
        /// into a perfectly sized array.</param>
        /// <returns>a binary representation of the packet</returns>
        public virtual byte[] Serialize(Pointer p)
        {
            BitPacker.AddInt(ref m_SerializeBuffer, p, PacketID);
            BitPacker.AddLong(ref m_SerializeBuffer, p, SentOnUTC);
            return(m_SerializeBuffer);
        }
コード例 #11
0
 public override void SerializeValue(ref byte[] dat, Pointer p)
 {
     BitPacker.AddString(ref dat, p, Name);
     BitPacker.AddLong(ref dat, p, m_Value.Ticks);
 }