Remove file prompting and drop all the remaining utility communication plumbing.
This commit is contained in:
@@ -27,8 +27,6 @@ namespace OpenRA
|
||||
{
|
||||
public static class Game
|
||||
{
|
||||
public static Utilities Utilities;
|
||||
|
||||
public static int CellSize { get { return modData.Manifest.TileSize; } }
|
||||
|
||||
public static ModData modData;
|
||||
@@ -244,8 +242,6 @@ namespace OpenRA
|
||||
Console.WriteLine("Platform is {0}", Platform.CurrentPlatform);
|
||||
|
||||
AppDomain.CurrentDomain.AssemblyResolve += FileSystem.ResolveAssembly;
|
||||
|
||||
Utilities = new Utilities(args.GetValue("UtilityPath", "OpenRA.Utility.exe"));
|
||||
|
||||
Settings = new Settings(Platform.SupportDir + "settings.yaml", args);
|
||||
Settings.Save();
|
||||
|
||||
@@ -177,7 +177,6 @@
|
||||
<Compile Include="Graphics\ShroudRenderer.cs" />
|
||||
<Compile Include="Network\Handshake.cs" />
|
||||
<Compile Include="Widgets\ProgressBarWidget.cs" />
|
||||
<Compile Include="Utilities.cs" />
|
||||
<Compile Include="Traits\Waypoint.cs" />
|
||||
<Compile Include="Traits\Activities\Activity.cs" />
|
||||
<Compile Include="Widgets\ScrollItem.cs" />
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
public class Utilities
|
||||
{
|
||||
readonly string Utility;
|
||||
|
||||
public Utilities(string utility)
|
||||
{
|
||||
Utility = utility;
|
||||
}
|
||||
|
||||
public void PromptFilepathAsync(string title, Action<string> withPath)
|
||||
{
|
||||
ExecuteUtility("--display-filepicker \"{0}\"".F(title), withPath);
|
||||
}
|
||||
|
||||
void ExecuteUtility(string args, Action<string> onComplete)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process p = new Process();
|
||||
p.StartInfo.FileName = Utility;
|
||||
p.StartInfo.Arguments = args;
|
||||
p.StartInfo.CreateNoWindow = true;
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.EnableRaisingEvents = true;
|
||||
p.Exited += (_,e) =>
|
||||
{
|
||||
onComplete(p.StandardOutput.ReadToEnd().Trim());
|
||||
};
|
||||
p.Start();
|
||||
}
|
||||
catch(System.ComponentModel.Win32Exception) {} // Don't crash if the process fails
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user