Skip to content

Commit 8f1a203

Browse files
committed
Copy and Delete root Node
1 parent d8f9490 commit 8f1a203

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
1818
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
1919

20-
[assembly: AssemblyVersion("2.0.7")]
20+
[assembly: AssemblyVersion("2.0.8")]
2121

2222
// The following attributes are used to specify the signing key for the assembly,
2323
// if desired. See the Mono documentation for more information about signing.

moduleManager.cs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public void Update()
480480

481481
static string status = "Processing Module Manager patch\nPlease 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

Comments
 (0)