Exemple #1
0
 /// <summary>Gets the int from a JsonValue.</summary>
 public static int Qi(this JsonValue json)
 {
     if (json != null && json.JsonType == JsonType.Number)
     {
         return(Convert.ToInt32(json.ToValue()));
     }
     else
     {
         throw failQ(json, "Qi");
     }
 }
Exemple #2
0
 /// <summary>Gets the long from a JsonValue.</summary>
 public static long Ql(this JsonValue json)
 {
     if (json != null && json.JsonType == JsonType.Number)
     {
         return(Convert.ToInt64(json.ToValue()));
     }
     else
     {
         throw failQ(json, "Ql");
     }
 }
Exemple #3
0
 /// <summary>Gets the bool from a JsonValue.</summary>
 public static bool Qb(this JsonValue json)
 {
     if (json != null && json.JsonType == JsonType.Boolean)
     {
         return((bool)json.ToValue());
     }
     else
     {
         throw failQ(json, "Qb");
     }
 }
Exemple #4
0
 /// <summary>Gets the double from a JsonValue.</summary>
 public static double Qd(this JsonValue json)
 {
     if (json != null && json.JsonType == JsonType.Number)
     {
         return(Convert.ToDouble(json.ToValue()));
     }
     else
     {
         throw failQ(json, "Qd");
     }
 }
Exemple #5
0
 /// <summary>Gets the double from a JsonValue.</summary>
 public static double Qd(this JsonValue json)
 {
     if (json != null && json.JsonType == JsonType.Number)
     {
         return(Convert.ToDouble(json.ToValue()));
     }
     else
     {
         throw new Exception("Missing JsonType.Number!");
     }
 }
Exemple #6
0
 /// <summary>Gets the bool from a JsonValue.</summary>
 public static bool Qb(this JsonValue json)
 {
     if (json != null && json.JsonType == JsonType.Boolean)
     {
         return((bool)json.ToValue());
     }
     else
     {
         throw new Exception("Missing JsonType.Boolean!");
     }
 }
Exemple #7
0
 /// <summary>For JsonValues with type number, this method will return its
 /// value as long, otherwise it will throw.</summary>
 public static ulong Qul(this JsonValue json)
 {
     unchecked
     {
         if (json != null && json.JsonType == JsonType.Number)
         {
             return((ulong)Convert.ToUInt64(json.ToValue()));
         }
         else
         {
             throw failQ(json, "Ql");
         }
     }
 }