public static LabEquipment getLabEquipmentFromNode(ConfigNode node, Lab lab) { if (node.name != CONFIG_NODE_NAME) { NE_Helper.logError("getLabEquipmentFromNode: invalid Node: " + node.name); return(getNullObject()); } string abb = node.GetValue(ABB_VALUE); string name = node.GetValue(NAME_VALUE); float mass = NE_Helper.GetValueAsFloat(node, MASS_VALUE); float cost = NE_Helper.GetValueAsFloat(node, COST_VALUE); string product = node.GetValue(PRODUCT_VALUE); float productPerHour = NE_Helper.GetValueAsFloat(node, PRODUCT_PER_HOUR_VALUE); string reactant = node.GetValue(REACTANT_VALUE); float reactantPerProduct = NE_Helper.GetValueAsFloat(node, REACTANT_PER_PRODUCT_VALUE); EquipmentRacks type = EquipmentRacksFactory.getType(node.GetValue(TYPE_VALUE)); LabEquipment eq = new LabEquipment(abb, name, type, mass, cost, productPerHour, product, reactantPerProduct, reactant); eq.lab = lab; ConfigNode expNode = node.GetNode(ExperimentData.CONFIG_NODE_NAME); if (expNode != null) { eq.loadExperiment(ExperimentData.getExperimentDataFromNode(expNode)); } return(eq); }
public static ExperimentData getExperimentDataFromNode(ConfigNode node) { if (node.name != CONFIG_NODE_NAME) { NE_Helper.logError("getLabEquipmentFromNode: invalid Node: " + node.name); return(getNullObject()); } float mass = NE_Helper.GetValueAsFloat(node, MASS_VALUE); float cost = NE_Helper.GetValueAsFloat(node, COST_VALUE); ExperimentData exp = ExperimentFactory.getExperiment(node.GetValue(TYPE_VALUE), mass, cost); exp.load(node); return(exp);; }
protected override void load(ConfigNode node) { base.load(node); res = node.GetValue(RES_VALUE); amount = NE_Helper.GetValueAsFloat(node, AMOUNT_VALUE); }
public static ExperimentData getExperiment(string type, float mass, float cost) { switch (type) { // // OMS/KLS Experiments // case "Test": return(new TestExperimentData(mass, cost)); case "CCF": return(new CCF_ExperimentData(mass, cost)); case "CFE": return(new CFE_ExperimentData(mass, cost)); case "FLEX": return(new FLEX_ExperimentData(mass, cost)); case "CFI": return(new CFI_ExperimentData(mass, cost)); case "MIS1": return(new MIS1_ExperimentData(mass, cost)); case "MIS2": return(new MIS2_ExperimentData(mass, cost)); case "MIS3": return(new MIS3_ExperimentData(mass, cost)); case "MEE1": return(new MEE1_ExperimentData(mass, cost)); case "MEE2": return(new MEE2_ExperimentData(mass, cost)); case "CVB": return(new CVB_ExperimentData(mass, cost)); case "PACE": return(new PACE_ExperimentData(mass, cost)); case "ADUM": return(new ADUM_ExperimentData(mass, cost)); case "SpiU": return(new SpiU_ExperimentData(mass, cost)); case "": return(ExperimentData.getNullObject()); } // Try to find in Kemini Register for (int idx = 0; idx < KeminiRegister.Count; idx++) { if (KeminiRegister[idx].GetValue("type") == type) { ConfigNode n = KeminiRegister[idx]; return(new KeminiExperimentData( n.GetValue("id"), n.GetValue("type"), n.GetValue("title"), n.GetValue("abbreviation"), mass, cost, NE_Helper.GetValueAsFloat(n, "labTime"))); } } NE_Helper.logError("Unknown ExperimentData Type '" + type + "'."); return(ExperimentData.getNullObject()); }