Ejemplo n.º 1
0
 public bool SetJsonMessage(string message)
 {
     try
     {
         JObject jo = JsonConvert.DeserializeObject <JObject>(message);
         if (jo != null && jo.HasValues)
         {
             var pairs = jo.GetEnumerator();
             while (pairs.MoveNext())
             {
                 if (string.Equals(pairs.Current.Key, DicKeys.dataTable))
                 {
                     setJsonTable((JObject)pairs.Current.Value);
                 }
                 else //if (pairs.Current.Value != null)
                 {
                     Propertites.Add(pairs.Current.Key, (string)pairs.Current.Value);
                 }
             }
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
 public void AddProperty(string key, string value)
 {
     if (Propertites.ContainsKey(key))
     {
         Propertites.Remove(key);
     }
     Propertites.Add(key, value);
 }
Ejemplo n.º 3
0
        public string GetProperty(string key, string defaultValue)
        {
            var result = "";

            if (Propertites.ContainsKey(key))
            {
                if (Propertites.TryGetValue(key, out result))
                {
                    return(result);
                }
            }
            return(defaultValue);
        }