Q:

Read File with structur, show it and write it

I have the following two files (those are language files from a ruby on rails project):
en:
  calendar:
    check:
      invalid_date: 'Date is invalid'
      wrong_input_format: "The date should have following format<br/>%{format}"

  globals:
    yestext: "Yes"
    notext: "No"

Second File:
de:
  calendar:
    check:
      invalid_date: 'Datum ist ungültig'
      wrong_input_format: "Das Datum muss das folgende Format haben <br/>%{format}"

  globals:
    yestext: "Ja"
    notext: "Nein"

I need a simple WinForms-Application that shows me the file for editing and saving in a Spreedsheet:

What is the best way to realize this?
I am a newbie.

A:

What I would do is probably:
Build a reader class for the files that is reusable for any number of files (languages) and save it in a Dictionary<String,<Dictionary<String,String>>
where it would hold the values: Dictionary<Language,<Dictionary<Key,Value>>
Now walk the outer and inner dictionaries and add the items to a table to show. Find the key in first column, if found add to the column you are currently handling. If not found add a new row at the end.
To save changes I would again write a class that takes care of a single file and save all keys that have a value.
I see there are ' and " used. If that is essential save the type. In that case I would not use String for the value, but create a simple class with the value and String sign.
HINT: This would be much easier using a tree for editing the entries.
In that case you don't have to translate the noded design of the original file and visa versa:
Sample: http://www.codeproject.com/Articles/23746/TreeView-with-Columns but there are many out there.

