Code Formatter Plugin for Windows Live Writer

I stumbled across a great code formatter for Windows Live Writer today. Here’s an example, using a C# function that converts a number into a formatted file size:

       public static string SizeToString(long size) 
        { 
            const long kilobyte = 1L << 10; 
            const long megabyte = 1L << 20; 
            const long gigabyte = 1L << 30; 
            const long terabyte = 1L << 40; 
            string kbSuffix = "KB"; 
            string mbSuffix = "MB"; 
            string gbSuffix = "GB"; 
            string tbSuffix = "TB"; 
            string suffix = kbSuffix; 

            double divisor = kilobyte;//KB 
            if (size > 0.9 * terabyte) 
            { 
                divisor = terabyte; 
                suffix = tbSuffix; 
            } 
            else if (size > 0.9 * gigabyte) 
            { 
                divisor = gigabyte; 
                suffix = gbSuffix; 
            } 
            else if (size > 0.9 * megabyte) 
            { 
                divisor = megabyte; 
                suffix = mbSuffix; 
            } 

            double newSize = size / divisor; 
            return string.Format("{0:F2}{1}", newSize,suffix); 
        }

6 thoughts on “Code Formatter Plugin for Windows Live Writer

  1. Brennan

    Can anyone give me ideas , i might get free time in the future and want to give it for wordpress …
    any idea ?
    i want idea from simple thing to mid … 1-2 hours –> 8-10 hours .
    post your ideas…

  2. Lorenzo

    Can anyone give me ideas , i might get free time in the future and want to give it for wordpress …
    any idea ?
    i want idea from simple thing to mid … 1-2 hours –> 8-10 hours .
    post your ideas…

  3. Isiah

    What I want to do on my blog, is every few hours take the oldest post and move it to the
    front of the queue, all automatically. Anyone know if there is a plugin that can do this or
    a simple way to set up another plugin to do this (use my own feed perhaps)?
    Thanks.

Comments are closed.