Ejemplo n.º 1
0
        public static WasteUsage Parse(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.WASTE, moduleName);

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

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

            inputs.Add(fluidInput);

            return(new WasteUsage(moduleName, inputs, null, id));
        }
Ejemplo n.º 2
0
        public static Block CreateUnion(string output, XmlNode node, DFG <Block> dfg, ParserInfo parserInfo)
        {
            string id = node.GetAttributeValue(Block.ID_FIELD_NAME);

            FluidInput fluidInput1 = ParseTools.ParseFluidInput(node, dfg, parserInfo, id, FIRST_INPUT_FIELD_NAME,
                                                                new MissingBlockException(id, "Union is missing input fluid block."));
            FluidInput fluidInput2 = ParseTools.ParseFluidInput(node, dfg, parserInfo, id, SECOND_INPUT_FIELD_NAME,
                                                                new MissingBlockException(id, "Union is missing input fluid block."));

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

            inputs.Add(fluidInput1);
            inputs.Add(fluidInput2);

            return(new Union(inputs, output, id));
        }
Ejemplo n.º 3
0
        public static Block CreateMixer(string output, XmlNode node, DFG <Block> dfg, ParserInfo parserInfo)
        {
            string id = ParseTools.ParseID(node);

            FluidInput fluidInput1 = ParseTools.ParseFluidInput(node, dfg, parserInfo, id, FirstInputFieldName,
                                                                new MissingBlockException(id, "Mixer is missing input fluid block."));
            FluidInput fluidInput2 = ParseTools.ParseFluidInput(node, dfg, parserInfo, id, SecondInputFieldName,
                                                                new MissingBlockException(id, "Mixer is missing input fluid block."));

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

            inputs.Add(fluidInput1);
            inputs.Add(fluidInput2);

            return(new Mixer(inputs, output, id));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 5
0
        public static Block Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo)
        {
            string id        = ParseTools.ParseID(node);
            string arrayName = ParseTools.ParseString(node, ARRAY_NAME_FIELD_NAME);

            parserInfo.CheckVariable(id, VariableType.FLUID_ARRAY, arrayName);

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

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


            dfg.AddNode(indexBlock);

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

            inputFluids.Add(fluidInput);

            return(new SetArrayFluid(indexBlock, arrayName, inputFluids, id));
        }