Exemple #1
0
        static jmpValueType parseType(xAttribute attribute)
        {
            if (attribute == null)
            {
                return(jmpValueType.STRING);
            }
            switch (attribute.Value)
            {
            case "i":
            case "int":
            case "integer": {
                return(jmpValueType.INTEGER);
            }

            case "f":
            case "flt":
            case "float": {
                return(jmpValueType.FLOAT);
            }

            case "s":
            case "str":
            case "string": {
                return(jmpValueType.STRING);
            }
            }
            return(jmpValueType.STRING);
        }
Exemple #2
0
        public static int AsKeyNumber(this xAttribute attribute, int missing = 60, int error = -1)
        {
            if (attribute == null)
            {
                return(missing);
            }

            var keynumber = mareep.ConvertKey(attribute.Value);

            if (0 <= keynumber && keynumber <= 127)
            {
                return(keynumber);
            }

            keynumber = (attribute | -1);

            if (0 <= keynumber && keynumber <= 127)
            {
                return(keynumber);
            }

            return(error);
        }
Exemple #3
0
 public static int AsInt32(this xAttribute attribute, int missing = -1, int error = -1)
 {
     return(attribute != null ? (attribute | error) : missing);
 }