RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

program to format initial spaces in .cs files

program to format initial spaces in .cs files

Consider this public domain. (source included)

It properly formats the initial spaces in each line inside the delivered file.
Just try it on the Program.cs file to see the result.
The new version is saved in a file with the same name and .new as suffix.

I should have made this to run from RunUO server, so more ppl see this, but oh well, maybe it is good enough to spread the word.
I'm currently thinking about more ways to improve this, but that will require some more time.
 

Attachments

  • CSFormatingConverter.zip
    5.4 KB · Views: 27
Thanks :) I had a quick glance at it again, removed an unimportant variable and made it recognize else, for, while. Atm, the system is flawed when it comes to variables named ifbool or fifteen... maybe I got an idea on that later.
 

Sep102

Page
Not to put down your program or anything at all like that, just felt I should mention it in case anyone doesn't know.

As BeneathTheStars may have been referring to in his post (I actually don't know) Visual Studio (at least the Professional version, I don't have the Express Editions so I can't check) can format your files or selections in those files for you. To format a selection, either press ctrl + k then ctrl + f or open the Edit menu, point to the Advaned option, then select Format Selection from the menu that appears. To do the same thing for the entire document, either select Format Document from the menu instead, or press ctrl + k then ctrl + d.

This will format the current document or selection to the format that is set up in Tools -> Options, Text Editor -> C# -> Formatting (Or will do a semi-default setting if the current file or selection's type doesn't support setting up the formatting for it).
 

Jeff

Lord
Sep102 said:
Not to put down your program or anything at all like that, just felt I should mention it in case anyone doesn't know.

As BeneathTheStars may have been referring to in his post (I actually don't know) Visual Studio (at least the Professional version, I don't have the Express Editions so I can't check) can format your files or selections in those files for you. To format a selection, either press ctrl + k then ctrl + f or open the Edit menu, point to the Advaned option, then select Format Selection from the menu that appears. To do the same thing for the entire document, either select Format Document from the menu instead, or press ctrl + k then ctrl + d.

This will format the current document or selection to the format that is set up in Tools -> Options, Text Editor -> C# -> Formatting (Or will do a semi-default setting if the current file or selection's type doesn't support setting up the formatting for it).
ctrl-a, ctrl-x, ctrl-v :) thats what i do :)
 

Sep102

Page
ctrl + a, ctrl + k, ctrl + f over here, Didn't even really know about the format document option until I actually opened up the menu again. (Mine's a bit better ergonomically as well, switch hands for each key stroke, all on the home row too :D)

Also, this reminds me for some reason, are there any other people out there who switched to VS 2005 a while ago from VS.NET 2003 and still can't get used to some of the key strokes? Even the ones that were the same in 6.0, like I still never use F7 to build, always ctrl + shift + b.
 

Kenko

Page
Jeff said:
ctrl-a, ctrl-x, ctrl-v :) thats what i do :)
I delete and re-write last bracket '}' '' '}', it rebuilds everything in between the brackets, so you can choose easily what to format
 

Khaz

Knight
Or just put in Ctrl+E, Ctrl+D to reformat the document, and Ctrl+E, Ctrl+F to format a selection. ;)

But, as said above, VS.NET can be bothersome to load up all the time. So, good job Kamuflaro.
 
Yes, Resharper is nice (if you like to get all your programming errors show up without compiling... others find the warnings and stuff just annoying :p)

Only drawback is the price of 199 USD - but if you could afford Visual Studio 2005 Professional for 799 USD, this should not be too expensive :p
 

yarex

Wanderer
Sotho Tal Ker said:
Yes, Resharper is nice (if you like to get all your programming errors show up without compiling... others find the warnings and stuff just annoying :p)
Only drawback is the price of 199 USD - but if you could afford Visual Studio 2005 Professional for 799 USD, this should not be too expensive :p

All warnings should be removed from good code ;). And ye, i agree that the price can be annoying ;) but there are many ways..... ;) if you know what i mean.
 
yarex said:
All warnings should be removed from good code ;)
I disagree, but afaik my code didn't give any warnings, when I wrote it.

Best example, try to remove css wc3 compatibility warnings, you will mess up everything. ;)
Or disable RUO house decay the easy way, as if you were no coder...
 

arul

Sorceror
Warnings at least lead to inefficient code, consciousnessly ignore them is as stupid as comparing 'standards' established by some self-invited HTML nerds to the serious coding errors.
 

Sep102

Page
Sotho Tal Ker said:
Yes, Resharper is nice (if you like to get all your programming errors show up without compiling... others find the warnings and stuff just annoying :p)

Only drawback is the price of 199 USD - but if you could afford Visual Studio 2005 Professional for 799 USD, this should not be too expensive :p
Or you can get Visual Studio 2005 Professional for free from MSDN Academic Alliance, in which case $199 for Resharper is quite a lot.
 
Top