protected override void OnLoad(ConfigNode node)
        {
            int sitID;

            string[] anomalyString = node.GetValue("Target_Anomaly").Split('|');
            if (int.TryParse(anomalyString[0], out sitID))
            {
                situation = (ExperimentSituations)sitID;
            }
            else
            {
                DMUtils.Logging("Failed To Load Anomaly Contract Situation Value; Parameter Set To Complete");
                this.SetComplete();
            }
            if (!bool.TryParse(anomalyString[1], out collected))
            {
                DMUtils.Logging("Failed To Load Anomaly Contract Collected State; Parameter Set To Complete");
                this.SetComplete();
            }
            name = anomalyString[2];
            DMUtils.availableScience["All"].TryGetValue(name, out scienceContainer);
            if (scienceContainer == null)
            {
                DMUtils.Logging("Failed To Load Anomaly Contract Science Container Variables; Parameter Set To Complete");
                this.SetComplete();
            }
            else
            {
                partName = scienceContainer.SciPart;
            }

            root = (DMAnomalyContract)this.Root;
        }
Example #2
0
        protected override void OnLoad(ConfigNode node)
        {
            int sitID = node.parse("Situation", (int)65);

            if (sitID >= 65 || sitID <= 0)
            {
                removeThis("Failed To Load Anomaly Contract Situation Value; Parameter Removed");
                return;
            }
            situation = (ExperimentSituations)sitID;

            collected = node.parse("Collected", (bool)true);

            name = node.parse("Name", "");
            if (string.IsNullOrEmpty(name))
            {
                removeThis("Failed To Load Anomaly Contract Science Container Variables; Removed");
                return;
            }

            if (!DMUtils.availableScience.ContainsKey("All"))
            {
                removeThis("Failed To Load Anomaly Contract Science Container Variables; Parameter Removed");
                return;
            }

            DMUtils.availableScience["All"].TryGetValue(name, out scienceContainer);
            if (scienceContainer == null)
            {
                removeThis("Failed To Load Anomaly Contract Science Container Variables; Parameter Removed");
                return;
            }
            else
            {
                partName = scienceContainer.SciPart;
            }

            try
            {
                root = (DMAnomalyContract)this.Root;
            }
            catch (Exception e)
            {
                removeThis("Could not find root anomaly contract; removing DMAnomalyParameter\n" + e);
                return;
            }
        }