title: C# treeview from dot notation flat file
body: <p>I have a flat file that looks like this:</p>
  
  <pre><code>.root:NODE
  .root.branch1:NODE
  .root.branch1.size:INT
  .root.branch1.name:STRING
  .root.branch2:NODE
  .root.branch2.flavor:NODE
  .root.branch2.flavor.cost:INT
  .root.branch2.flavor.name:STRING
  </code></pre>
  
  <p>The file contents, depth, lenght, etc., will be different every time, so I can't hardcode anything (though the nodes will always be of datatype 'NODE'). I need to bring it into C# as a data source. I'm not sure what the best way to parse the file is to convert it to a structure that looks like</p>
  
  <pre><code>+root
   +branch1
     size:
     name:
   +branch2
    +flavor
     cost:
     name:
  </code></pre>
  
  <p>etc. Ideally, I'd like to dynamically build a treeview control that the user can use to select the node he'd like to access (these tags are paths to an actual datasource; so elsewhere in the code, I'm using)</p>
  
  <pre><code>int iVal = somefunction.readvar(".root.branch2.flavor.cost");
  </code></pre>
  
  <p>/edit/ if it helps, the file I'm trying  to parse is a *.SYM file (a symbols file) generated by a TwinCat 2 program. There's a little documentation here: <a href="http://infosys.beckhoff.com/content/1033/tcplccontrol/html/tcplcctrl_componentsoptions.htm#Symbol%20configuration" rel="nofollow">http://infosys.beckhoff.com/content/1033/tcplccontrol/html/tcplcctrl_componentsoptions.htm#Symbol%20configuration</a></p>