您的位置:首页 > 其它

Code Snippet for Windows Live Writer

2011-01-19 08:49 691 查看
[code] unsafe public static int AFCDirectoryRead(void* conn, void* dir, ref byte[] buffer)


{


 


int ret;


 


void* ptr = null;


ret = AFCDirectoryRead(conn, dir, ref ptr);


if ((ret == 0) && (ptr != null))


    {


IntPtr ipPtr = new IntPtr(ptr);


ArrayList bufferArray = new ArrayList();


 


int curr = 0;


while (true)


   {


byte tmpByte = Marshal.ReadByte(ipPtr, curr);


if (tmpByte != 0)


  {


bufferArray.Add(tmpByte);


curr++;


}


else


  {


break;


}


}


 


buffer = (byte[]) bufferArray.ToArray(typeof (byte));


 


}


else


    {


buffer = null;


}


return ret;


}

[/code]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: