public static void ReBulid() { var sw = new Stopwatch(); sw.Start(); view.rtbStepDescription.AppendText("-->" + "开始重编译 ..." + "\r\n"); view.rtbMainDescription.AppendText("======================================================" + "\r\n"); view.rtbMainDescription.AppendText("开始重编译 ..." + "\r\n"); view.rtbMainDescription.AppendText("======================================================" + "\r\n"); string cmd = string.Format(@"@ECHO OFF SET __MSBUILD_EXE__=%windir%\microsoft.net\framework64\v4.0.30319\msbuild.exe @echo on %__MSBUILD_EXE__% {0}\src\Abiz.Everything.sln /t:Rebuild /p:Configuration=release;Platform=x86 @echo off ", view.MainData.Path); var runer = new CmdRuner(cmd); runer.RunCmd((e => UIThread.Invoke(() => { if (e.Data.IsNotNullOrEmpty()) { view.rtbMainDescription.AppendText("-->" + e.Data + "\r\n"); } })), null, (e => { sw.Stop(); UIThread.Invoke(() => view.rtbStepDescription.AppendText("-->" + "重编译成功 √ 执行:" + sw.ElapsedMilliseconds + "ms" + "\r\n")); WpfTask.FactoryStartNew(() => { sw.Restart(); UIThread.Invoke(() => view.rtbStepDescription.AppendText("-->" + "开始移动文件 ..." + "\r\n")); UIThread.Invoke( () => view.rtbMainDescription.AppendText( "======================================================" + "\r\n")); UIThread.Invoke(() => view.rtbMainDescription.AppendText("开始移动文件 ..." + "\r\n")); UIThread.Invoke( () => view.rtbMainDescription.AppendText( "======================================================" + "\r\n")); GetFiles(MainWindow.GetWindow().MainData.Path); Thread.Sleep(5000); SvnHelper.CommitSvn(commitList); sw.Stop(); UIThread.Invoke(() => view.rtbStepDescription.AppendText("-->" + "移动文件成功 √ 执行:" + sw.ElapsedMilliseconds + "ms" + "\r\n")); }); }) ); }
/// <summary> /// 提交SVN ,大于50个项目 50个项目一提交 /// </summary> /// <param name="jiraNo jira 任务号"></param> /// <param name="commitList 提交文件位置"></param> public static void CommitSvn( List<string> commitList) { var svnCommitCommand = new StringBuilder(string.Format("svn commit -m \"{0} \" ", MainWindow.GetWindow().MainData.JiraNo)); int step = 0; int mod = 0; if (commitList.Count > 50) { step = (commitList.Count/50)+1; mod = (commitList.Count%50); } for (int i = 0; i < step; i++) { var tempList = commitList.Take(50); foreach (var file in tempList) { if (file.Contains("AbizCaigou.PublishVersion")) continue; svnCommitCommand.Append(file); svnCommitCommand.Append(SpaceString); } CmdRuner runer = new CmdRuner(svnCommitCommand.ToString()); runer.RunCmd((e => UIThread.Invoke(() => { if (e.Data.IsNotNullOrEmpty()) { MainWindow.GetWindow().rtbMainDescription.AppendText("-->" + e.Data + "\r\n"); } })), null, null ); if (commitList.Count>50) { commitList.RemoveRange(0, 50); } else { commitList.RemoveRange(0,mod); } } }