Ejemplo n.º 1
0
		/// <summary>
		/// Serializes a <see cref="ClientInformation" /> object to a binary representation.
		/// </summary>
		/// <param name="clientInfo">the client information object</param>
		/// <returns>the binary representation of the <see cref="ClientInformation" /> object</returns>
		public static byte[] Serialize(ClientInformation clientInfo)
		{
			MemoryStream memStream = new MemoryStream();
			BinaryFormatter bFormatter = new BinaryFormatter();

			bFormatter.Serialize(memStream, clientInfo);

			return memStream.ToArray();
		}
Ejemplo n.º 2
0
        /// <summary>
        /// Generates a system information objet from the given packet.
        /// </summary>
        /// <param name="inPacket">contains the system information in a raw, serialized format</param>
        public static ClientInformation ReadFromPacket(PacketIn packet)
        {
            var info = new ClientInformation(packet);

            return(info);
        }
Ejemplo n.º 3
0
		/// <summary>
		/// Generates a system information objet from the given packet.
		/// </summary>
		/// <param name="inPacket">contains the system information in a raw, serialized format</param>
		public static ClientInformation ReadFromPacket(PacketIn packet)
		{
			var info = new ClientInformation(packet);
			return info;
		}
Ejemplo n.º 4
0
		/// <summary>
		/// Serializes a <see cref="ClientInformation" /> object to a binary representation.
		/// </summary>
		/// <param name="clientInfo">the client information object</param>
		/// <returns>the binary representation of the <see cref="ClientInformation" /> object</returns>
		public static byte[] Serialize(ClientInformation clientInfo)
		{
		    byte[] memStreamArray;
            using (var memStream = new MemoryStream())
            {
                var bFormatter = new BinaryFormatter();

                bFormatter.Serialize(memStream, clientInfo);
                memStreamArray = memStream.ToArray();
            }
		    return memStreamArray;
		}