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 RefreshLists() { //Utilities.LogMessage("Entered: SMVessel.RefreshLists", Utilities.LogType.Info, SMSettings.VerboseLogging); if (Vessel == null) { return; } SMConditions.ListsUpdating = true; UpdatePartsByResource(); GetSelectedResourcesParts(); UpdateDockedVessels(); // now lets reconcile the selected parts based on the new list of resources... WindowManifest.ResolveResourcePartSelections(SMAddon.SmVessel.SelectedResources); // Now lets update the Resource Xfer Objects... TransferPump.UpdateDisplayPumps(); // now SM settings / hatches. if (SMSettings.EnableCls && SMConditions.CanShowShipManifest()) { if (SMAddon.GetClsAddon()) { SMAddon.UpdateClsSpaces(); if (SMAddon.GetClsVessel()) { GetHatches(); } } } // Control Window datasources GetDockedVessels(); GetHatches(); GetAntennas(); GetLights(); GetSolarPanels(); GetLabs(); WindowRoster.GetRosterList(); //Utilities.LogMessage("Exiting: SMVessel.RefreshLists", Utilities.LogType.Info, SMSettings.VerboseLogging); SMConditions.ListsUpdating = false; }
/// <summary> /// Removes Highlighting on parts belonging to the selected resource list. /// </summary> /// <param name="resourceParts"></param> internal static void ClearResourceHighlighting(List <Part> resourceParts) { if (resourceParts == null) { return; } List <Part> .Enumerator list = resourceParts.GetEnumerator(); while (list.MoveNext()) { ClearPartHighlight(list.Current); } list.Dispose(); if (!SMSettings.EnableCls || !SMSettings.EnableClsHighlighting || !SMAddon.GetClsVessel()) { return; } if (resourceParts.Count > 0 && resourceParts[0] != null) { SMAddon.ClsAddon.Vessel.Highlight(false); } }