/// <summary> /// 执行命令 /// </summary> /// <param name="cmds">命令集</param> /// <param name="sysDriver">系统分区卷名</param> protected ExecRsp Exec(string[] cmds, string sysDriver = "c:") { List <string> cmdLst = new List <string>(cmds); cmdLst.Insert(0, string.Format("cd {0}", PATH)); cmdLst.Insert(0, sysDriver); return(CMD.Exec(cmdLst)); }
private void TxtShow_DragDrop(object sender, DragEventArgs e) { var path = ((Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString(); if (!string.IsNullOrWhiteSpace(path)) { var cmd = new CMD() { CmdStr = $@"java -jar .\AppData\jars\AXMLPrinter2.jar {path}" }; Task.Factory.StartNew(() => { if (cmd.Exec(cmd, null)) { this.SetText(cmd.Res); } else { this.SetText($"发生错误,错误信息:{cmd.Exception.Message}\r\n{cmd.Exception.ToString()}"); } }); } }
/// <summary> /// 立即发布 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnPubNow_Click(object sender, EventArgs e) { #region 校验数据 cmbProjectPath.Text = cmbProjectPath.Text.Trim(); txtOutPath.Text = txtOutPath.Text.Trim(); if (cmbProjectPath.Text.IsNull() || txtOutPath.Text.IsNull()) { MessageBox.Show("请选择项目文件和输出目录!", "提示"); return; } if (cmbFrameworks.SelectedIndex < 0) { MessageBox.Show("请选择目标框架!", "提示"); return; } if (!Directory.Exists(txtOutPath.Text)) { Directory.CreateDirectory(txtOutPath.Text); } #endregion #region 拼接命令 var sb = new StringBuilder(); sb.Append("dotnet publish "); sb.Append("\""); sb.Append(cmbProjectPath.Text); sb.Append("\""); sb.Append(" -c "); sb.Append(cmbPubMode.SelectedItem.ToString()); if (ckbRuntime.Checked) { sb.Append(" -r "); sb.Append(cmbRuntime.SelectedItem.ToString()); } sb.Append(" -f "); sb.Append(cmbFrameworks.SelectedItem.ToString()); sb.Append(" -o "); sb.Append("\""); sb.Append(txtOutPath.Text); sb.Append("\""); #endregion var tmpCmd = sb.ToString(); this.AppendText($"{TimeNow()} 正在执行:\r\n{tmpCmd}\r\n"); var cmd = new CMD() { CmdStr = tmpCmd }; Task.Factory.StartNew(() => { if (cmd.Exec(cmd, str => this.AppendText(str))) { this.AppendText("==================== 执行完成! ====================\r\n\r\n"); } else { this.AppendText($"{TimeNow()} 执行命令出错!错误信息:{cmd.Exception.Message}\r\n{cmd.Exception.ToString()}\r\n"); this.AppendText("==================== 执行命令出错! ====================\r\n\r\n"); } }); }
void UpdateAllFrame() { UpdateSplitFrame(); int num = (int)(this.ServerCurFrame - this.ClientCurFrame); if (num == 0) { UpdateOprCMD(); } long num2 = (long)((GetLocalTime() - this.startFrameTime)); while (num > 0) { long num3 = (long)(this.ClientCurFrame * this.FrameDelta); long nMultiFrameDelta = num2 - num3 - ServerDelta; if (nMultiFrameDelta >= (long)((ulong)this.FrameDelta)) { FlushUpdate(); ClientCurFrame += 1u; while (this.recvCmdQueue.Count > 0) { CMD cmd = this.recvCmdQueue.Peek(); long num4 = (cmd.framID); if (num4 > this.ClientCurFrame) { break; } //cmd.framID = num4; cmd = this.recvCmdQueue.Dequeue(); //Debug.LogError("处理移动.."); cmd.Exec(); } num--; CurFrameSplitIndex = 1; tempSplitFrameStartTime = GetLocalTime(); ASTest.Singleton.UpdateLogic(FrameSplitDelta); //if (num > 0) //{ // for (int i = 0; i < FrameSplitCount; i++) // ASTest.Singleton.UpdateLogic((int)FrameDelta / FrameSplitCount); // CurFrameSplitIndex = FrameSplitCount; //} //else //{ // CurFrameSplitIndex = 1; // ASTest.Singleton.UpdateLogic((int)FrameDelta / FrameSplitCount); //} } else { break; } } //ClientCurFrame = ServerCurFrame; }