Exemplo n.º 1
0
        public static Block Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo)
        {
            string id     = ParseTools.ParseID(node);
            string output = ParseTools.ParseString(node, OUTPUT_FLUID_FIELD_NAME);

            Validator.CheckVariableName(id, output);
            parserInfo.AddVariable(id, VariableType.FLUID, output);
            XmlNode innerNode = node.GetInnerBlockNode(INPUT_FLUID_FIELD_NAME, parserInfo, new MissingBlockException(id, "Fluid is missing fluid definition blocks."));

            if (innerNode != null)
            {
                switch (innerNode.GetAttributeValue(Block.TYPE_FIELD_NAME))
                {
                case HeaterUsage.XML_TYPE_NAME:
                    return(HeaterUsage.CreateHeater(output, innerNode, dfg, parserInfo));

                case Mixer.XmlTypeName:
                    return(Mixer.CreateMixer(output, innerNode, dfg, parserInfo));

                case Union.XML_TYPE_NAME:
                    return(Union.CreateUnion(output, innerNode, dfg, parserInfo));

                default:
                    return(CreateFluid(output, innerNode, dfg, parserInfo));
                }
            }
            return(null);
        }