Esempio n. 1
0
 private void comboBox4_TextChanged(object sender, EventArgs e)
 {
     Ini.Write("BOOTSize", comboBox3.Text);
 }
Esempio n. 2
0
        private void DownLoad_Thread()
        {
            for (int z = 0; z < 10; z++)
            {
                RxCount = 0;
                button12_Click(null, null);
                for (int a = 0; a < 10; a++)
                {
                    Thread.Sleep(100);
                    if (RxCount > 5)
                    {
                        z += 1;
                    }
                }
                if (RxCount < 5)
                {
                    z--;
                }
            }
            FileInfo   fi  = new FileInfo(Ini.Read("附件路径"));
            uint       len = (uint)fi.Length;
            FileStream fs  = new FileStream(Ini.Read("附件路径"), FileMode.Open);

            byte[] buffer = new byte[len];
            fs.Read(buffer, 0, (int)len); fs.Close();
            fs.Close();
            uint PageSize = len / 1024;

            if ((len % 1024) > 0)
            {
                PageSize++;
            }
            for (int z = 0; z < PageSize; z++)
            {
                this.Invoke((EventHandler)(delegate
                {
                    this.progressBar1.Maximum = (int)(PageSize - 1);
                    this.progressBar1.Value = z;
                    Application.DoEvents();
                }));
                byte[] Data = new byte[1024];
                for (int i = 0; i < 1024; i++)
                {
                    try { Data[i] = buffer[1024 * z + i]; } catch { Data[i] = 0xff; }
                }
                RxCount = 0;
                WritePage(Data, z);
                for (int a = 0; a < 10; a++)
                {
                    if (RxCount > 5)
                    {
                        break;
                    }
                    Thread.Sleep(10);
                }
                if (RxCount < 5)
                {
                    z--;
                }
            }
            button3_Click(null, null);
            button3_Click(null, null);
            this.Invoke((EventHandler)(delegate
            {
                this.progressBar1.Value = 0;
                button9.Text = "写入文件";
                Application.DoEvents();
            }));
        }