• 大小: 399.47 KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2024-08-31
  • 语言: 其他
  • 标签:

资源简介

对大文件的分块读写,包括线程的使用,实现了文件的同步拷贝,并且定义了两个事件来对文件块读取进行提示。主要体现了Event 和FileStream的应用

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            OpenFileDialog of = new OpenFileDialog();
            of.ShowDialog();
            this.textBox1.Text = of.FileName;
        }

        private void button2_Click(object sender EventArgs e)
        {
            //wa_lab.IO.BlockStream bs = new wa_lab.IO.BlockStream(this.textBox1 .Text FileMode.Open);
            //bs.BlockLength = 512 * 1024;
            Warensoft.IO.BlockStreamReader reader = new Warensoft.IO.BlockStreamReader(this.textBox1 .Text 1024*512);
            while (!reader .Finished )
            {
           
                Warensoft.IO.BlockFileStreamWriter writer = new Warensoft.IO.BlockFileStreamWriter(“e:\\ex\\“+Path.GetFileName (this.textBox1 .Text )reader.FileLength);

                writer.BlockWrite(reader .BlockRead ());
                writer.Close();
            }
            reader.Close();
            
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        335  2008-11-05 01:57  Warensoft.IO\LocalTestRun.testrunconfig

     文件       8704  2007-11-21 10:56  Warensoft.IO\test\bin\Debug\test.exe

     文件      24064  2007-11-21 10:56  Warensoft.IO\test\bin\Debug\test.pdb

     文件      14680  2007-11-21 10:56  Warensoft.IO\test\bin\Debug\test.vshost.exe

     文件        473  2007-02-21 18:51  Warensoft.IO\test\bin\Debug\test.vshost.exe.manifest

     文件       7168  2007-11-21 10:56  Warensoft.IO\test\bin\Debug\Warensoft.IO.dll

     文件      22016  2007-11-21 10:56  Warensoft.IO\test\bin\Debug\Warensoft.IO.pdb

     文件       8192  2007-11-20 23:51  Warensoft.IO\test\bin\Debug\wa_lab.IO.dll

     文件      26112  2007-11-20 23:51  Warensoft.IO\test\bin\Debug\wa_lab.IO.pdb

     文件        134  2007-11-21 10:24  Warensoft.IO\test\bin\Debug\wa_lab.IO.xml

     文件       1319  2007-11-21 10:51  Warensoft.IO\test\Form1.cs

     文件       3145  2007-11-21 09:57  Warensoft.IO\test\Form1.Designer.cs

     文件       5814  2007-11-21 09:57  Warensoft.IO\test\Form1.resx

     文件       3839  2007-11-21 10:56  Warensoft.IO\test\obj\Debug\ResolveAssemblyReference.cache

     文件       1028  2007-11-21 10:56  Warensoft.IO\test\obj\Debug\test.csproj.FileListAbsolute.txt

     文件        847  2007-11-21 09:57  Warensoft.IO\test\obj\Debug\test.csproj.GenerateResource.Cache

     文件       8704  2007-11-21 10:56  Warensoft.IO\test\obj\Debug\test.exe

     文件        180  2007-11-21 10:56  Warensoft.IO\test\obj\Debug\test.Form1.resources

     文件      24064  2007-11-21 10:56  Warensoft.IO\test\obj\Debug\test.pdb

     文件        180  2007-11-21 10:56  Warensoft.IO\test\obj\Debug\test.Properties.Resources.resources

     文件        476  2007-11-21 09:50  Warensoft.IO\test\Program.cs

     文件       1438  2007-11-21 09:50  Warensoft.IO\test\Properties\AssemblyInfo.cs

     文件       2837  2007-11-21 09:50  Warensoft.IO\test\Properties\Resources.Designer.cs

     文件       5612  2007-11-21 09:50  Warensoft.IO\test\Properties\Resources.resx

     文件       1089  2007-11-21 09:50  Warensoft.IO\test\Properties\Settings.Designer.cs

     文件        249  2007-11-21 09:50  Warensoft.IO\test\Properties\Settings.settings

     文件       3597  2007-12-03 15:06  Warensoft.IO\test\test.csproj

    .......      9728  2008-11-05 02:01  Warensoft.IO\TestResults\wangyu_WANGYU-PC 2008-11-05 02_01_30\Out\warensoft.io test.dll

     文件      32256  2008-11-05 02:01  Warensoft.IO\TestResults\wangyu_WANGYU-PC 2008-11-05 02_01_30\Out\Warensoft.IO Test.pdb

    .......      9216  2008-11-05 01:56  Warensoft.IO\TestResults\wangyu_WANGYU-PC 2008-11-05 02_01_30\Out\Warensoft.IO.dll

............此处省略149个文件信息

评论

共有 条评论

相关资源