Skip to content

Commit

Permalink
Fix bug when adding long name file
Browse files Browse the repository at this point in the history
  • Loading branch information
inSight committed Jul 6, 2018
1 parent e0adc44 commit 705ee71
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 14 deletions.
Binary file modified ExpertVideoToolbox.v12.suo
Binary file not shown.
13 changes: 12 additions & 1 deletion ExpertVideoToolbox/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,18 @@ private void addItem2FileListView(string fp, string setting)
{
if (frontTextLength <= 3) // 文本前部即将小于最小宽度,只能修建文本后部
{
visualfp = fp.Substring(0, frontTextLength) + ("").PadLeft(dotCount, '0').Replace("0", dot) + fp.Substring(++rearStartIndex, rearTextLength);
// 已知问题:遇到超长字符串时,修剪完前部文本再修剪后部文本时,函数直接从这里跳出,没有异常,界面上也显示不了这个文件。
// 准备先加异常处理看看。20180531 1320
try
{
visualfp = fp.Substring(0, frontTextLength) + ("").PadLeft(dotCount, '0').Replace("0", dot) + fp.Substring(++rearStartIndex, rearTextLength);
}
catch (Exception e)
{
//MessageBox.Show(e.ToString());
break;
}

}
else // 否则修剪文本前部
{
Expand Down
4 changes: 2 additions & 2 deletions ExpertVideoToolbox/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.9")]
[assembly: AssemblyFileVersion("0.1.0.152")]
[assembly: AssemblyVersion("0.2.3")]
[assembly: AssemblyFileVersion("0.2.3.169")]
61 changes: 50 additions & 11 deletions ExpertVideoToolbox/TaskManager/Job.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,15 @@ private void runTask(videoTask t, Process process)
this.finishedNum++;
this.rsForm.setStatusBarFilesCountLabel(this.finishedNum, this.num);

process.CancelErrorRead();
process.CancelOutputRead();
try
{
process.CancelErrorRead();
process.CancelOutputRead();
}
catch (Exception e)
{
//saveLog2File();
}

this.rsForm.setEta("");
this.rsForm.setFps("");
Expand Down Expand Up @@ -272,8 +279,15 @@ private void runTask(videoTask t, Process process)
this.rsForm.setStatusBarFilesCountLabel(this.finishedNum, this.num);
this.rsForm.HideVideoEncoderSetting();

process.CancelErrorRead();
process.CancelOutputRead();
try
{
process.CancelErrorRead();
process.CancelOutputRead();
}
catch (Exception e)
{
//saveLog2File();
}

Thread.Sleep(sleepTime * 1000);

Expand Down Expand Up @@ -332,10 +346,17 @@ private void runTask(videoTask t, Process process)

cmd = c.cmdCodeGenerate(VIDEOENCODE, this.videoType);
process.StandardInput.WriteLine(cmd);

process.BeginErrorReadLine();
process.BeginOutputReadLine();

try
{
process.BeginErrorReadLine();
process.BeginOutputReadLine();
}
catch (Exception e)
{
//saveLog2File();
}

checkNum = 0;
this.reportCount = 0;
int cpx2 = this.checkPattern + this.checkPattern;
Expand Down Expand Up @@ -435,8 +456,16 @@ private void runTask(videoTask t, Process process)

Thread.Sleep(processCheckInterval);
}
process.CancelErrorRead();
process.CancelOutputRead();
try
{
process.CancelErrorRead();
process.CancelOutputRead();
}
catch (Exception e)
{
//saveLog2File();
}

this.rsForm.HideVideoEncoderSetting();
};

Expand All @@ -449,8 +478,17 @@ private void runTask(videoTask t, Process process)

cmd = c.cmdCodeGenerate(MUXER);
process.StandardInput.WriteLine(cmd);
process.BeginErrorReadLine();
process.BeginOutputReadLine();

try
{
process.BeginErrorReadLine();
process.BeginOutputReadLine();
}
catch (Exception e)
{
//saveLog2File();
}

checkNum = 0;

Thread.Sleep(beforeProcessCheckTime); // 有些超短的视频(1-2M),如果不加这句就会直接判定为任务已失败,疑似原因:没等判断完进程就已经结束
Expand Down Expand Up @@ -498,6 +536,7 @@ private void runTask(videoTask t, Process process)
// return;
//}
}

afterSuccess();

string tempVideoFp = c.cmdCodeGenerate(DELETEVIDEOTEMP);
Expand Down

0 comments on commit 705ee71

Please sign in to comment.