Skip to content

Commit 7271725

Browse files
committed
Add name value to applying patch messages
Makes debugging patches easier, since multiple root nodes can save the same url Resolves sarbian#143
1 parent a0c1dfc commit 7271725

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

ModuleManager/ProtoUrlConfig.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public ProtoUrlConfig(UrlDir.UrlFile urlFile, ConfigNode node)
2929
Node = node ?? throw new ArgumentNullException(nameof(node));
3030
FileUrl = UrlFile.url + '.' + urlFile.fileExtension;
3131
FullUrl = FileUrl + '/' + Node.name;
32+
33+
if (node.GetValue("name") is string nameValue)
34+
FullUrl += '[' + nameValue + ']';
3235
}
3336
}
3437
}

ModuleManagerTests/ProtoUrlConfigTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,18 @@ public void TestFullUrl()
7070

7171
Assert.Equal("abc/def.cfg/SOME_NODE", protoUrlConfig.FullUrl);
7272
}
73+
74+
[Fact]
75+
public void TestFullUrl__NameValue()
76+
{
77+
ConfigNode node = new TestConfigNode("SOME_NODE")
78+
{
79+
{ "name", "some_value" },
80+
};
81+
82+
ProtoUrlConfig protoUrlConfig = new ProtoUrlConfig(UrlBuilder.CreateFile("abc/def.cfg"), node);
83+
84+
Assert.Equal("abc/def.cfg/SOME_NODE[some_value]", protoUrlConfig.FullUrl);
85+
}
7386
}
7487
}

0 commit comments

Comments
 (0)