Options to install scores.mix from RA and CnC CDs
This commit is contained in:
committed by
Matthew
parent
8e1185b56f
commit
5f57dd7a62
@@ -1,8 +1,19 @@
|
||||
using System;
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2010 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 LICENSE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRA.FileFormats;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenRA.Utility
|
||||
{
|
||||
@@ -24,6 +35,8 @@ namespace OpenRA.Utility
|
||||
argCallbacks = new Dictionary<string, ArgCallback>();
|
||||
argCallbacks.Add("--list-mods", ListMods);
|
||||
argCallbacks.Add("--mod-info", ListModInfo);
|
||||
argCallbacks.Add("--install-ra-music", InstallRAMusic);
|
||||
argCallbacks.Add("--install-cnc-music", InstallCncMusic);
|
||||
|
||||
if (args.Length == 0) { PrintUsage(); return; }
|
||||
var arg = SplitArgs(args[0]);
|
||||
@@ -38,19 +51,21 @@ namespace OpenRA.Utility
|
||||
{
|
||||
Console.WriteLine("Usage: OpenRA.Utility.exe [OPTION]");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(" --list-mods List currently installed mods");
|
||||
Console.WriteLine(" --mod-info=MODS List metadata for MODS (comma separated list of mods)");
|
||||
Console.WriteLine(" --list-mods List currently installed mods");
|
||||
Console.WriteLine(" --mod-info=MODS List metadata for MODS (comma separated list of mods)");
|
||||
Console.WriteLine(" --install-ra-music=PATH Install scores.mix from PATH to Red Alert CD");
|
||||
Console.WriteLine(" --install-cnc-music=PATH Install scores.mix from PATH to Command & Conquer CD");
|
||||
}
|
||||
|
||||
static void ListMods(string argValue)
|
||||
static void ListMods(string _)
|
||||
{
|
||||
foreach (var m in Mod.AllMods.Where(x => !x.Key.StartsWith("Invalid mod:")).Select(x => x.Key))
|
||||
Console.WriteLine(m);
|
||||
}
|
||||
|
||||
static void ListModInfo(string argValue)
|
||||
static void ListModInfo(string modList)
|
||||
{
|
||||
string[] mods = argValue.Split(',');
|
||||
string[] mods = modList.Split(',');
|
||||
foreach (var m in mods)
|
||||
{
|
||||
var mod = Mod.AllMods
|
||||
@@ -72,5 +87,30 @@ namespace OpenRA.Utility
|
||||
Console.WriteLine(" Standalone: {0}", mod.Standalone.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
static void InstallRAMusic(string path)
|
||||
{
|
||||
if (!Directory.Exists(path)) { Console.WriteLine("Error: Path {0} does not exist", path); return; }
|
||||
FileSystem.Mount(path);
|
||||
if (!FileSystem.Exists("MAIN.MIX")) { Console.WriteLine("Error: Could not find MAIN.MIX in path {0}", path); return; }
|
||||
FileSystem.Mount("MAIN.MIX");
|
||||
|
||||
using (var scoresStream = FileSystem.Open("scores.mix"))
|
||||
using (var destStream = File.Create(string.Format("mods{0}ra{0}packages{0}scores.mix", Path.DirectorySeparatorChar)))
|
||||
destStream.Write(scoresStream.ReadAllBytes());
|
||||
|
||||
Console.WriteLine("Done");
|
||||
}
|
||||
|
||||
static void InstallCncMusic(string path)
|
||||
{
|
||||
if (!Directory.Exists(path)) { Console.WriteLine("Error: Path {0} does not exist", path); return; }
|
||||
string scoresMixPath = path + Path.DirectorySeparatorChar + "SCORES.MIX";
|
||||
if (!File.Exists(scoresMixPath)) { Console.WriteLine("Error: Could not find SCORES.MIX in path {0}", path); return; }
|
||||
|
||||
File.Copy(scoresMixPath, string.Format("mods{0}cnc{0}packages{0}scores.mix", Path.DirectorySeparatorChar), true);
|
||||
|
||||
Console.WriteLine("Done");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("OpenRA")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2010 OpenRA Development Team")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2010 The OpenRA Developers")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user