Exemplo n.º 1
0
        public static int GetInt(this WZObject parentNode, string childName, int def = 0)
        {
            if (!parentNode.HasChild(childName))
            {
                return(def);
            }

            WZObject childNode = parentNode[childName];

            if (childNode is WZInt32Property)
            {
                return((childNode as WZInt32Property).Value);
            }
            if (childNode is WZStringProperty)
            {
                return(int.Parse((childNode as WZStringProperty).Value));
            }

            throw new Exception("unablet o cast");
        }
Exemplo n.º 2
0
 public static string GetString(this WZObject node, string childName, string def = "")
 {
     return(node.HasChild(childName) ? node[childName].ValueOrDie <string>() : def);
 }
Exemplo n.º 3
0
 public static double GetDouble(this WZObject node, string childName, double def = 0)
 {
     return(node.HasChild(childName) ? node[childName].ValueOrDie <double>() : def);
 }