private void copyCircle()
        {
            if (curCopyNo >= copylist.Count)
            {
                letdo.BeginInvoke("INFO: 打包完成!", null, null);
                AutoClose ac = AutoColseFunc;
                this.BeginInvoke(ac, null);
                return;
            }
            string bakto = AutoCreateFolder(System.Environment.CurrentDirectory + @"\" + GobalParameters.UpdateFolder + copylist[curCopyNo]);

            //FileInfo fi = new FileInfo(bakto);
            try {
                if (File.Exists(bakto))
                {
                    File.Delete(bakto);
                }
            } catch (Exception e1) {
                MessageBox.Show(e1.ToString());
            }

            letdo.BeginInvoke("INFO: 正在复制文件:" + frompath + copylist[curCopyNo], null, null);
            //开始备份
            try
            {
                FileStream fs = new FileStream(frompath + (string)copylist[curCopyNo], FileMode.Open, FileAccess.Read);
                Size     = (int)fs.Length;
                position = 0;
                stream   = fs;
                //这里是设置缓存的大小,可以根据需要修改逻辑
                if (Size < BUFFER_SIZE)
                {
                    buffer = new byte[Size];
                    stream.BeginRead(buffer, 0, Size, new AsyncCallback(AsyncCopyFile), bakto);
                }
                else
                {
                    buffer = new byte[BUFFER_SIZE];
                    stream.BeginRead(buffer, 0, BUFFER_SIZE, new AsyncCallback(AsyncCopyFile), bakto);
                }
            }
            catch (Exception Ex)
            {
                curCopyNo++;
                TotalPostion += Size;
                copyCircle();

                MessageBox.Show("ERROR:复制文件:" + frompath + copylist[curCopyNo] + "出错(" + Ex.ToString());
                letdo.BeginInvoke("ERROR:复制文件文件:" + frompath + copylist[curCopyNo] + "出错(" + Ex.ToString() + ")", null, null);
            }
        }
		public async Task when_processing_push_then_auto_closes_issue()
		{
			var github = new GitHubClient(new ProductHeaderValue("kzu-client"), new InMemoryCredentialStore(credentials));
			var repository = await github.Repository.Get("kzu", "sandbox");
			var user = await github.User.Current();

			var task = await github.Issue.Create(
				"kzu", "sandbox", new NewIssue("Task that should auto-close from commit")
				{
					Labels = { "Task" },
				});

			var hook = new AutoClose(github);

			await hook.ProcessAsync(new PushEvent
			{
				Commits = new[]
				{ 
					new PushEvent.CommitInfo
					{
						Message = "Closes #" + task.Number,
						Sha = "ae257bb398c8aa3293b70c7495ae43033a5f0698"
					},
				},
				HeadCommit = new PushEvent.CommitInfo
				{
					Message = "Closes #" + task.Number,
					Sha = "ae257bb398c8aa3293b70c7495ae43033a5f0698"
				},
				Repository = AutoMapper.Mapper.Map<PushEvent.RepositoryInfo>(repository)
			});

			var updated = await github.Issue.Get("kzu", "sandbox", task.Number);

			Assert.Equal(ItemState.Closed, updated.State);
		}
        /// <summary>
        /// 正式复制方法。
        /// </summary>
        private void copyCircle()
        {
            if (curCopyNo >= baklist.Count)
            {
                letdo.BeginInvoke("INFO: " + infostr + "完成!", null, null);
                if ("更新".Equals(infostr))
                {
                    AutoClose ac = AutoColseFunc;
                    this.BeginInvoke(ac, null);
                    return;
                }
                else
                {
                    infostr = "更新";
                    UpdateFiles();
                    return;
                }
            }
            string bakto = "";

            if (!"更新".Equals(infostr))
            {
                bakto = ((string)baklist[curCopyNo]).Replace(servicespath, bakToPath);
                bakto = AutoCreateFolder(bakto);
            }
            else
            {
                bakto = servicespath + @"\" + baklist[curCopyNo];
                bakto = AutoCreateFolder(bakto);
            }
            FileInfo fi = new FileInfo(bakto);

            if (File.Exists(bakto))
            {
                File.Delete(bakto);
            }
            letdo.BeginInvoke("INFO: 正在" + infostr + "文件:" + baklist[curCopyNo], null, null);
            //开始备份
            try
            {
                string fromfile = (string)baklist[curCopyNo];
                if ("更新".Equals(infostr))
                {
                    fromfile = GobalParameters.UpdateFolder + fromfile;
                }
                FileStream fs = new FileStream(fromfile, FileMode.Open, FileAccess.Read);
                Size     = (int)fs.Length;
                position = 0;
                stream   = fs;
                //这里是设置缓存的大小,可以根据需要修改逻辑
                buffer = new byte[BUFFER_SIZE];
                stream.BeginRead(buffer, 0, BUFFER_SIZE, new AsyncCallback(AsyncCopyFile), bakto);
            }
            catch (Exception Ex)
            {
                MessageBox.Show("ERROR:" + infostr + "文件:" + baklist[curCopyNo] + "出错(" + Ex.ToString());
                letdo.BeginInvoke("ERROR:" + infostr + "文件:" + baklist[curCopyNo] + "出错(" + Ex.ToString() + ")", null, null);
                curCopyNo++;
                TotalPostion += Size;
                copyCircle();
            }
        }