Bring Windows launcher into line with pchote's ideas.

This commit is contained in:
Matthew Bowra-Dean
2010-11-18 23:41:13 +13:00
committed by Paul Chote
parent 085685a769
commit d2a52fd529
13 changed files with 409 additions and 1058 deletions

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace OpenRA.Launcher
{
public class JSBridge
{
Dictionary<string, Mod> allMods;
public JSBridge(Dictionary<string, Mod> allMods)
{
this.allMods = allMods;
}
public bool fileExistsInMod(string file, string mod)
{
return File.Exists(string.Format("mods{0}{1}{0}{2}", Path.DirectorySeparatorChar, mod, file));
}
public void log(string message)
{
Console.WriteLine("js: " + message);
}
public void launchMod(string mod)
{
string m = mod;
List<string> modList = new List<string>();
modList.Add(m);
if (!allMods.ContainsKey(m)) System.Windows.Forms.MessageBox.Show("allMods does not contain " + m);
while (!string.IsNullOrEmpty(allMods[m].Requires))
{
m = allMods[m].Requires;
modList.Add(m);
}
Process p = new Process();
p.StartInfo.FileName = "OpenRA.Game.exe";
p.StartInfo.Arguments = "Game.Mods=" + string.Join(",", modList.ToArray());
p.Start();
}
}
}