Beispiel #1
0
        public static Block Parse(XmlNode node, ParserInfo parseInfo, bool canBeScheduled)
        {
            string id    = ParseTools.ParseID(node);
            float  value = ParseTools.ParseFloat(node, parseInfo, id);

            return(new Constant(value, parseInfo.GetUniqueAnonymousName(), id, canBeScheduled));
        }
Beispiel #2
0
        public static InputDeclaration Parse(XmlNode node, ParserInfo parserInfo)
        {
            string id     = ParseTools.ParseID(node);
            float  amount = ParseTools.ParseFloat(node, parserInfo, id, INPUT_AMOUNT_FIELD_NAME);
            string output = ParseTools.ParseString(node, INPUT_FLUID_FIELD_NAME);

            parserInfo.AddVariable(id, VariableType.FLUID, output);

            return(new InputDeclaration(output, amount, id));
        }
Beispiel #3
0
        public static FluidInput Parse(XmlNode node, ParserInfo parserInfo, bool doVariableCheck = true)
        {
            string id = ParseTools.ParseID(node);
            string originalFluidName = ParseTools.ParseString(node, FLUID_NAME_FIELD_NAME);

            if (doVariableCheck)
            {
                parserInfo.CheckVariable(id, VariableType.FLUID, originalFluidName);
            }

            float amountInML  = ParseTools.ParseFloat(node, parserInfo, id, FLUID_AMOUNT_FIELD_NAME);
            bool  useAllFluid = FluidInput.StringToBool(ParseTools.ParseString(node, USE_ALL_FLUID_FIELD_NAME));

            return(new BasicInput(id, originalFluidName, amountInML, useAllFluid));
        }
Beispiel #4
0
        public static Block CreateHeater(string output, XmlNode node, DFG <Block> dfg, ParserInfo parserInfo)
        {
            string id         = ParseTools.ParseID(node);
            string moduleName = ParseTools.ParseString(node, MODULE_NAME_FIELD_NAME);

            parserInfo.CheckVariable(id, VariableType.HEATER, moduleName);

            int temperature = (int)ParseTools.ParseFloat(node, parserInfo, id, TEMPERATURE_FIELD_NAME);
            int time        = (int)ParseTools.ParseFloat(node, parserInfo, id, TIME_FIELD_NAME);

            FluidInput fluidInput = ParseTools.ParseFluidInput(node, dfg, parserInfo, id, INPUT_FLUID_FIELD_NAME,
                                                               new MissingBlockException(id, "Heater is missing input fluid block."));

            List <FluidInput> inputs = new List <FluidInput>();

            inputs.Add(fluidInput);

            return(new HeaterUsage(moduleName, inputs, output, temperature, time, id));
        }
Beispiel #5
0
        public static FluidInput Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo, bool doVariableCheck = true)
        {
            string id        = ParseTools.ParseID(node);
            string arrayName = ParseTools.ParseString(node, ARRAY_NAME_FIELD_NAME);

            if (doVariableCheck)
            {
                parserInfo.CheckVariable(id, VariableType.FLUID_ARRAY, arrayName);
            }

            float amountInML  = ParseTools.ParseFloat(node, parserInfo, id, FLUID_AMOUNT_FIELD_NAME);
            bool  useAllFluid = FluidInput.StringToBool(ParseTools.ParseString(node, USE_ALL_FLUID_FIELD_NAME));

            VariableBlock indexBlock = ParseTools.ParseBlock <VariableBlock>(node, dfg, parserInfo, id, INDEX_FIELD_NAME,
                                                                             new MissingBlockException(id, "Missing block which define the index into the array."));

            dfg.AddNode(indexBlock);

            return(new GetArrayFluid(indexBlock, arrayName, id, amountInML, useAllFluid));
        }