Skip to content

Commit

Permalink
Add name value to applying patch messages
Browse files Browse the repository at this point in the history
Makes debugging patches easier, since multiple root nodes can save the same url

Resolves #143
  • Loading branch information
blowfishpro committed Apr 20, 2019
1 parent a0c1dfc commit 7271725
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ModuleManager/ProtoUrlConfig.cs
Expand Up @@ -29,6 +29,9 @@ public ProtoUrlConfig(UrlDir.UrlFile urlFile, ConfigNode node)
Node = node ?? throw new ArgumentNullException(nameof(node));
FileUrl = UrlFile.url + '.' + urlFile.fileExtension;
FullUrl = FileUrl + '/' + Node.name;

if (node.GetValue("name") is string nameValue)
FullUrl += '[' + nameValue + ']';
}
}
}
13 changes: 13 additions & 0 deletions ModuleManagerTests/ProtoUrlConfigTest.cs
Expand Up @@ -70,5 +70,18 @@ public void TestFullUrl()

Assert.Equal("abc/def.cfg/SOME_NODE", protoUrlConfig.FullUrl);
}

[Fact]
public void TestFullUrl__NameValue()
{
ConfigNode node = new TestConfigNode("SOME_NODE")
{
{ "name", "some_value" },
};

ProtoUrlConfig protoUrlConfig = new ProtoUrlConfig(UrlBuilder.CreateFile("abc/def.cfg"), node);

Assert.Equal("abc/def.cfg/SOME_NODE[some_value]", protoUrlConfig.FullUrl);
}
}
}

0 comments on commit 7271725

Please sign in to comment.