public float toFloat() { if (null != obj && obj.GetType() == typeof(string)) { return(float.Parse(obj.ToString())); } return((float)JSONTools.ReadDouble(obj)); }
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); }
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); }
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); }