//private Process process = null; public Job(filePathStorage tempQueue) { // 从storage读取num this.num = tempQueue.Count(); this.threadsNum = 1; this.finishedNum = 0; //MessageBox.Show("Get: " + this.num); // 初始化task数组来feed下面的queue this.tasks = new qaacTask[num]; this.PIDs = new int[threadsNum]; this.isfinished = new bool[threadsNum]; this.commonCode = tempQueue.c; for (int i = 0; i < num; i++) { // 从临时队列读取文件路径 string path = tempQueue.get(i); this.tasks[i] = new qaacTask(path); //MessageBox.Show("Get: " + this.tasks[i].filePath); } // 初始化运行池pool this.rp = new runningPool(this.num, this.tasks); // 运行池持有队列,需传递队列的相关参数 // 初始化运行状态窗口 this.rsForm = new RunningStatusForm(); }
// !!点击开始转换 private void StartBtn_Click(object sender, EventArgs e) { if (this.fileListView.Items.Count == 0) { string noFileMsg = "未添加任何文件"; MessageBox.Show(noFileMsg); } else { if (checkSettingChange() == -1) { MessageBox.Show("一个或多个任务的预设已被删除,请重新添加预设!"); return; } if (checkSettingChange() == 1) // 1为真,表示有变化 { string note = "检测到预设已修改,是否覆盖当前选中的预设?\n点击“确定”将覆盖并应用该预设到全部任务。点击“取消”将中止任务且不做改动。"; DialogResult dr = MessageBox.Show(note, "检测到预设修改", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { //点确定的代码 saveSetting2File(this.encodeSettingCB.Text); readAllSettingsFromFiles(); for (int i = 0; i < this.fileListView.Items.Count; i++) { fileListView.Items[i].SubItems[1].Text = this.encodeSettingCB.Text; } } else { //点取消的代码 return; } } int count = fileListView.Items.Count; filePathStorage q = new filePathStorage(count); for (int i = 0; i < count; i++) { if (!CheckSettingExist(fileListView.Items[i].SubItems[1].Text)) { MessageBox.Show("一个或多个任务的预设已被删除,请检查编码设置!"); return; } // subitems[2]中保存着完整文件名 videoTask t = new videoTask(fileListView.Items[i].SubItems[2].Text, fileListView.Items[i].SubItems[1].Text); q.add(t); } this.j = new Job(q); //this.j.ErrorEvent += DisposeJob; this.j.runJob(this.outputFilePathTB.Text); } }
public MainForm() { InitializeComponent(); q = new filePathStorage(); this.profileCB.SelectedIndex = 0; this.codecModeCB.SelectedIndex = 3; string defaultOutputFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\m4a\\"; this.outputPathTB.Text = defaultOutputFolder; CheckForIllegalCrossThreadCalls = false; }
//private Process process = null; public Job(filePathStorage tempQueue) { // 从storage读取num this.num = tempQueue.Count(); this.threadsNum = 1; this.finishedNum = 0; encoding = false; audioProcessing = false; muxing = false; // 初始化task数组来feed下面的queue this.tasks = new videoTask[num]; this.PIDs = new int[threadsNum]; this.subTaskPID = Int32.MaxValue; this.isfinished = new bool[threadsNum]; reportCount = 0; checkPattern = 80; int cpx2 = checkPattern + checkPattern; checkTime = new int[cpx2]; checkFrame = new int[cpx2]; this.fps = new double[cpx2]; for (int i = 0; i < cpx2; i++) { this.fps[i] = 0; } for (int i = 0; i < num; i++) { this.tasks[i] = tempQueue.get(i); } // 初始化运行池pool this.rp = new runningPool(this.num, this.tasks); // 运行池持有队列,需传递队列的相关参数 // 初始化运行状态窗口 this.rsForm = new RunningStatusForm(); log = new StringBuilder(""); this.rsForm.AbortEvent += saveLog2File; this.rsForm.ClosingEvent += AllThreadKill; }