Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
        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;
        }