From 10b8093d5ad34cd0de606d8f1f40eb5f426e6cd4 Mon Sep 17 00:00:00 2001 From: Pavlos Touboulidis Date: Sat, 10 May 2014 18:21:00 +0300 Subject: [PATCH] Rename ModInformation to ModMetadata --- OpenRA.Editor/Form1.cs | 2 +- OpenRA.Game/Game.cs | 4 ++-- OpenRA.Game/Manifest.cs | 4 ++-- .../{ModInformation.cs => ModMetadata.cs} | 10 +++++----- OpenRA.Game/OpenRA.Game.csproj | 2 +- OpenRA.Mods.RA/Widgets/Logic/ModBrowserLogic.cs | 16 ++++++++-------- .../Widgets/Logic/ServerBrowserLogic.cs | 4 ++-- 7 files changed, 21 insertions(+), 21 deletions(-) rename OpenRA.Game/{ModInformation.cs => ModMetadata.cs} (69%) diff --git a/OpenRA.Editor/Form1.cs b/OpenRA.Editor/Form1.cs index 36cc93dc30..f93a637719 100644 --- a/OpenRA.Editor/Form1.cs +++ b/OpenRA.Editor/Form1.cs @@ -29,7 +29,7 @@ namespace OpenRA.Editor currentMod = args.FirstOrDefault() ?? "ra"; - toolStripComboBox1.Items.AddRange(ModInformation.AllMods.Keys.ToArray()); + toolStripComboBox1.Items.AddRange(ModMetadata.AllMods.Keys.ToArray()); toolStripComboBox1.SelectedIndexChanged += (_, e) => { diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 910c547c41..bc65182842 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -360,7 +360,7 @@ namespace OpenRA } Console.WriteLine("Available mods:"); - foreach (var mod in ModInformation.AllMods) + foreach (var mod in ModMetadata.AllMods) Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version); InitializeWithMod(Settings.Game.Mod, args.GetValue("Launch.Replay", null)); @@ -385,7 +385,7 @@ namespace OpenRA orderManager.Dispose(); // Fall back to default if the mod doesn't exist - if (!ModInformation.AllMods.ContainsKey(mod)) + if (!ModMetadata.AllMods.ContainsKey(mod)) mod = new GameSettings().Mod; Console.WriteLine("Loading mod: {0}", mod); diff --git a/OpenRA.Game/Manifest.cs b/OpenRA.Game/Manifest.cs index c804077654..6f2b45007d 100644 --- a/OpenRA.Game/Manifest.cs +++ b/OpenRA.Game/Manifest.cs @@ -19,7 +19,7 @@ namespace OpenRA // Describes what is to be loaded in order to run a mod public class Manifest { - public readonly ModInformation Mod; + public readonly ModMetadata Mod; public readonly string[] Folders, MapFolders, Rules, ServerTraits, Sequences, VoxelSequences, Cursors, Chrome, Assemblies, ChromeLayout, @@ -38,7 +38,7 @@ namespace OpenRA var path = new[] { "mods", mod, "mod.yaml" }.Aggregate(Path.Combine); var yaml = new MiniYaml(null, MiniYaml.FromFile(path)).NodesDict; - Mod = FieldLoader.Load(yaml["Metadata"]); + Mod = FieldLoader.Load(yaml["Metadata"]); Mod.Id = mod; // TODO: Use fieldloader diff --git a/OpenRA.Game/ModInformation.cs b/OpenRA.Game/ModMetadata.cs similarity index 69% rename from OpenRA.Game/ModInformation.cs rename to OpenRA.Game/ModMetadata.cs index 6c0c0036ed..b37b9d16cd 100644 --- a/OpenRA.Game/ModInformation.cs +++ b/OpenRA.Game/ModMetadata.cs @@ -14,9 +14,9 @@ using System.Linq; namespace OpenRA { - public class ModInformation + public class ModMetadata { - public static readonly Dictionary AllMods = ValidateMods(Directory.GetDirectories("mods").Select(x => x.Substring(5)).ToArray()); + public static readonly Dictionary AllMods = ValidateMods(Directory.GetDirectories("mods").Select(x => x.Substring(5)).ToArray()); public string Id; public string Title; @@ -24,9 +24,9 @@ namespace OpenRA public string Version; public string Author; - public static Dictionary ValidateMods(string[] mods) + public static Dictionary ValidateMods(string[] mods) { - var ret = new Dictionary(); + var ret = new Dictionary(); foreach (var m in mods) { var yamlPath = new[] { "mods", m, "mod.yaml" }.Aggregate(Path.Combine); @@ -37,7 +37,7 @@ namespace OpenRA if (!yaml.NodesDict.ContainsKey("Metadata")) continue; - var mod = FieldLoader.Load(yaml.NodesDict["Metadata"]); + var mod = FieldLoader.Load(yaml.NodesDict["Metadata"]); mod.Id = m; ret.Add(m, mod); diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index d3ed2f4754..122602e78e 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -244,7 +244,7 @@ - + diff --git a/OpenRA.Mods.RA/Widgets/Logic/ModBrowserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ModBrowserLogic.cs index 6f4aea1166..c1164678bd 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ModBrowserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ModBrowserLogic.cs @@ -23,8 +23,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic { Widget modList; ButtonWidget modTemplate; - ModInformation[] allMods; - ModInformation selectedMod; + ModMetadata[] allMods; + ModMetadata selectedMod; string selectedAuthor; string selectedDescription; int modOffset = 0; @@ -67,7 +67,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic var sheetBuilder = new SheetBuilder(SheetType.BGRA); previews = new Dictionary(); logos = new Dictionary(); - allMods = ModInformation.AllMods.Values.Where(m => m.Id != "modchooser") + allMods = ModMetadata.AllMods.Values.Where(m => m.Id != "modchooser") .OrderBy(m => m.Title) .ToArray(); @@ -96,9 +96,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic } - ModInformation initialMod = null; - ModInformation.AllMods.TryGetValue(Game.Settings.Game.PreviousMod, out initialMod); - SelectMod(initialMod ?? ModInformation.AllMods["ra"]); + ModMetadata initialMod = null; + ModMetadata.AllMods.TryGetValue(Game.Settings.Game.PreviousMod, out initialMod); + SelectMod(initialMod ?? ModMetadata.AllMods["ra"]); RebuildModList(); } @@ -147,7 +147,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic } } - void SelectMod(ModInformation mod) + void SelectMod(ModMetadata mod) { selectedMod = mod; selectedAuthor = "By " + mod.Author ?? "unknown author"; @@ -157,7 +157,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic modOffset = selectedIndex - 4; } - void LoadMod(ModInformation mod) + void LoadMod(ModMetadata mod) { Game.RunAfterTick(() => { diff --git a/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs index 6e8afa10ac..ea8fd80963 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs @@ -315,10 +315,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic public static string GenerateModLabel(GameServer s) { - ModInformation mod; + ModMetadata mod; var modVersion = s.Mods.Split('@'); - if (modVersion.Length == 2 && ModInformation.AllMods.TryGetValue(modVersion[0], out mod)) + if (modVersion.Length == 2 && ModMetadata.AllMods.TryGetValue(modVersion[0], out mod)) return "{0} ({1})".F(mod.Title, modVersion[1]); return "Unknown mod: {0}".F(s.Mods);