Go Back   RunUO - Ultima Online Emulation > Developer's Corner > Programming > C#

C# C# Discussion

Reply
 
Thread Tools Display Modes
Old 08-10-2006, 12:51 AM   #1 (permalink)
Forum Expert
 
Join Date: Feb 2004
Age: 27
Posts: 1,834
Default 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.
Attached Files
File Type: zip CSFormatingConverter.zip (5.4 KB, 24 views)

Last edited by Kamuflaro; 08-12-2006 at 10:58 PM.
Kamuflaro is offline   Reply With Quote
Old 08-11-2006, 07:02 PM   #2 (permalink)
Forum Expert
 
BeneathTheStars's Avatar
 
Join Date: Jul 2005
Location: (South)Tip o' Texas
Posts: 1,294
Send a message via AIM to BeneathTheStars Send a message via MSN to BeneathTheStars
Default

Nice job on this, could be handy when i dont want to open something up in VS just to clean it up.
BeneathTheStars is offline   Reply With Quote
Old 08-12-2006, 11:02 PM   #3 (permalink)
Forum Expert
 
Join Date: Feb 2004
Age: 27
Posts: 1,834
Default

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.
Kamuflaro is offline   Reply With Quote
Old 08-13-2006, 08:50 PM   #4 (permalink)
Forum Expert
 
Join Date: Aug 2004
Location: Redmond, WA
Age: 21
Posts: 1,288
Send a message via AIM to Sep102 Send a message via MSN to Sep102
Default

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).
Sep102 is offline   Reply With Quote
Old 08-14-2006, 05:35 PM   #5 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,763
Default

Quote:
Originally Posted by Sep102
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
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 08-14-2006, 06:18 PM   #6 (permalink)
Forum Expert
 
Join Date: Feb 2004
Age: 27
Posts: 1,834
Default

Ah cool thanks, I didn't even know that.
Kamuflaro is offline   Reply With Quote
Old 08-14-2006, 07:58 PM   #7 (permalink)
Forum Expert
 
Join Date: Aug 2004
Location: Redmond, WA
Age: 21
Posts: 1,288
Send a message via AIM to Sep102 Send a message via MSN to Sep102
Default

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 )

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.

Last edited by Sep102; 08-14-2006 at 08:11 PM.
Sep102 is offline   Reply With Quote
Old 09-07-2006, 01:36 PM   #8 (permalink)
Forum Newbie
 
Join Date: Jun 2005
Age: 31
Posts: 45
Default

Get the Resharper plugin.

It's VERY good and does similar job.

But it's payed, ;((((.
yarex is offline   Reply With Quote
Old 11-01-2006, 08:19 AM   #9 (permalink)
Forum Expert
 
Kenko's Avatar
 
Join Date: Dec 2004
Location: Land of the Poor
Posts: 1,828
Send a message via MSN to Kenko
Default

Quote:
Originally Posted by Jeff
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
Kenko is offline   Reply With Quote
Old 11-01-2006, 12:11 PM   #10 (permalink)
Forum Expert
 
Khaz's Avatar
 
Join Date: Mar 2003
Posts: 1,754
Default

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.
__________________
"Misfortune shows those who are not really friends." -Aristotle
"A multitude of words is no proof of a prudent mind." -Thales
Khaz is offline   Reply With Quote
Old 11-15-2006, 04:26 AM   #11 (permalink)
Forum Expert
 
Join Date: Mar 2005
Location: Berlin, Germany
Age: 26
Posts: 1,136
Send a message via ICQ to Sotho Tal Ker Send a message via MSN to Sotho Tal Ker
Default

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 )

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
Sotho Tal Ker is offline   Reply With Quote
Old 11-15-2006, 05:35 AM   #12 (permalink)
Forum Newbie
 
Join Date: Jun 2005
Age: 31
Posts: 45
Default

Quote:
Originally Posted by Sotho Tal Ker
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 )
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
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 is offline   Reply With Quote
Old 11-15-2006, 10:13 AM   #13 (permalink)
Forum Expert
 
Join Date: Feb 2004
Age: 27
Posts: 1,834
Default

Quote:
Originally Posted by yarex
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...
Kamuflaro is offline   Reply With Quote
Old 11-15-2006, 10:38 AM   #14 (permalink)
Forum Expert
 
arul's Avatar
 
Join Date: Jan 2005
Location: Hic sunt leones ...
Age: 21
Posts: 1,278
Send a message via MSN to arul
Default

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.
__________________
Angels are falling the very last time, down they're burning in hate and decline, unfaithful and violent we're breaking the spell, we're god, we're scissor, in heaven and hell!
arul is offline   Reply With Quote
Old 11-15-2006, 04:27 PM   #15 (permalink)
Forum Expert
 
Join Date: Aug 2004
Location: Redmond, WA
Age: 21
Posts: 1,288
Send a message via AIM to Sep102 Send a message via MSN to Sep102
Default

Quote:
Originally Posted by Sotho Tal Ker
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 )

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
Or you can get Visual Studio 2005 Professional for free from MSDN Academic Alliance, in which case $199 for Resharper is quite a lot.
Sep102 is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5