Showing posts with label VS Plugins. Show all posts
Showing posts with label VS Plugins. Show all posts

Wednesday, September 26, 2007

Visual Studio 2005 Automation Samples

Guess I should have looked at creating a Visual Studio plugin first rather than figuring out how to convert RTF to HTML. I might not need to do that judging by the description of one of the Visual Studio 2005 Automation Samples:

Generate HTML
This sample demonstrates how to take text from the editor window and build a HTML file using this text, including font and color syntax highlighting information.

Haven't downloaded this yet, but I will do. Sounds like the Blogger code upload plugin could be quite easy to implement.

I found this page linked from the Customize and Extend Visual Studio page on MSDN.

UPDATE: Ahh, the Generate HTML sample is actually in C++, not C#. Should still be able to use it as a guide though, just need to figure out what objects to use.

Tuesday, September 25, 2007

RTF to HTML and the GData API

Finally got around to properly extracting the RTF conversion code from AutoFormatter last night. It turned out to be as easy as I thought, after last time's wasted efforts. I've had a look on Robert Verpalen's blog for some contact details, but I can't find any and the AutoFormatter post doesn't seem to allow comments.

I might have to leave a comment on another one of his other posts, but the date on the AutoFormatter post is December 2005, so I don't know if he's maintaining it now. Doesn't seem to be any posts since then about the application anyway.

I think I'll wait until I have something usable first though.

Anyway, with that extracted I downloaded the GData API SDK and tried to connect to my blog. The sample code included is very helpful, but it still took a little time to get my head around. I eventually knocked up some code that would add a new draft to my blog, so I think I have everything I need to make the plugin now.

Now I just need to learn about how to make a decent plugin.

Wednesday, September 19, 2007

RTF to HTML: AutoFormatter 2.0

Visual Studio copies code from the editor in RTF format, so technically all you need to do is convert RTF to HTML in order to upload it to a blog post, which will form part of the plugin, if I ever get around to making it.

Looking around last night I found AutoFormatter 2.0. This is a .Net 2.0 application written in C# that does a neat job of doing exactly what I need. The HTML it produces is in a scrolling DIV, formatted in Visual Studio colours, and looks quite nice.

In fact, as a standalone application this is just what I need to post code samples, but I started down this path to try the GData API with a Visual Studio plugin. I'm hoping to use part of AutoFormatter to do it though.

If I can extract the conversion code from the AutoFormatter app into a standalone assembly, then theoretically I should be able to use it from the plugin. The code is available for download, and I made a start at extracting the required elements last night. If I can get this working then that's a big chunk of the work done I think.

I'll get in touch with AutoFormatter's author if I manage to get the core functionality extracted to a separate assembly. Hope he doesn't mind.

Creating Visual Studio Plugins

This is more of a reminder to myself than anything else: Exploring Extensibility: Your First Visual Studio Add-in.

I found it at about the same time I was looking into the GData API, and I had an idea about creating a plugin to Visual Studio which would allow you to upload a code snippet to a blog post, and have it fully formatted so it was readable.

Still might do it, but I'm not sure how indepth the wizard approach will be. I'll probably end up with a standalone application that you paste code into and then upload it.