Пример #1
0
 public static void LoadConfigs(ConfigNode node)
 {
     if (ConfigsLoaded)
     {
         return;
     }
     Configs.Clear();
     NamedConfigs.Clear();
     foreach (var n in node.GetNodes())
     {
         if (n.name == VSL_NODE)
         {
             foreach (var c in n.GetNodes(VesselConfig.NODE_NAME))
             {
                 var config = new VesselConfig();
                 config.Load(c);
                 Configs[config.VesselID] = config;
             }
         }
         else if (n.name == NAMED_NODE)
         {
             foreach (var c in n.GetNodes(NamedConfig.NODE_NAME))
             {
                 var config = new NamedConfig();
                 config.Load(c);
                 NamedConfigs[config.Name] = config;
             }
         }
     }
     VAB_DefaultConfig.LoadFrom(node, "VAB_DefaultConfig");
     SPH_DefaultConfig.LoadFrom(node, "SPH_DefaultConfig");
     ConfigsLoaded = true;
 }
Пример #2
0
 public static void LoadLegacyConfigs(ConfigNode node)
 {
     Configs.Clear();
     NamedConfigs.Clear();
     foreach (var n in node.GetNodes())
     {
         if (n.name == HighLogic.CurrentGame.Title.Split()[0])
         {
             foreach (var c in n.GetNodes(VesselConfig.NODE_NAME))
             {
                 var config = new VesselConfig();
                 config.Load(c);
                 Configs[config.VesselID] = config;
             }
         }
         else if (n.name == NAMED_NODE)
         {
             foreach (var c in n.GetNodes(NamedConfig.NODE_NAME))
             {
                 var config = new NamedConfig();
                 config.Load(c);
                 NamedConfigs[config.Name] = config;
             }
         }
     }
 }