private static void RestoreSampleMass(Vessel v, SubjectData filename, double restoredAmount) { if (v.loaded) // loaded vessel { foreach (var experiment in v.FindPartModulesImplementing <Experiment>()) { restoredAmount -= experiment.RestoreSampleMass(restoredAmount, filename.ExpInfo.ExperimentId); } } else // unloaded vessel { foreach (ProtoPartModuleSnapshot m in Lib.FindModules(v.protoVessel, "Experiment")) { restoredAmount -= Experiment.RestoreSampleMass(restoredAmount, m, filename.ExpInfo.ExperimentId); if (restoredAmount < double.Epsilon) { return; } } } }
private static void RestoreSampleMass(Vessel v, string filename, double restoredAmount) { int i = filename.IndexOf('@'); var id = i > 0 ? filename.Substring(0, i) : filename; if (v.loaded) // loaded vessel { foreach (var experiment in v.FindPartModulesImplementing <Experiment>()) { restoredAmount -= experiment.RestoreSampleMass(restoredAmount, id); } } else // unloaded vessel { foreach (ProtoPartModuleSnapshot m in Lib.FindModules(v.protoVessel, "Experiment")) { restoredAmount -= Experiment.RestoreSampleMass(restoredAmount, m, id); if (restoredAmount < double.Epsilon) { return; } } } }