Example #1
0
        private static bool NewStructCallbackTest(TCODParserStructure cur, string name)
        {
            switch (currentState)
            {
            case currentStructType.none:
                if (name.ToString() != "blade" && cur.GetName() != "item_type")
                {
                    return(false);
                }

                if (!cur.IsMandatory("cost"))
                {
                    return(false);
                }
                if (cur.GetType("cost") != TCODValueType.TCOD_TYPE_INT)
                {
                    return(false);
                }

                currentState = currentStructType.item;
                break;

            case currentStructType.item:
                if (name != null && cur.GetName() != "video")
                {
                    return(false);
                }
                currentState = currentStructType.video;
                break;

            case currentStructType.video:
                if (name != null && cur.GetName() != "input")
                {
                    return(false);
                }
                currentState = currentStructType.input;
                break;

            case currentStructType.input:
                if (name != null && cur.GetName() != "mouse")
                {
                    return(false);
                }
                currentState = currentStructType.mouse;
                break;

            case currentStructType.inputDone:
                return(false);      //Should never get here

            case currentStructType.mouse:
                return(false);      //Should never get here
            }
            return(true);
        }
Example #2
0
        private static bool EndStructCallbackTest(TCODParserStructure cur, string name)
        {
            switch (currentState)
            {
            case currentStructType.none:
                return(false);

            case currentStructType.item:
                if (name.ToString() != "blade" || cur.GetName() != "item_type")
                {
                    return(false);
                }
                break;

            case currentStructType.video:
                if (name != null || cur.GetName() != "video")
                {
                    return(false);
                }
                break;

            case currentStructType.mouse:
                if (name != null || cur.GetName() != "mouse")
                {
                    return(false);
                }
                currentState = currentStructType.inputDone;
                break;

            case currentStructType.inputDone:
                if (name != null || cur.GetName() != "input")
                {
                    return(false);
                }
                break;

            case currentStructType.input:
                return(false);
            }
            return(true);
        }