Exemplo n.º 1
0
 public float toFloat()
 {
     if (null != obj && obj.GetType() == typeof(string))
     {
         return(float.Parse(obj.ToString()));
     }
     return((float)JSONTools.ReadDouble(obj));
 }
Exemplo n.º 2
0
    public static float ReadFloat(Dictionary <string, object> inDict, string inFloatName, float inDefaultValue = DefaultFloat)
    {
        float returnVal = inDefaultValue;

        if (inDict.ContainsKey(inFloatName) == true)
        {
            returnVal = (float)JSONTools.ReadDouble(inDict[inFloatName]);
        }

        return(returnVal);
    }
Exemplo n.º 3
0
    public static double ReadDouble(Dictionary <string, object> inDict, string inDoubleName, double inDefaultValue = DefaultDouble)
    {
        double returnVal = inDefaultValue;

        if (inDict.ContainsKey(inDoubleName) == true)
        {
            returnVal = JSONTools.ReadDouble(inDict[inDoubleName]);
        }

        return(returnVal);
    }
Exemplo n.º 4
0
    public static bool ReadDateTime(Dictionary <string, object> inDict, string inVariableName, ref System.DateTime refValue, bool inIsLocal = false)
    {
        if (inDict.ContainsKey(inVariableName) == true)
        {
            double seconds = JSONTools.ReadDouble(inDict[inVariableName]);

            refValue = (inIsLocal) ? SecondsSinceEpochToDateTime(seconds) : SecondsSinceEpochToDateTimeLocal(seconds);

            return(true);
        }

        return(false);
    }