private bool setTargetExperiment(string exp) { experiment = PartLoader.getPartInfoByName(exp); if (experiment == null) { NE_Helper.logError("Couldn't find experiment part: " + exp); return(false); } return(true); }
/** Returns a collection of all loaded KEES experiments */ public static ReadOnlyCollection <Experiment> getExperiments() { if (experimentParts == null) { /* Only load the parts if we haven't loaded them already */ try { /* Find all KEES experiments and add them to our registry for generating contracts. */ List <Experiment> el = new List <Experiment>(); ConfigNode[] experiments = GameDatabase.Instance.GetConfigNodes("EXPERIMENT_DEFINITION"); for (int idx = 0; idx < experiments.Length; idx++) { ConfigNode ed = experiments[idx]; string experimentId = ed.GetValue("id"); if (experimentId != null && experimentId.StartsWith("NE_KEES")) { string experimentPartName = experimentId.Replace('_', '.'); if (PartLoader.getPartInfoByName(experimentPartName) != null) { string experimentTitle = ed.GetValue("title"); string experimentShortName = ed.GetValue("shortDisplayName"); string experimentAbbreviation = ed.GetValue("abbreviation"); el.Add(new Experiment(experimentPartName, experimentTitle, experimentShortName, experimentAbbreviation)); } else { NE_Helper.logError("KEES Configuration mismatch - experiment " + experimentId + " defined, but no matching part found."); } } } experimentParts = new ReadOnlyCollection <Experiment>(el); } catch (Exception e) { NE_Helper.logError("Could not initialize list of KEES Experiments for the Contract Engine: " + e.Message); experimentParts = new ReadOnlyCollection <Experiment>(new Experiment[0]); } } return(experimentParts); }