Skip to content

Commit e0fe17f

Browse files
committed
Fixed the bug of additional tasks crashing the app.
1 parent a792d1f commit e0fe17f

File tree

13 files changed

+39
-27
lines changed

13 files changed

+39
-27
lines changed

OKEGui/OKEGui/App.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ static App()
1616
{
1717
if (EnvironmentChecker.CheckEnviornment())
1818
{
19-
ConfigManager.ConfigLogger();
20-
ConfigManager.WriteConfig();
19+
Initializer.ConfigLogger();
20+
Initializer.WriteConfig();
2121
Logger.Info("程序正常启动");
2222
}
2323
else

OKEGui/OKEGui/Gui/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private void BtnNew_Click(object sender, RoutedEventArgs e)
5555
// 新建任务。具体实现请见Gui/wizardWindow
5656
try
5757
{
58-
var wizard = new WizardWindow(ref tm);
58+
var wizard = new WizardWindow(wm);
5959
wizard.ShowDialog();
6060
BtnRun.IsEnabled = true;
6161
tm.IsCanStart = true;

OKEGui/OKEGui/Gui/WizardWindow.xaml.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
using System.Collections.Generic;
33
using System.Collections.ObjectModel;
44
using System.ComponentModel;
5-
using System.Diagnostics;
65
using System.IO;
76
using System.Linq;
87
using System.Windows;
98
using System.Windows.Forms;
10-
using Newtonsoft.Json;
119
using OKEGui.Utils;
1210
using OKEGui.Model;
11+
using OKEGui.Worker;
1312

1413
namespace OKEGui
1514
{
@@ -58,11 +57,11 @@ public void OnPropertyChanged(PropertyChangedEventArgs e)
5857
}
5958

6059
private readonly NewTask wizardInfo = new NewTask();
61-
private readonly TaskManager taskManager;
60+
private readonly WorkerManager workerManager;
6261
private TaskProfile json;
6362
private string vsScript;
6463

65-
public WizardWindow(ref TaskManager t)
64+
public WizardWindow(WorkerManager w)
6665
{
6766
InitializeComponent();
6867
taskWizard.BackButtonContent = "上一步";
@@ -73,7 +72,7 @@ public WizardWindow(ref TaskManager t)
7372
taskWizard.NextButtonContent = "下一步";
7473
DataContext = wizardInfo;
7574

76-
taskManager = t;
75+
workerManager = w;
7776
}
7877

7978
// 读入json文件,检查项目设置,并生成预览信息
@@ -217,7 +216,7 @@ private void WizardFinish(object sender, RoutedEventArgs e)
217216
td.Taskfile.InputScript = fileName;
218217
td.UpdateOutputFileName();
219218

220-
taskManager.AddTask(td);
219+
workerManager.AddTask(td);
221220
}
222221
}
223222

OKEGui/OKEGui/JobProcessor/Demuxer/EACDemuxer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ private void DetectFileTracks(string line)
220220
{
221221
line = line.Trim();
222222
if (string.IsNullOrEmpty(line)) return;
223-
Logger.Info(line);
223+
Logger.Trace(line);
224224
if (Regex.IsMatch(line, @"\d*:\d*:\d*"))
225225
{
226226
string[] match = Regex.Split(line, @"(\d*):(\d*):(\d*)");
@@ -242,7 +242,7 @@ private void DetectFileTracks(string line)
242242
{
243243
return;
244244
}
245-
245+
Logger.Debug(line);
246246
var trackInfo = new TrackInfo
247247
{
248248
Index = Convert.ToInt32(match.Groups[1].Value),

OKEGui/OKEGui/JobProcessor/Video/VSPipeProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static IJobProcessor NewVSPipeProcessor(Job j)
2626
public VSPipeProcessor(VideoInfoJob j) : base()
2727
{
2828
// 获取VSPipe路径
29-
this.executable = ConfigManager.Config.vspipePath;
29+
this.executable = Initializer.Config.vspipePath;
3030
videoInfo = new VSVideoInfo();
3131

3232
StringBuilder sb = new StringBuilder();

OKEGui/OKEGui/JobProcessor/Video/X264Encoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public X264Encoder(Job j) : base()
2727
}
2828

2929
// 获取VSPipe路径
30-
this.VspipePath = ConfigManager.Config.vspipePath;
30+
this.VspipePath = Initializer.Config.vspipePath;
3131

3232
commandLine = BuildCommandline(job.EncodeParam, job.NumaNode);
3333
}

OKEGui/OKEGui/JobProcessor/Video/x265Encoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public X265Encoder(Job j) : base()
2626
}
2727

2828
// 获取VSPipe路径
29-
this.vspipePath = ConfigManager.Config.vspipePath;
29+
this.vspipePath = Initializer.Config.vspipePath;
3030

3131
commandLine = BuildCommandline(job.EncodeParam, job.NumaNode);
3232
}

OKEGui/OKEGui/OKEGui.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
<Compile Include="Worker\ExecuteTaskService.cs" />
140140
<Compile Include="Task\TaskStatus.cs" />
141141
<Compile Include="Utils\Cleaner.cs" />
142-
<Compile Include="Utils\ConfigManager.cs" />
142+
<Compile Include="Utils\Initializer.cs" />
143143
<Compile Include="Utils\Constants.cs" />
144144
<Compile Include="Utils\CRC32.cs" />
145145
<Compile Include="Utils\EnvironmentChecker.cs" />

OKEGui/OKEGui/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@
4747
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
4848
// 方法是按如下所示使用“*”: :
4949
// [assembly: AssemblyVersion("1.0.*")]
50-
[assembly: AssemblyVersion("4.7.*")]
50+
[assembly: AssemblyVersion("4.8.*")]

OKEGui/OKEGui/Utils/EnvironmentChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static bool CheckEnviornment()
1818
MessageBox.Show("没有权限控制OKEGui所在的文件夹,请保证当前用户获取了目录权限,或者以管理员模式运行。", "没有权限控制OKEGui所在的文件夹");
1919
return false;
2020
}
21-
Config = ConfigManager.LoadConfig();
21+
Config = Initializer.LoadConfig();
2222

2323
return CheckVspipe() && CheckQAAC() && CheckFfmpeg();
2424
}

0 commit comments

Comments
 (0)