Bookmark and Share

CopySourceAsHTML for VS2005

by DRohm 21. January 2006 09:51

I know this is old, but I just found it today.  I've used the latest version of CopySourceAsHTML for VS2003, but never could get it to work with VS2005.  After searching for a couple of hours I discovered some alternatives:

After looking at all of these, the one I liked the most was Drazen Dotlic's Colorizer.  But what I really wanted was a port of CopySourceAsHTML, so I started searching again and finally found out that dredge ported it for VS2005 and Jason Haley created an installer for it.  I highly recommend this tool.  It works for C#, VB.NET, SQL, etc and allows for easy copy and pasting for blog entries.

Download Jason Haley's installer here.  After the install, you need to make one change:

  1. In VS2005, go to Tools...Options...Environment...Add-in/Macros Security
  2. Click Add.
  3. Browse to the directory where you installed the port (default is C:\Program Files\J.T. Leigh & Associates\CopySourceAsHtml2005).

Here is a quick example of a c# method:

  126         private static void ParseChannel(string value)

  127         {

  128             string[] chanAry = value.Split(new char[] {','});

  129             Channel chan = new Channel();

  130             chan.ServerId = mServer.Id;

  131 

  132             foreach (string param in chanAry)

  133             {

  134                 int startPos = param.IndexOf("=");

  135                 string data = param.Substring(startPos + 1);

  136 

  137                 if (param.IndexOf("CID=") > -1)

  138                 {

  139                     chan.ChannelId = int.Parse(data, CultureInfo.CurrentCulture);

  140                 }

  141                 else if (param.IndexOf("PID=") > -1)

  142                 {

  143                     chan.ParentChannelId = int.Parse(data, CultureInfo.CurrentCulture);

  144                 }

  145                 else if (param.IndexOf("PROT=") > -1)

  146                 {

  147                     chan.Protected = data == "1" ? true : false;

  148                 }

  149                 else if (param.IndexOf("NAME=") > -1)

  150                 {

  151                     chan.Name = data;

  152                 }

  153                 else if (param.IndexOf("COMM=") > -1)

  154                 {

  155                     chan.Comment = HexToChar(data);

  156                 }

  157             }

  158 

  159             if (chan.ParentChannelId.Value > 0)

  160             {

  161                 mServer.AddChildChannel(chan);

  162             }

  163             else

  164             {

  165                 mServer.AddChannel(chan);

  166             }

  167         }

This is a must-have tool.  It's also listed as one of the "Ten Essential Tools" for Visual Studio.  Take a look here.

Tags:

blog comments powered by Disqus

About Me

Doug Rohm
Twitter Technorati

Doug Rohm
Boston area .NET developer, geek, gamer, dog lover, and sports nut.