void init_supported_types()
 {
     exclude        = Utils.ParseLine(ExcludeTankTypes, Utils.Comma);
     include        = Utils.ParseLine(IncludeTankTypes, Utils.Comma);
     SupportedTypes = SwitchableTankType.TankTypeNames(include, exclude);
     SupportedTypes.AddRange(VolumeConfigsLibrary.AllConfigNames(include, exclude));
     if (SupportedTypes.Count > 0)
     {
         selected_tank_type = SupportedTypes[0];
     }
 }
Example #2
0
 bool init_tank_type()
 {
     if (Volume < 0)
     {
         Volume = Metric.Volume(part);
     }
     if (tank_type != null)
     {
         return(true);
     }
     boiloff = null;
     //if tank type is not provided, use the first one from the library
     if (string.IsNullOrEmpty(TankType))
     {
         TankType = SwitchableTankType.TankTypeNames(include, exclude)[0];
     }
     //select tank type from the library
     if (!SwitchableTankType.TankTypes.TryGetValue(TankType, out tank_type))
     {
         Utils.Message(6, "No \"{0}\" tank type in the library.\n" +
                       "Configuration of \"{1}\" is INVALID.",
                       TankType, this.Title());
     }
     if (tank_type == null)
     {
         return(false);
     }
     //initialize current resource
     if (CurrentResource == string.Empty ||
         !tank_type.Resources.ContainsKey(CurrentResource))
     {
         CurrentResource = tank_type.DefaultResource.Name;
     }
     //initialize boiloff/cooling
     if (tank_type.Boiloff || tank_type.Cooling)
     {
         boiloff = tank_type.Boiloff? new ResourceBoiloff(this) : new ActiveCooling(this);
         if (ModuleSave != null)
         {
             boiloff.LoadFrom(ModuleSave);
         }
         cooler = boiloff as ActiveCooling;
     }
     return(true);
 }
        public static List <string> AllConfigNames(string[] include, string[] exclude)
        {
            var names = new List <string>();

            if (include != null && include.Length > 0)
            {
                exclude = SwitchableTankType.TankTypeNames(null, include).ToArray();
            }
            if (exclude != null && exclude.Length > 0)
            {
                names.AddRange(from cfg in PresetConfigs
                               where cfg.Value.ContainsTypes(exclude)
                               select cfg.Value.name);
                names.AddRange(from cfg in UserConfigs
                               where cfg.Value.ContainsTypes(exclude)
                               select cfg.Value.name);
            }
            else
            {
                names.AddRange(PresetConfigs.Keys);
                names.AddRange(UserConfigs.Keys);
            }
            return(names);
        }
Example #4
0
 void init_supported_types()
 {
     include        = Utils.ParseLine(IncludeTankTypes, Utils.Comma);
     exclude        = Utils.ParseLine(ExcludeTankTypes, Utils.Comma);
     SupportedTypes = SwitchableTankType.TankTypeNames(include, exclude);
 }