Example #1
0
        public static Sensor GetSensor(this SCPTuple tuple)
        {
            try
            {
                Sensor sensor = null;

                if (tuple.Size() == 1)
                {
                    var content = tuple.GetString(0)
                                  .Replace("\"", "'")
                                  .Replace("\\", "");

                    sensor = JsonConvert.DeserializeObject <Sensor>(@content);
                }

                return(sensor);
            }
            catch (Exception ex)
            {
                Context.Logger.Error("JSON Serialization error:{0}", ex.ToString());

                return(null);
            }
        }