示例#1
0
        private void UpLoad_Load(object sender, EventArgs e)
        {
            if (listViewItemCollection == null || listViewItemCollection.Count == 0)
            {
                MessageBox.Show("请先启动程序,或手动加载压缩文件");
                this.Close();
            }
            Temp temp = new Temp();

            foreach (ListViewItem item in listViewItemCollection)
            {
                var address = item.SubItems[8].Text;
                temp.CreateTemp(address);
            }
            temp.StartTask(3);


            LanZhouHelper lanZhouHelper = new LanZhouHelper();

            if (LanZhouHelper.cookieContainer.Count == 1)
            {
                MessageBox.Show("请先录入蓝奏云用户名或密码");
                this.Close();
                return;
            }
            lanZhouHelper.loadSendMsg += LanZhouHelper_loadSendMsg;
            int i = 0;

            foreach (var item in Directory.GetFileSystemEntries(fileAddress))
            {
                if (Path.GetExtension(item).Equals(".zip"))
                {
                    var    fs       = File.OpenRead(item);
                    string ext      = Path.GetExtension(item);
                    string fileNmae = Path.GetFileName(item);
                    listView1.Items.Add(new ListViewItem(new string[] { "", "", "", "" }));
                    lanZhouHelper.FileUpload(fs, fileNmae, ext, i);
                    i++;
                }
            }
        }