public override void Deserialize(NetDataReader reader)
        {
            // Deserialize base
            base.Deserialize(reader);

            // Read class
            LevelProgress  = reader.GetBytesWithLength();
            BoltsExpPoints = reader.GetBytesWithLength();
            Skillpoints    = reader.GetBytesWithLength();
            AlphaOmegaMods = reader.GetBytesWithLength();
        }
Beispiel #2
0
        public void Deserialize(NetDataReader reader)
        {
            AddonId      = reader.GetString();
            AddonName    = reader.GetString();
            AddonAuthor  = reader.GetString();
            AddonVersion = reader.GetString();

            SendPermissions    = reader.GetBytesWithLength();
            ReceivePermissions = reader.GetBytesWithLength();

            RemoteConfig = reader.GetBytesWithLength();
        }
Beispiel #3
0
        public void Deserialize(NetDataReader reader)
        {
            _packetVersion = reader.GetByte();
            PreferredCodec = Encoding.UTF8.GetString(reader.GetBytesWithLength());
            byte numCodecs = reader.GetByte();

            SupportedCodecs = new string[numCodecs];
            for (int i = 0; i < numCodecs; i++)
            {
                SupportedCodecs[i] = Encoding.UTF8.GetString(reader.GetBytesWithLength());
            }
        }
        /// <summary>
        /// Handles the messages received from the individual client peers consisting mainly of
        /// mods. Exposes various functionality features to mods.
        /// </summary>
        /// <param name="netPeer">Contains the peer client that sent the message to the server. A wrapper around a WebSocket Client.</param>
        /// <param name="reader">Contains the information sent by the client to the server.</param>
        private static void MessageHandler(NetPeer netPeer, NetDataReader reader)
        {
            // Parse the message structure.
            Message messageStruct = Message.GetMessage(reader.GetBytesWithLength());

            // Pass the relevant message.
            switch (messageStruct.MessageType)
            {
            // Text Functions
            case (ushort)MessageType.PrintText:             PrintASCII(PrintMessageType.PrintText, messageStruct.Data); break;

            case (ushort)MessageType.PrintInfo:             PrintASCII(PrintMessageType.PrintInfo, messageStruct.Data); break;

            case (ushort)MessageType.PrintWarning:          PrintASCII(PrintMessageType.PrintWarning, messageStruct.Data); break;

            case (ushort)MessageType.PrintError:            PrintASCII(PrintMessageType.PrintError, messageStruct.Data); break;

            case (ushort)MessageType.PrintTextUnicode:      PrintUnicode(PrintMessageType.PrintText, messageStruct.Data); break;

            case (ushort)MessageType.PrintInfoUnicode:      PrintUnicode(PrintMessageType.PrintInfo, messageStruct.Data); break;

            case (ushort)MessageType.PrintWarningUnicode:   PrintUnicode(PrintMessageType.PrintWarning, messageStruct.Data); break;

            case (ushort)MessageType.PrintErrorUnicode:     PrintUnicode(PrintMessageType.PrintError, messageStruct.Data); break;
            }
        }
 public void Deserialize(NetDataReader reader)
 {
     _packetVersion = reader.GetByte();
     SampleRate     = reader.GetInt();
     Channels       = reader.GetByte();
     Codec          = Encoding.UTF8.GetString(reader.GetBytesWithLength());
 }
        public override void Deserialize(NetDataReader reader)
        {
            // Deserialize base
            base.Deserialize(reader);

            // Read class
            Equipment = reader.GetBytesWithLength();
        }
Beispiel #7
0
 public void Deserialize(NetDataReader reader)
 {
     Bounds = new Quad(reader.GetDouble(), reader.GetDouble(), reader.GetDouble());
     Path   = new PathString();
     Path.Deserialize(reader);
     byte[] ipBytes = reader.GetBytesWithLength();
     BusAddress = new IPAddress(ipBytes);
     BusPort    = reader.GetUInt();
     ApiUrl     = reader.GetString();
 }
Beispiel #8
0
        /// <summary>
        /// Handles the individual assembly requests sent by the client.
        /// </summary>
        /// <param name="netPeer">Contains the peer client that sent the message to the server. A wrapper around a WebSocket Client.</param>
        /// <param name="reader">Contains the information sent by the client to the server.</param>
        private void ReceiveMessage(NetPeer netPeer, NetDataReader reader)
        {
            // Parse received message.
            Message messageStruct = Message.GetMessage(reader.GetBytesWithLength());

            switch ((MessageTypes)messageStruct.MessageType)
            {
            case MessageTypes.Assemble:             Assemble(DeserializeX86Mnemonics(messageStruct.Data), netPeer);  break;
            }
        }
Beispiel #9
0
            public InstantiateData(NetDataReader reader)
            {
                uint len = reader.GetUInt();

                NetStates = new List <byte[]>();
                NetIDs    = new uint[len];
                for (int i = 0; i < len; i++)
                {
                    NetStates.Add(reader.GetBytesWithLength());
                    NetIDs[i] = reader.GetUInt();
                }
            }
Beispiel #10
0
        public void Deserialize(NetDataReader reader)
        {
            this.levelId         = reader.GetString();
            this.songName        = reader.GetString();
            this.songSubName     = reader.GetString();
            this.songAuthorName  = reader.GetString();
            this.levelAuthorName = reader.GetString();
            this.beatsPerMinute  = reader.GetFloat();
            this.songDuration    = reader.GetFloat();

            this.characteristic = reader.GetString();
            this.difficulty     = (BeatmapDifficulty)reader.GetVarUInt();

            this.coverImage = reader.GetBytesWithLength();
            //if (this.coverImage == null || this.coverImage.Length == 0)
            //Plugin.Log?.Debug($"Received a PreviewBeatmapPacket with an empty coverImage.");
        }
        void INetSerializable.Deserialize(NetDataReader reader)
        {
            byte[] arr = reader.GetBytesWithLength();
            if (arr.Length == 0)
            {
                State = default(T);
                return;
            }

            using (MemoryStream stream = new MemoryStream())
            {
                StringBuilder builder = new StringBuilder();
                stream.Write(arr, 0, arr.Length);
                stream.Position = 0;
                IFormatter formatter = new BinaryFormatter();
                State = (T)formatter.Deserialize(stream);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Read a packet after the type has been resolved
        /// </summary>
        /// <typeparam name="T">Type of packet</typeparam>
        /// <param name="reader">NetDataReader to read from</param>
        /// <returns>Packet Object</returns>
        public T read_packet <T>(NetDataReader reader)
        {
            var data = reader.GetBytesWithLength();

            return(MessagePackSerializer.Deserialize <T>(data));
        }
 public byte[] GetBytesWithLength()
 {
     return(_networkReaderImplementation.GetBytesWithLength());
 }
Beispiel #14
0
 public object Deserialize(NetDataReader stream)
 {
     return(UTF8.GetString(stream.GetBytesWithLength()));
 }