@@ -480,7 +480,7 @@ public void Update()
480480
481481 static string status = "Processing Module Manager patch\n Please Wait..." ;
482482 static string errors = "" ;
483-
483+
484484 public void OnGUI ( )
485485 {
486486 if ( HighLogic . LoadedScene != GameScenes . LOADING )
@@ -508,7 +508,7 @@ public void OnGUI()
508508 public void ApplyPatch ( List < String > excludePaths , string Stage )
509509 {
510510 print ( "[ModuleManager] " + Stage + ( Stage == ":FIRST" ? " (default) pass" : " pass" ) ) ;
511- foreach ( UrlDir . UrlConfig mod in GameDatabase . Instance . root . AllConfigs )
511+ foreach ( UrlDir . UrlConfig mod in GameDatabase . Instance . root . AllConfigs . ToArray ( ) )
512512 {
513513 if ( mod . type [ 0 ] == '@' || ( mod . type [ 0 ] == '$' ) || ( mod . type [ 0 ] == '!' ) )
514514 {
@@ -585,7 +585,7 @@ public void ApplyPatch(List<String> excludePaths, string Stage)
585585 continue ;
586586 }
587587
588- foreach ( UrlDir . UrlConfig url in GameDatabase . Instance . root . AllConfigs )
588+ foreach ( UrlDir . UrlConfig url in GameDatabase . Instance . root . AllConfigs . ToArray ( ) )
589589 {
590590 if ( url . type == type
591591 && WildcardMatch ( url . name , pattern )
@@ -601,25 +601,22 @@ public void ApplyPatch(List<String> excludePaths, string Stage)
601601 }
602602 else if ( mod . type [ 0 ] == '$' )
603603 {
604- // Here we would duplicate an Node if it did not create an exception since we modfiy an enum while it is used
605-
606- //ConfigNode clone = ConfigManager.ModifyNode(url.config, mod.config);
607- //if (url.config.name != mod.name)
608- //{
609- // print("[ModuleManager] Copying Node " + url.config.name + " into " + clone.name);
610- // url.parent.configs.Add(new UrlDir.UrlConfig(url.parent, clone));
611- //}
612- //else
613- //{
614- // errorCount++;
615- // print("[ModuleManager] Error while processing " + mod.config.name + " the copy need to have a different name than the parent (use @name = xxx)");
616- //}
604+ ConfigNode clone = ConfigManager . ModifyNode ( url . config , mod . config ) ;
605+ if ( url . config . name != mod . name )
606+ {
607+ print ( "[ModuleManager] Copying Node " + url . config . name + " into " + clone . name ) ;
608+ url . parent . configs . Add ( new UrlDir . UrlConfig ( url . parent , clone ) ) ;
609+ }
610+ else
611+ {
612+ errorCount ++ ;
613+ print ( "[ModuleManager] Error while processing " + mod . config . name + " the copy needs to have a different name than the parent (use @name = xxx)" ) ;
614+ }
617615 }
618616 else if ( mod . type [ 0 ] == '!' )
619617 {
620- // Same problem
621- //print("[ModuleManager] Deleting Node " + url.config.name);
622- //url.parent.configs.Remove(url);
618+ print ( "[ModuleManager] Deleting Node " + url . config . name ) ;
619+ url . parent . configs . Remove ( url ) ;
623620 }
624621 }
625622 }
0 commit comments