internal void GetHatches() { _hatches.Clear(); try { if (!SMSettings.EnableCls || !SMConditions.CanShowShipManifest()) { return; } if (!SMAddon.GetClsAddon()) { return; } SMAddon.UpdateClsSpaces(); if (!SMAddon.GetClsVessel()) { return; } List <ICLSPart> .Enumerator hParts = SMAddon.ClsAddon.Vessel.Parts.GetEnumerator(); while (hParts.MoveNext()) { if (hParts.Current == null) { continue; } List <PartModule> .Enumerator hModules = hParts.Current.Part.Modules.GetEnumerator(); while (hModules.MoveNext()) { if (hModules.Current == null) { continue; } PartModule pModule = (PartModule)hModules.Current; if (pModule.moduleName != "ModuleDockingHatch") { continue; } ModHatch pHatch = new ModHatch { HatchModule = (PartModule)hModules.Current, ClsPart = hParts.Current }; _hatches.Add(pHatch); } hModules.Dispose(); } hParts.Dispose(); } catch (Exception ex) { SmUtils.LogMessage($"Error in GetHatches().\r\nError: {ex}", SmUtils.LogType.Error, true); } }
internal void GetHatches() { _hatches.Clear(); try { List <ICLSPart> .Enumerator hParts = SMAddon.ClsAddon.Vessel.Parts.GetEnumerator(); while (hParts.MoveNext()) { if (hParts.Current == null) { continue; } IEnumerator hModules = hParts.Current.Part.Modules.GetEnumerator(); while (hModules.MoveNext()) { if (hModules.Current == null) { continue; } PartModule pModule = (PartModule)hModules.Current; if (pModule.moduleName != "ModuleDockingHatch") { continue; } ModHatch pHatch = new ModHatch { HatchModule = (PartModule)hModules.Current, ClsPart = hParts.Current }; _hatches.Add(pHatch); } } hParts.Dispose(); } catch (Exception ex) { SmUtils.LogMessage($"Error in GetHatches().\r\nError: {ex}", SmUtils.LogType.Error, true); } }
internal void GetHatches() { _hatches.Clear(); try { foreach (ICLSPart iPart in SMAddon.clsAddon.Vessel.Parts) { foreach (PartModule pModule in iPart.Part.Modules) { if (pModule.moduleName == "ModuleDockingHatch") { ModHatch pHatch = new ModHatch(); pHatch.HatchModule = pModule; pHatch.CLSPart = iPart; _hatches.Add(pHatch); } } } } catch (Exception ex) { Utilities.LogMessage(string.Format("Error in GetHatches().\r\nError: {0}", ex.ToString()), "Error", true); } }