Skip to content

Commit 0bab337

Browse files
committed
0.1.2 Hotfix2
- [Hotfix]Fix a hang with MSFSLayoutGenerator.exe - [Hotfix]Handle errors from MSFSLayoutGenerator.exe
1 parent 898d0de commit 0bab337

File tree

4 files changed

+44
-9
lines changed

4 files changed

+44
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.1.2 (hotfix-2)
2+
- [Hotfix]Fix a hang with MSFSLayoutGenerator.exe
3+
- [Hotfix]Handle errors from MSFSLayoutGenerator.exe
4+
15
# 0.1.2 (hotfix-1)
26
- Add BuilderLogError.txt opener to provide info on failures.. (Incomplete) (Note: No Steam Support yet)
37
- Dialog at end asks to open log file on error.

ExeClass.cs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,46 @@ private void ConsoleWriteLine(string line)
1414
});
1515
}
1616

17-
public async Task SpawnProc(string proc, string args)
17+
18+
public async Task SpawnProc(string proc, string args, bool sync = false)
1819
{
1920
using Process? p2 = new Process();
2021
p2.StartInfo.FileName = proc;
2122
p2.StartInfo.Arguments = args;
2223
p2.StartInfo.RedirectStandardOutput = true;
24+
if (sync)
25+
{
26+
p2.StartInfo.RedirectStandardInput = true;
27+
}
2328
p2.StartInfo.CreateNoWindow = true;
2429
p2.StartInfo.UseShellExecute = false;
2530
p2.EnableRaisingEvents = true;
26-
p2.OutputDataReceived += (object sender, DataReceivedEventArgs args) =>
31+
if (!sync)
2732
{
28-
ConsoleWriteLine(" " + args.Data);
29-
};
33+
p2.OutputDataReceived += (object sender, DataReceivedEventArgs args) =>
34+
{
35+
ConsoleWriteLine(" " + args.Data);
36+
};
37+
}
3038
p2.Start();
31-
p2.BeginOutputReadLine();
32-
await p2.WaitForExitAsync();
39+
if (!sync)
40+
{
41+
p2.BeginOutputReadLine();
42+
}
43+
if (sync)
44+
{
45+
string outp = p2.StandardOutput.ReadToEnd();
46+
ConsoleWriteLine(outp); // force read console.
47+
if (outp.Contains("Press any key to exit...")) // Hardcoded for only sync proc.
48+
{
49+
mainWindowRef.GeneralError = true;
50+
}
51+
p2.WaitForExit();
52+
}
53+
else
54+
{
55+
await p2.WaitForExitAsync();
56+
}
3357
}
3458
public async Task ProcMon(string processName)
3559
{

LC24.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public async void ProcessHandler(bool isJsonAvail = false)
162162
ConsoleWriteLine("layout.json found! running MSFSLayoutGenerator.exe...");
163163
if (File.Exists(Properties.Settings.Default.layoutGenPath + "\\MSFSLayoutGenerator.exe"))
164164
{
165-
await exeClass.SpawnProc(Properties.Settings.Default.layoutGenPath + "\\MSFSLayoutGenerator.exe", Properties.Settings.Default.projectPath + "\\layout.json");
165+
await exeClass.SpawnProc(Properties.Settings.Default.layoutGenPath + "\\MSFSLayoutGenerator.exe", Properties.Settings.Default.projectPath + "\\layout.json", true);
166166
}
167167
else
168168
{
@@ -177,7 +177,14 @@ public async void ProcessHandler(bool isJsonAvail = false)
177177
ConsoleWriteLine("Converted textures can be found here: " + Properties.Settings.Default.texturePath);
178178
mainWindowRef.GeneralError = true;
179179
}
180-
ConsoleWriteLine("Conversion Complete!");
180+
if (mainWindowRef.GeneralError)
181+
{
182+
ConsoleWriteLine("Conversion Complete with errors!");
183+
}
184+
else
185+
{
186+
ConsoleWriteLine("Conversion Complete!");
187+
}
181188
}
182189
else
183190
{

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.2-hf1
1+
0.1.2-hf2

0 commit comments

Comments
 (0)