Code Snippet for Windows Live Writer

 

如果你是程序员,你正在用Windows Live Writerl来写blog,想在你的blog里插入代码,我推荐这个好用的插件:

Code Snippet 官方地址  DBank网盘下载

 

测试一下,看看效果如何。

   1: unsafe public static int AFCDirectoryRead(void* conn, void* dir, ref byte[] buffer)
   2: {
   3:  
   4:     int ret;
   5:  
   6:     void* ptr = null;
   7:     ret = AFCDirectoryRead(conn, dir, ref ptr);
   8:     if ((ret == 0) && (ptr != null))
   9:     {
  10:         IntPtr ipPtr = new IntPtr(ptr);
  11:         ArrayList bufferArray = new ArrayList();
  12:  
  13:         int curr = 0;
  14:         while (true)
  15:         {
  16:             byte tmpByte = Marshal.ReadByte(ipPtr, curr);
  17:             if (tmpByte != 0)
  18:             {
  19:                 bufferArray.Add(tmpByte);
  20:                 curr++;
  21:             } 
  22:             else
  23:             {
  24:                 break;
  25:             }
  26:         }
  27:  
  28:         buffer = (byte[]) bufferArray.ToArray(typeof (byte));
  29:  
  30:     }
  31:     else
  32:     {
  33:         buffer = null;
  34:     }
  35:     return ret;
  36: }
posted @ 2011-01-19 08:49  Chicken Cake  阅读(261)  评论(0编辑  收藏  举报