How to programmatically create custom comment tokens - c#

I am writing a small Visual Studio addin to let the user use more features of the comment tokens (TODO, HACK, etc.). For this I want to extend Visual Studio with new commands (such as TODISCUSS, TODELETE, FIXME, TESTME, etc.). I'd like to do this programmatically when my addin starts.
I already found out how to do this manually: http://msdn.microsoft.com/en-us/library/ekwz6akh%28v=vs.80%29.aspx
Does anyone have an idea how this could be done via the API?
Any ideas or suggestions would be appreciated!

Edit :
See this MSDN Link perhaps digging around in TaskList will get you somewhere.
Original Post :
It's not very clear (to me :) what exactly you want to do. Is it: find, edit, or refactor the tokens and then do something else with the sources? I can suggest this article on Code Project (NRefactory).
Using NRefactory you can do anything and everything with the source files including locating the tokens you want and doing stuff with them. You will also know the files you found them in, line numbers etc.
Perhaps you will be able to use Nrefactory to do all the heavy lifting as far as sources are concerned.

Related

Access IVsFontAndColorDefaults to read complete existing VS theme information

I am new at working on a Visual Studio extension. I would like to access the complete font and color information for the current theme using C# I want to access this as a AllColorableItemInfo structure as this structure includes more information (e.g. flags and the localized name) for the each item. I believe that I need to use IVsFontAndColorDefaults interface to do this but I don't know how to get this. This is probably easy but I cannot figure out how to do it. I very much appreciate any help.
I think that you are probably on the wrong track IVsFontAndColorDefaults. The documentation seems to indicate, that this is an interface a Visual Studio Package would implement, rather than use itself.
I have some code which accesses the colors used in Visual Studio. It is based almost exactly on this article by Carlos Quintero. The code is in VB.NET, but it would be easy to port to C#.
Alternatively, you might find what you are looking for in the interface IVsFontAndColorStorage.
You can get that interface with code like
IVsFontAndColorStorage fontAndColorStorage =
GetService(typeof(SVsFontAndColorStorage)) as IVsFontAndColorStorage;
which I took from this posting this posting on Stack Overflow

Verifying user via email

Does anyone know good sample code, using ASP.net security, that sets up a sample Visual Studio 2010 application, along with a log in page, and the logic/code to verify users who sign up via email? I feel like this must have been written thousands of times.
I will give you the URL that I started with. You can go form that to a different approach if you like but that is well explained and you can understand what you need to do:
http://forums.asp.net/post/1860807.aspx
please notice that the example there is old and you will need some ADO.NET understanding but the idea is the same

Autoupdating software using intranet

i searched for the topic but didn't find exactly that kind of problem.
I want to create a C# WinForms software which should run only in intranet. If i change the software afterwards i would like to have the application to look automatically in the network for a newer version. Is a newer version available it should replace the old one. Maybe there is some tool or library to achieve that?
Further Information: The software does not use a database and consists only out of one .exe file. No other stuff or files needed.
I don't want to setup a server or something like that for this task. I want it as simple and clean as possible.
Thanks in advance.
Joe
I think clickonce may help you. see http://msdn.microsoft.com/en-us/library/t71a733d(v=vs.80).aspx for more details
I really like the updateSystem.NET-lib, but which is only available in german. If you can understand the easy API, this is exactly what you are searching for.
Here, you can find a little tutorial, also in german.

Possible to inject resource files into .net assembly?

There's a .net program for students that I've been messing around with in Reflector and Reflexil, but it doesn't look like they can work with resource files. I want to replace the default background with a custom one. How feasible is this?
I've tried exporting the assembly as a C# project and maybe rebuilding with the resource files swapped, but a few classes won't decompile right when exporting and crashes Reflector when I try to view the full source code inside reflector (after clicking 'expand methods')
What type of applicaiton is it? WinForms, WPF, Silverlight, Web? You can do it with ILDasm round triping. If you let me know what type of app it is I'll post the steps you need to take.
Reflexil 1.3 is now able to handle resources.
Quite difficult, probably Hex Editor can help.
Resource Hacker can do it. Follow; Action > Add a new Resource
delphi.icm.edu.pl/ftp/tools/ResHack.zip
I just put out GrayWolf to edit programs, I don't have the ability to edit resource(s) (if you donate$:) yet
but I would think the easy change is to edit the program to load the background from disk (./back1.jpg)
I have others tools that would make it easy to change the background of the running program see
"Hacking .NET" at DefCon18
other tools "GrayDragon"
I have a payload that does just this, it is for DefCon19, but if you send me an e-mail...
Happy hunting

Visual Studio - Tool to replace hard coded strings with resources

I have a big ASP.NET project full of hard coded strings, that now have to be extracted to resources. Such strings can be found almost anywhere (in .cs files, .aspx files, .ascx files, etc.) and the amount of files is huge. What I'm looking for is a tool (or any way) to find all these hard coded strings in one shot and put them all together in the resource file, instead of me going manually through each file. Does anything like this exist?
Note: I'm aware that it would have been better to put the strings in resources straight away when they were needed the first time, but this is a 2 years old project where nobody really cared (typical example of "not my problem" philosophy).
Thank you very much.
UPDATE: I tried CodeRush (I couldn't try RGreatEx for obvious reasons), and I'm having difficulties using it. The main issue is that the strings I'm looking for are located mainly in .aspx files, and strings in those files don't have the "Refactor to resource" command available.
For example, I can have elements like this:
<dxwgv:ASPxSummaryItem DisplayFormat="{0}" FieldName="TOTAL" ShowInColumn="Total" SummaryType="Sum" />
The part I need to change is ShowInColumn="Total" and make it like ShowInColumn="<%$ Resources:PortalResource, Total %>". This is not a string assignment in a strict way, but an attribute assignment, so the "Refactor!" command of CodeRush doesn't appear.
My target is to find all of them in one shot and change them in a specific interface (i.e. like a localization tool) instead of looking for them one by one and manually creating the corresponding resource. Refactoring one by one inside each file would be an improvement, but still very time consuming...
You could take a look at the resource refactoring tool at
http://www.codeplex.com/ResourceRefactoring
It's an instance-by-instance tool rather than a batch replacement tool. It's free and standalone so you don't need Resharper or Coderush.
Check out the new open source project VisualLocalizer on CodePlex: VisualLocalizer page. If you have some ideas, post them as issues - the project is under development and we welcome feedback.
VisualStudio lets you search and replace with RegEx. It won't be the "fix all in one shot" solution, but it should cut back on the amount manual work significantly.
Just a thought.
If you have a look at DevExpress' CodeRush it has the functionaility you are looking for, you may need to automate it to do it a all in one shot.
It has a great deal more too!
Kindness,
Dan
Try RGreatEx. This is a plugin for ReSharper:
RGreatEx is the most powerful localizer and coding helper for Visual Studio. Once installed, it lets you localize .NET applications and produce safer code, saving up to 95% of time the developer usually spends on doing the same by hand. Empower yourself with time-saving refactorings, such as "Move to resource" and "Rename resource". The plug-in will automatically analyze string and resource usage and suggest moving strings to resources.
Do you have ReSharper? Then you perhaps should wait for version 5.0. It will have RGreatEx (mentioned by Anton) functionality included. Read the thread from the R# forum on this topic.
Update: The feature will be in R# 5.0. See the official announcement.
I've just published new tool called Jinnee.Package for string refactor. You can find it on Visual Studio gallery:
http://visualstudiogallery.msdn.microsoft.com/7ec5a225-dea4-47ae-8ebc-450d2980937f?SRC=Home

Categories