Ejemplo n.º 1
0
        public static ExpStatus Load(ConfigNode node, SkylabExperiment instance = null)
        {
            var expStatus = new ExpStatus();

            node.TryGetValue("expId", ref expStatus.expId);
            node.TryGetValue("key", ref expStatus.key);
            node.TryGetValue("bodyName", ref expStatus.bodyName);
            node.TryGetEnum <ExperimentSituations>("vesselSit", ref expStatus.vesselSit, 0);
            node.TryGetValue("biome", ref expStatus.biome);
            node.TryGetValue("processedResource", ref expStatus.processedResource);
            node.TryGetValue("reqResource", ref expStatus.reqResource);
            node.TryGetValue("reqAmount", ref expStatus.reqAmount);
            node.TryGetValue("active", ref expStatus.active);
            node.TryGetValue("lastTimeUpdated", ref expStatus.lastTimeUpdated);
            if (expStatus.active)
            {
                ModuleScienceExperiment exp = new ModuleScienceExperiment();
                exp.experimentID = expStatus.expId;
                if (experiments[expStatus.expId].xmitDataScalar > 0)
                {
                    exp.xmitDataScalar = experiments[expStatus.expId].xmitDataScalar;
                }

                if (instance != null)
                {
                    instance.SetUpActiveExperiment(expStatus.expId, expStatus.biome, exp, expStatus.reqResource, expStatus.processedResource);
                }
            }
#if false
            Log.Info("ExpStatus.Load, expId: " + expStatus.expId + ", key: " + expStatus.key + ", bodyName: " + expStatus.bodyName +
                     ", vesselSit: " + expStatus.vesselSit + ", biome: " + expStatus.biome + ", processedResource: " + expStatus.processedResource +
                     ", reqAmount: " + expStatus.reqAmount + ", active: " + expStatus.active);
#endif
            return(expStatus);
        }