From d32e2be9413263f16a725ff22cf96184c7043698 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 20 Jan 2011 23:48:18 +1300 Subject: [PATCH] Extract zips using background thread. --- .../Widgets/Delegates/GameInitDelegate.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs index f9c466bff2..66efbf69e0 100755 --- a/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs @@ -223,18 +223,21 @@ namespace OpenRA.Mods.RA.Widgets.Delegates p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardOutput = true; p.Start(); - - using (var reader = p.StandardOutput) + var t = new Thread( _ => { - // This is wrong, chrisf knows why - while (!p.HasExited) + using (var reader = p.StandardOutput) { - string s = reader.ReadLine(); - if (string.IsNullOrEmpty(s)) continue; - parseOutput(s); + // This is wrong, chrisf knows why + while (!p.HasExited) + { + string s = reader.ReadLine(); + if (string.IsNullOrEmpty(s)) continue; + parseOutput(s); + } } - } - onComplete(); + onComplete(); + }) { IsBackground = true }; + t.Start(); } public static void CopyRAFiles(string cdPath, Action parseOutput, Action onComplete)