Skip to content

Commit

Permalink
Replace DeepCopy with ConfigNode.CreateCopy
Browse files Browse the repository at this point in the history
It does 100% the same thing (and is recursive)
  • Loading branch information
blowfishpro committed Sep 8, 2017
1 parent d37f58b commit ca12c39
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions ModuleManager/MMPatchLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ public IEnumerator ApplyPatch(string Stage)
// it uses FindConfigNodeIn(src, nodeType, nodeName, nodeTag) to recurse.
public static ConfigNode ModifyNode(NodeStack original, ConfigNode mod, PatchContext context)
{
ConfigNode newNode = DeepCopy(original.value);
ConfigNode newNode = original.value.CreateCopy();
NodeStack nodeStack = original.ReplaceValue(newNode);

#region Values
Expand Down Expand Up @@ -2390,19 +2390,6 @@ private static void ShallowCopy(ConfigNode from, ConfigNode to)
to.nodes.Add(node);
}

private static ConfigNode DeepCopy(ConfigNode from)
{
ConfigNode to = new ConfigNode(from.name);
foreach (ConfigNode.Value value in from.values)
to.AddValue(value.name, value.value);
foreach (ConfigNode node in from.nodes)
{
ConfigNode newNode = DeepCopy(node);
to.nodes.Add(newNode);
}
return to;
}

private string PrettyConfig(UrlDir.UrlConfig config)
{
StringBuilder sb = new StringBuilder();
Expand Down

0 comments on commit ca12c39

Please sign in to comment.