https://github.com/alandoherty/nodedescriptor
An object notation utility with a preprocessor and OOP-style format, wrote for C#
https://github.com/alandoherty/nodedescriptor
Last synced: 5 days ago
JSON representation
An object notation utility with a preprocessor and OOP-style format, wrote for C#
- Host: GitHub
- URL: https://github.com/alandoherty/nodedescriptor
- Owner: alandoherty
- License: mit
- Created: 2015-05-31T22:05:44.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-01-17T20:10:57.000Z (over 9 years ago)
- Last Synced: 2025-11-07T14:41:32.219Z (7 months ago)
- Language: C#
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NodeDescriptor
An object notation utility with a preprocessor and OOP-style format, wrote for C#. I'm going to implement proper node traversal methods soon, so the example below is not here to stay.
# Example
Program.cs:
```csharp
class Program {
static void Main(string[] args) {
NDF ndf = new NDF();
ndf.Import("test.ndf");
foreach(NDFNode node in ndf.Nodes) {
if (node is NDFKeyValueNode) {
Console.WriteLine("Key: " + node.Key + " Value: " + node.Value);
} else if (node is NDFObjectNode) {
NDFObjectNode objNode = (NDFObjectNode)objNode;
if (objNode.Type == "Language") {
Console.WriteLine("Object: " + objNode.Key + " Field Count: " + objNode.Table.Count);
}
}
}
}
}
```
test.ndf:
```csharp
#version 1
val Name = "Blah";
var Languages = ["English", "German"];
object English : Language {
val Author = "Alan";
val Strings = {
"hello" = "Hello",
"howdoing" = "How are you doing?"
}
}
object German : Language {
val Author = "Alan";
val Strings = {
"hello" = "Hallo",
"howdoing" = "Wie geht es Ihnen?"
}
}
```