We have a code generator that prints the schema of this database to automate our internal n-tier architecture. The result is several C # classes, one for each file.
In the code, in order to execute all the lines, we try to adhere to indentation and formatting as much as possible, but whenever you open a file in Visual Studio, formatting is a mistake. The quick ctrl-k, ctrl-d fixes it, but obviously this reformatting is lost the next time the class is created.
What I would like to know is there a way that I can somehow automatically format the contents of a text file in the same way as Visual Studio does?
Pseudo code
Create "code" object, passing text file to constructor Invoke "format" method Re-save text file
Any help is greatly appreciated.
EDIT: I have to clarify - I want to be able to call formatting from my C # code, which creates a text file containing my generated C #. The code format can be standardized (not required for each developer), and I do not want to install any third-party applications.
It seems that I remember there a namespace containing many classes for creating C # in C #: http://msdn.microsoft.com/en-us/library/system.codedom(VS.80).aspx , but I'm not sure if it contains any classes that could help.
FURTHER EDITION: My code generator is a winforms application deployed through a one-time installation. It is used by many developers within the company. I need a solution that does not require each developer to have the tool installed on their machine.
source share