Example #1
0
        void Job()
        {
            Info.state = State.Initializing;
            Info.Time  = DateTime.Now;
            Info.Start = Info.Time;
            BinaryReader File = new BinaryReader(new FileStream(textBox1.Text, FileMode.Open, FileAccess.Read, FileShare.None));

            Info.FileLength = File.BaseStream.Length;
            Info.FileSize   = 0;
            Info.FileSize0  = 0;
            byte         Byte;
            BinaryWriter Copy;

            if (checkBox1.Checked)
            {
                Copy = new BinaryWriter(new FileStream(textBox2.Text, FileMode.Create, FileAccess.Write, FileShare.None));
            }
            else
            {
                Copy = new BinaryWriter(new FileStream(textBox2.Text, FileMode.Append, FileAccess.Write, FileShare.None));
                File.ReadBytes(Convert.ToInt32(textBox3.Text));
                Info.FileSize  = Convert.ToInt64(textBox3.Text);
                Info.FileSize0 = Info.FileSize;
            }
            Info.state = State.Copying;
            while (Info.FileLength != Info.FileSize)
            {
                Byte = File.ReadByte();
                Copy.Write(Byte);
                Info.FileSize++;
                if (Info.state == State.Cancel)
                {
                    break;
                }
            }
            Info.state = State.Closing;
            Copy.Close();
            File.Close();
            Info.state = State.Ready;
        }