I need help from someone someone smarter than I am to solve this puzzle.
I have a Registry branch that I want to convert into a file structure. Users make changes in the file structure, mostly because its easier for lusers to manipulate files. Then I can write those changes back to the registry. (I realize the risk here, please don't tell me that doing this is "bad", I know. This code is for a personal project and not going into any production models!)
So far my code works great:
This translates great to:
However, since the registry is NOT a file structure, we can have "bad" keys such as:
This makes a file named Banana, in directory ...\Branch2\SubBranch1\Apple. Obviously. I thought about replacing the '\' with something, but what?
There is also an issue with ending a key or value with a '.' The file will not have the period.
Does anyone have a solution (or suggestion) to obtain the intended result?