/// <summary>
/// 服务端:
/// </summary>
/// <param name="FileName">更新文件包名</param>
/// <param name="Offset">偏移</param>
/// <param name="Count">每次读取字节数 单位 KB</param>
/// <returns>字节组</returns>
[WebMethod(Description = "<b>大文件下载</b> 测试")]
public byte[] getFile(string FileName, long Offset, int Count)
{
//指定下载文件夹+文件名
string strPath = @"E:\\" + FileName;
if (Offset < 0) { Offset = 0; }
byte[] btBuf = new byte[Count];
if (System.IO.File.Exists(strPath))
{
System.IO.FileStream fs = new System.IO.FileStream(strPath, System.IO.FileMode.Open);
if (Offset < fs.Length)
{
if (0 < (int)(fs.Length - Offset) && (int) (fs.Length - Offset) < Count)
{
Count = (int)(fs.Length - Offset);
}
btBuf=new byte[Count];
fs.Seek(Offset, System.IO.SeekOrigin.Begin);
fs.Read(btBuf, 0, Count);
}
else
{ btBuf = null; }
fs.Flush();
fs.Close();
fs.Dispose();
}
return btBuf;
}