C#实现一次分割多个文件
程序员文章站
2022-04-26 13:32:43
...
using System.IO; using System.Windows.Forms; OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter ="All files (*.*)|*.*"; dlg.FilterIndex = 1; dlg.RestoreDirectory = true; dlg.Multiselect = true; if (dlg.ShowDialog() == DialogResult.OK) { foreach (string filetosplit in dlg.FileNames) { string targetpath="D:"; FileStream fsr = new FileStream(filetosplit, FileMode.Open, FileAccess.Read); long FileLength=fsr.Length; byte[] btArr = new byte[FileLength]; fsr.Read(btArr, 0, (int)FileLength); fsr.Close(); long PartLength=FileLength/3+FileLength%3; int nCount=(int)Math.Ceiling((double)FileLength/PartLength); string strFileName=Path.GetFileName(filetosplit); long byteCount=0; for(int i=1;i
上一篇: PHP实现下载远程文件类相关代码
下一篇: 哪些方法可以让html文档内嵌入js