Esempio n. 1
0
        public StateChanged Deserialize(byte[] body)
        {
            string data = TextConvert.ToUTF8String(body);

            if (!int.TryParse(data, out int value))
            {
                value = -1;
            }

            return(new StateChanged {
                Value = value
            });
        }
Esempio n. 2
0
        public MyEvent Deserialize(byte[] value)
        {
            string data = TextConvert.ToUTF8String(value);

            if (!int.TryParse(data, out int status))
            {
                status = -1;
            }

            return(new MyEvent {
                Status = status
            });
        }
Esempio n. 3
0
        public StatusChanged Deserialize(byte[] body)
        {
            var actin = TextConvert.ToUTF8String(body);

            if (!int.TryParse(actin, out int value))
            {
                value = -1;
            }

            return(new StatusChanged {
                Value = value
            });
        }
        public ChangeNodeState Deserialize(byte[] body)
        {
            var data = TextConvert.ToUTF8String(body);

            var strNodeId = data.Substring(0, data.Length - 1);

            if (!int.TryParse(strNodeId, out int nodeId))
            {
                return(null);
            }

            var strActionType = data.Substring(data.Length - 1);

            if (!int.TryParse(strActionType, out int actionType))
            {
                return(null);
            }

            return(new ChangeNodeState {
                NodeId = nodeId, ActionType = actionType
            });
        }
 public virtual string Deserialize(byte[] value) => TextConvert.ToUTF8String(value);
        public T Deserialize(byte[] value)
        {
            string data = TextConvert.ToUTF8String(value);

            return(JsonConvert.DeserializeObject <T>(data));
        }