Ejemplo n.º 1
0
    //-----------------------------------------------------------------------------------------------
    private static PreconditionProperty ParsePreconditionFromNode(XmlNode preconditionNode)
    {
        string preconditionName = "";

        if (!TryLoadRequiredAttributeFromXmlNode(preconditionNode, "name", ref preconditionName))
        {
            throw new ArgumentNullException("Precondition missing name!");
        }

        string opAsString = "";

        if (!TryLoadRequiredAttributeFromXmlNode(preconditionNode, "operator", ref opAsString))
        {
            throw new ArgumentNullException("Precondition " + preconditionName + " missing operator!");
        }
        PreconditionProperty.eOperator op = GetPreconditionOpFromString(opAsString);

        string valueAsString = "";

        if (!TryLoadRequiredAttributeFromXmlNode(preconditionNode, "value", ref valueAsString) &&
            valueAsString.Equals(""))
        {
            throw new ArgumentNullException("Precondition " + preconditionName + " missing value!");
        }
        byte value = WorldPropertyValueParseHelper(valueAsString);

        PreconditionProperty precondition = new PreconditionProperty(preconditionName, value, op);

        return(precondition);
    }
Ejemplo n.º 2
0
    //-----------------------------------------------------------------------------------------------
    private static void ParsePreconditionForPrimitiveTask(XmlNode preconditionNode, PrimitiveTask task)
    {
        PreconditionProperty precondition = ParsePreconditionFromNode(preconditionNode);

        task.AddPrecondition(precondition);
    }
Ejemplo n.º 3
0
    //-----------------------------------------------------------------------------------------------
    private static void ParsePreconditionForMethod(XmlNode preconditionNode, Method method)
    {
        PreconditionProperty precondition = ParsePreconditionFromNode(preconditionNode);

        method.AddPrecondition(precondition);
    }