Use Id instead of Context - c#

I use HelpNDoc for providing a chm-file for the context sensitive help in my application.
In this software you define a help-ID and a corresponding help-context.
The help-ID for example maybe "SystemSetup" and the help-context is 57.
Now my question:
I can call the help this way:
System.Windows.Forms.Help.ShowHelp(null, #"myhelp.chm", HelpNavigator.TopicId, "57");
and all works well, but can I some how call ShowHelp with the help-ID ("SystemSetup") instead?
I ask this cause the help-context can change, but the help-ID stays always the same.

There is no easy way to do that. The Topic ID is the best thing you have to directly point to a topic. The software we use to generate the CHM files allows names to be given to topics, which can be retrieved using your code.
If that doesn't work for you, and the only thing you have is the name, you might get it done by using the Topic enum value and the name of the HTML file (if it is distinct enough).
Something like this could be what you need (you can retrieve the html file name through an CHM viewer):
System.Windows.Forms.Help.ShowHelp(null, #"myhelp.chm", HelpNavigator.Topic, "SystemSetup.html");
I don't know which option is better. That is up to you and your specific scenario.

HelpNDoc uses the following pattern to name topic files: "HELP_ID.htm" where HELP_ID is the chosen unique Help Id for that topic. So you can reliably open a specific topic using the following command:
System.Windows.Forms.Help.ShowHelp(null, #"help.chm", HelpNavigator.Topic, "HELP_ID.htm");
Also, as you found out, HelpNDoc is able to generate a source file with constants. And you can automate its generation and include it in your build process by creating a new "Code" build. See the step by step guide: How to create a new documentation output to be published

Related

How to use Microsoft.Web.Deployment to operate MsDeploy how to preview file changes

When I use the MsDeploy in the way of using Microsoft.Web.Deployment to meet a problem, my C# program can work normally, the use of contentPath providers will be the site of the normal file synchronization to the server, but do not know what the contents are synchronous, know only to increase a few questions, delete some files and delete. Several problems. But I would like to know what specific documents, get a list of these documents, the current use of Microsoft.Web.Deployment I do not know how to achieve the purpose, which is very important to me, please help me.
Similar to the use of Visual MsDeploy Studio, you can preview ahead of time to know what files will be updated, I want the effect is like this, please tell me how to achieve this effect, thank you very much.
You can use the whatif flag to find out what will be deployed/changed with MSDeploy:
msdeploy -whatif -verb:sync -source:contentPath=C:\Inetpub\Site1 -dest:contentPath=C:\Inetpub\Site2
https://technet.microsoft.com/en-us/library/dd569089(v=ws.10).aspx

C# and Mantis API, get reproducability

I am currently working on a project where I will be using Mantisbt's API to integrate bugtracking features into my program, however I have hit a snag.
I used wsdl.exe to generate a c# client library.
I am trying to get the reproducibility, severity, and priority from mantis (preferably in an ObjectRef array) to display it to the end-user so that they may select it from a drop down list. I managed to get the categories using the following line:
this.connector.mc_project_get_categories(username,password,projectid);
However, there doesn't seem to be a similar line for the other fields I am looking for.
I think you're looking for mc_enum_reproducibilities . This is preferred to hard-coding your own values, since the MantisBT installation may be customized to have other reproducibilities.
Reproducibility, severity, priority and similar fields are enumerations in the Mantis PHP files and must be hard-coded in. The values and text are found in the core/constant_inc.php file.
From these definitions you can create your own ObjectRef to pass.

Change display information (like name) of files from a shell extension for explorer.exe

I'm currently working with a Chinese SMB server, on which almost all the company files are stored.
As the structure doesn't change, I'd like to be able to put a "label" on files, based on a rules (something that allow me to handle generated files, which includes dates for example).
I need only support for win7 and above, and I'd like my informations to be read from a text file rather than relying on some metadata or client's data.
So I thought of writting a shell extension to do the work. My problem is, that by looking at the documentation, I didn't find something that allow me to change the name. The best solution I've found so far is to go with the infotip handler, but I wondering if anyone has a better way to do this.
In short, it needs:
1) To be compatible with win7 (and above),
2) To be visible at first sight
3) To use a readonly fs
After extensive research, I've found that the best way to do it is to write a Shell Namespace extension.
I'll be able to provide a virtual directory representing my server's structure, and translate the names the way I want.
This seems a little overkill though, but there's no other way to change the informations displayed as the display name is managed by an IShellFolder which provides it to an IShellView
One excellent source of informations I've found about it, and the most up to date so far, is an article on Michael Edenfiled's blog

Creating a simple text-manipulating Visual Studio 2010 extension

I've been wanting to create a simple text-manipulating extension for Visual Studio for a while, and now I've finally found some time to look into how extensions are written. What I have in mind could be accomplished through VBA macros, but I'd rather implement it as a "real" extension; as a learning process, and because I honestly can't stand VBA.
After a fair amount of googling, blog reading, digging into MSDN and browsing StackOverflow posts, I think I've gathered enough information that I can implement it - but I'd like some feedback on whether I'm approaching things right before I start hacking away :)
What I'd like is:
Registering Commands that users can bind hotkeys to via Tools->Options->Keyboard.
Modify the text buffer of the active window when Commands are invoked.
I don't really care about menus or toolbars, but know how to add it via .vsct files (are there better options?)
For #1, it seems I have to do a full VSPackage, .vsct file et cetera - there's no nice-and-easy MEF extension point I can handle instead? (Perhaps exporting a IWpfTextViewCreationListener and fiddling around with manual keyboard shortcut handling - but that'd be a major hack).
For #2, I'm unsure how to get an ITextBuffer for the active document. I could go through DTE.ActiveDocument, but I'm not sure how to obtain an ITextBuffer from that. Alternatively, I could do something along the lines of...
var txtMgr = (IVsTextManager)ServiceProvider.GetService(typeof(SVsTextManager));
IVsTextView textViewCurrent;
txtMgr.GetActiveView(true, null, out textView);
IWpfTextView wpfViewCurrent = AdaptersFactory.GetWpfTextView(textView);
ITextBuffer textCurrent = wpfViewCurrent.TextBuffer;
...but that sure does look like a roundabout way of doing things?
For both of these, take a look at the Align Assignments extension source. It's a package/MEF component that adds a command and handles it in the active window.
Your answer to #1 is correct. The best way to do commands is with a .vsct file, which requires a package. However, all a package means is that your project will be producing a dll with embedded resources (from the .vsct file) and a .pkgdef file, which adds registry keys according to the attributes you supply on your package. It (hopefully) isn't too much overhead.
For your second question, there is a cleaner way. Take a look at the command filter, which listens for commands in the active view, instead of listening for them globally and then finding the active view. It lets the shell handle the command routing and just concentrates on the implementation.
Not entirely sure what you mean by "the text buffer" but assuming you mean either the current text file that is open or the current selection, here is some code I have in a package to access those:
EnvDTE.DTE app = (EnvDTE.DTE)GetService(typeof(SDTE));
if (app.ActiveDocument != null && app.ActiveDocument.Type == "Text")
{
EnvDTE.TextDocument text = (EnvDTE.TextDocument)app.ActiveDocument.Object(String.Empty);
if (!text.Selection.IsEmpty)
{
//work with text.Selection.Text
}
}
Of course if you're doing an editor extension it would be different.

Can intellisense be exported or extracted from Visual Studio to a text file?

I'm trying to write some documentation for a webservice that has been provided by one of our vendors for an application we're integrating. A bunch of the interface is custom objects defined in the web service itself. The vendor has put up significant resistance to providing any documentation for this application and so I've taken it upon myself to do their job for them [against my better judgement].
The documentation they have provided frankly is embarassing and I'm trying to make as short work of this as I possibly can to put some good quality docs together. I know that as I don't have access to their source, I can't just run it through nDoc/Sandcastle to spit out an API doc, but I was wondering if (as a half way house) there was an easy way to export the intellisense to a text file without me having to write a utility to specificially iterate through each of the object types defined and reflect the members out to text?
If I could do this, it would at least make sure that I have a good quality document structure where I can just fill in the blanks. Having to skip back and forth to Visual Studio to check the intellisense for every class member is a very laborious way of doing this.
Does anyone have any ideas?
If it is a web service that you are trying to document, couldnt you then parse out the WSDL?
If you are accessing a remote Web Service, then I think you have access to the corresponding WSDL: what about parsing it and look for just the information you need?
Or using a tool to do this (I Googled for "wsdl documentation generator")?
Or even using WSDL.exe to generate some dummy code from the WSDL and then document it, perhaps helped by GhostDoc?
HTH
Could you use Reflection to dump out the methods etc.?
Reflection is the feature in .Net, which enables us to get some information about object in runtime. That information contains data of the class. Also it can get the names of the methods that are inside the class and constructors of that object.
I think VS.net generates documentation for intellisense. For existing assemblies, it is already on your file system (e.g. C:\Windows\Microsoft.NET\Framework\v2.0.50727\en)
Try using the assembly from the vendor in VS.NET. Use process explorer or any such tool from sysinternals to see what files are being loaded. I am sure, you will find that there is an xml file created for the custom assembly (which is used to show the Intellisense and documentation available with it).
Hope that helps.
EDIT: I think the same folder (where your custom assemblies are located) will have the xml files for documentation.
If you have the dll's could you not decompile them and then recompile and use nDoc? That should give you a reasonalbe start.
Could you just use reflector (from redgate) to view the assembly (decompiled) instead of reproducing a API document. I'm not sure what else you would get of reflecting and building your on document that you wouldn't see live in reflector (of course this would depend on their writing readable code.
Maybe this is crazy, but could you take a screenshot of the full listing, and run it through an OCR program?

Categories

Resources