Oca 27 2010

CopySourceAsHtml ile kod renklendirme

Category: Visual StudioAdmin @ 22:41



Kodları nasıl renklendiririm diye düşünürken CopySourceAsHtml adlı Visual Studio 2008 eklentisini buldum Laughing

Güncel sürümünü  http://copysourceashtml.codeplex.com/ adresinden indirebilirsiniz.Visual Studio 2008 de iken kodu seçip sağ tıklayın Copy As Html deyin sonuç aşağıda ;)



   public static void DosyaKaydettir(string yol, string dosya) // localdeki dosyayı kaydettirir :=(

    {

        HttpContext.Current.Response.ContentType = "application/download";

        HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + dosya);

 

        FileStream sourceFile = new FileStream(@yol, FileMode.Open);

        long FileSize;

        FileSize = sourceFile.Length;

        byte[] getContent = new byte[(int)FileSize];

        sourceFile.Read(getContent, 0, (int)sourceFile.Length);

        sourceFile.Close();

 

        HttpContext.Current.Response.BinaryWrite(getContent);

    }

Tags: ,