internal static void FreezeKerbal(ProtoCrewMember kerbal) { try { if (!InstalledMods.IsDfApiReady) { return; } List <Part> .Enumerator cryofreezers = SmUtils.GetFreezerParts().GetEnumerator(); while (cryofreezers.MoveNext()) { if (cryofreezers.Current == null) { continue; } if (!cryofreezers.Current.protoModuleCrew.Contains(kerbal)) { continue; } // ReSharper disable once SuspiciousTypeConversion.Global PartModule deepFreezer = SMConditions.GetFreezerModule(cryofreezers.Current); if (deepFreezer != null) { new DfWrapper.DeepFreezer(deepFreezer).BeginFreezeKerbal(kerbal); } break; } cryofreezers.Dispose(); } catch (Exception ex) { SmUtils.LogMessage($" in FreezeKerbal. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", SmUtils.LogType.Error, true); } }
internal static void ThawKerbal(string kerbalName) { try { if (InstalledMods.IsDfApiReady) { DfWrapper.KerbalInfo iKerbal = DfWrapper.DeepFreezeApi.FrozenKerbals[kerbalName]; List <Part> .Enumerator cryofreezers = SmUtils.GetFreezerParts().GetEnumerator(); while (cryofreezers.MoveNext()) { if (cryofreezers.Current == null) { continue; } if (cryofreezers.Current.flightID == iKerbal.PartId) { // ReSharper disable once SuspiciousTypeConversion.Global PartModule deepFreezer = SMConditions.GetFreezerModule(cryofreezers.Current); if (deepFreezer != null) { new DfWrapper.DeepFreezer(deepFreezer).BeginThawKerbal(kerbalName); } break; } } cryofreezers.Dispose(); } else { SmUtils.LogMessage($"ThawKerbal. IsDFInstalled: {InstalledMods.IsDfInstalled}", SmUtils.LogType.Info, true); } } catch (Exception ex) { SmUtils.LogMessage($" in ThawKerbal. Error: {ex.Message} \r\n\r\n{ex.StackTrace}", SmUtils.LogType.Error, true); } }