My Visual Studio Plugin for Community Server

I'm such a geek. I create my own tools if I feel the current tool does not meet my needs or when I'm super-annoyed by it.

Usually I use CopySourceAsHtml to post codes on my blogs. But it just doesn't cut it.

Then I use to Copy from Visual Studio to Microsoft Word, then Copy it back to Community Server blog. Again, the html Word generates is just annoying.

So then I put on my programmer's hat, and I happily code for 2 days, sometimes forgetting to eat, just to create this ultimate tool:

A Visual Studio Addin to Copy Paste your Codes into Community Server Blogs (did u catch that, oh Googlebot?)

** Scroll all the way down to download my Addin from the Post Attachment.

All you have to do is select your codes, right-click and choose "Copy for Community Server":

 

 

And then Paste it on your Community Server Blog Post Editor.

Lo and behold, your code will appear as such:

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
// Get the selection
TextSelection sel = (TextSelection) _applicationObwrap glyph
ject.ActiveDocument.Selection;
if (sel != null)
{
    // split into 50 columns
    string code = FitToColumns(sel.Text);

    StringBuilder sb = new StringBuilder();
    // header
    sb.Append("<div style=\'background-color:#ffffwrap glyph
ff;font-family:'Courier New', Courier, monospace;fwrap glyph
ont-size:10pt\">"
);

    // format whitespace
    code = FormatWhitespace(code);

    // format keywords
    code = FormatKeywords(code);

    // format comments
    code = FormatComments(code);

    // format string
    code = FormatString(code);

    // footer
    sb.Append(code);
    sb.Append("</div>");

    // wrap into linenumbers & code area
    code = WrapCodes(sb.ToString());
    
    ZClipboard.CopyAsHtml(code);
}

 

Installation Steps:

  1. Download Zeddy-CopyForCS.zip from the Post Attachment below.
  2. Extract all contents to \My Documents\Visual Studio 2005\Addins
  3. Open Visual Studio 2005. Go to Tools | Add-in Manager, and enable CopyForCS.
Only works for Visual Studio 2005 Standard and upwards... Visual Studio Express don't support Add-ins, sorry.

Now that it's released, I can eat 3 times a day again...and be reminded that I have a wife Stick out tongue

Share this post: | | | |
Published Wednesday, April 25, 2007 4:42 AM by zeddy
Filed under:

Comments

# re: My Visual Studio Plugin for Community Server

Wednesday, April 25, 2007 1:57 PM by zeddy

Forgot to tell, this only works for C# files. Sorry to VB.NET-ters out there :)

# Visual Studio Plug-in for Community Server

Wednesday, April 25, 2007 8:50 PM by Rob Howard's Blog

Zeddy Iskandar wrote a slick plug-in for Visual Studio that allows you to copy/paste code snippets in

# re: My Visual Studio Plugin for Community Server

Wednesday, April 25, 2007 9:19 PM by choirul

thanks man,

I can use it for another purpose too, beyond the community server :)

# Sad VB.NET Guy

Thursday, April 26, 2007 12:46 AM by tlaughlin
Zeddy, First off thank, this sound like a great tool. I might not be Googlebot, but it did get your RSS Feed added to my Google Reader. I was disappointed to hear that this doesn't work with VB.NET. Are you planning on adding VB.NET support? If not would you be willing to share source with me so I can see what I can do? Again thanks for building this.

# re: My Visual Studio Plugin for Community Server

Thursday, April 26, 2007 7:21 AM by rasupit

Zeddy,

Thanks for the great plugin!! I'm sure more people will find this very useful like I have.

BTW, Saya senang dan bangga bisa menggunakan program kontribusi sesama orang Indo. ;)

Ricky

# Paste for Community Server

Sunday, April 29, 2007 9:12 AM by Human Code Factory Composite Dissarray

I've tried many things, including the Visual Studio to Word to Microsoft Live Writer to sometimes editing...

# CS Byte for April 29, 2007

Sunday, April 29, 2007 10:55 PM by Dave Burke

blog bits Scott Watermasysk's been doing a really good job pointing out the top Community Server news

# A very slick Visual Studio 2005 Plugin by Zeddy Iskandar

Monday, April 30, 2007 12:58 AM by Dave Burke's Community Server Bits

A very slick Visual Studio 2005 Plugin by Zeddy Iskandar to copy-paste C# code into a Community Server

# re: My Visual Studio Plugin for Community Server

Monday, April 30, 2007 1:16 PM by adron

Just wanted to toss a follow up comment here.  I've got it installed and done some sample "draft" posts and this is awesome.  It sure beats the timely process of Visual Studio to Word to ... etc.

Thanks!

# Great plug in for Visual Studio 2005 to share code in the web using Community Server

Monday, April 30, 2007 10:18 PM by Al Pascual

http://geeks.netindonesia.net/blogs/zeddy/archive/2007/04/25/Visual-Studio-Plugin-for-Community-Server.aspxMy

# Visual Studio 2005 Plugin for CS

Wednesday, May 02, 2007 5:20 AM by ÎÜñ|‹ø\/\/ñ [ÐëÞrëçã†ëð]'s Blog

Zeddy has released a plugin for VS 2005 (with a screen-shot on his blog) which allows you to copy and

# "Visual Studio to Community Server" Add-On

Tuesday, May 22, 2007 10:53 PM by Jason N. Gaylord's Blog

I ran across a tool created by Zeddy at http://geeks.netindonesia.net/blogs/zeddy/archive/2007/04/25

# "Visual Studio to Community Server" Add-On

Wednesday, August 08, 2007 10:14 AM by Jason N. Gaylord's Blog

I ran across a tool created by Zeddy at http://geeks.netindonesia.net/blogs/zeddy/archive/2007/04/25

# state of georgia high school sports association

Wednesday, September 12, 2007 5:13 AM by state of georgia high school sports association

state of georgia high school sports association

# re: My Visual Studio Plugin for Community Server

Wednesday, October 03, 2007 4:53 AM by maya

SICKO! :)sicko is a proud dad now! i wonder how the baby will do codes!

# Testing Paste from VS Plugin

Friday, October 19, 2007 4:53 PM by BloggiZ - Blogging by Z

Testing Windows Live Writer Plugin called Paste from Visual Studio . With that, does it mean my Community

# re: My Visual Studio Plugin for Community Server

Thursday, October 09, 2008 6:31 AM by David

Thanks Zeddy for this great tool.

I'm using VS2008, I just needed to change a bit the .addin to get this working.

Any chance this features could be added?:

1. Customize the width of the code snippet box (my CommunityServer blog theme has a larger fixed area for the posts. I want to use the total of this width with my CopyForCS code-snippets.

2. Colored variables, classes and interfaces.

3. Support for VB.Net (usually I provide both C# and VB.Net code. Any change we could format the snippet as this (msdn.microsoft.com/.../1c9txz50.aspx) ?

---------

Let me know if I could help you here. Do you plan to release the source?

Thanks.

# Paperclip Blog Skin Reface

Tuesday, October 28, 2008 6:24 AM by Eutopia

Όπως, ελπίζω, είναι εμφανές, έκανα μια αλλαγή στο header του blogtitle και άλλαξα και το πάχος του. Προφανώς

# Great plug in for Visual Studio 2005 to share code in the web using Community Server

Wednesday, May 26, 2010 9:49 AM by Al Pascual

Great plug in for Visual Studio 2005 to share code in the web using Community Server

Powered by Community Server (Commercial Edition), by Telligent Systems