diff --git a/OpenRA.FileFormats/Manifest.cs b/OpenRA.FileFormats/Manifest.cs new file mode 100644 index 0000000000..8594286cf7 --- /dev/null +++ b/OpenRA.FileFormats/Manifest.cs @@ -0,0 +1,54 @@ +#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.Collections.Generic; +using System.Linq; + +namespace OpenRA.FileFormats +{ + /* describes what is to be loaded in order to run a set of mods */ + + public class Manifest + { + public readonly string[] + Folders, Packages, Rules, + Sequences, Chrome, Assemblies, ChromeLayout, + Weapons, Voices, Music, Movies, TileSets; + + public readonly string ShellmapUid; + + public Manifest(string[] mods) + { + var yaml = mods + .Select(m => MiniYaml.FromFile("mods/" + m + "/mod.yaml")) + .Aggregate(MiniYaml.Merge); + + Folders = YamlList(yaml, "Folders"); + Packages = YamlList(yaml, "Packages"); + Rules = YamlList(yaml, "Rules"); + Sequences = YamlList(yaml, "Sequences"); + Chrome = YamlList(yaml, "Chrome"); + Assemblies = YamlList(yaml, "Assemblies"); + ChromeLayout = YamlList(yaml, "ChromeLayout"); + Weapons = YamlList(yaml, "Weapons"); + Voices = YamlList(yaml, "Voices"); + Music = YamlList(yaml, "Music"); + Movies = YamlList(yaml, "Movies"); + TileSets = YamlList(yaml, "TileSets"); + + ShellmapUid = yaml["ShellmapUid"].Value; + } + + static string[] YamlList(Dictionary ys, string key) + { + return ys.ContainsKey(key) ? ys[key].Nodes.Keys.ToArray() : new string[] { }; + } + } +} diff --git a/OpenRA.FileFormats/OpenRA.FileFormats.csproj b/OpenRA.FileFormats/OpenRA.FileFormats.csproj index 29aad9e853..94ebb652f9 100644 --- a/OpenRA.FileFormats/OpenRA.FileFormats.csproj +++ b/OpenRA.FileFormats/OpenRA.FileFormats.csproj @@ -1,4 +1,4 @@ - + Debug @@ -62,6 +62,7 @@ + diff --git a/OpenRA.FileFormats/Session.cs b/OpenRA.FileFormats/Session.cs index 93446620dd..5c7e262a2b 100644 --- a/OpenRA.FileFormats/Session.cs +++ b/OpenRA.FileFormats/Session.cs @@ -50,41 +50,4 @@ namespace OpenRA.FileFormats public bool AllowCheats = false; } } - - public class Manifest - { - public readonly string[] - Folders, Packages, Rules, - Sequences, Chrome, Assemblies, ChromeLayout, - Weapons, Voices, Music, Movies, TileSets; - - public readonly string ShellmapUid; - - public Manifest(string[] mods) - { - var yaml = mods - .Select(m => MiniYaml.FromFile("mods/" + m + "/mod.yaml")) - .Aggregate(MiniYaml.Merge); - - Folders = YamlList(yaml, "Folders"); - Packages = YamlList(yaml, "Packages"); - Rules = YamlList(yaml, "Rules"); - Sequences = YamlList(yaml, "Sequences"); - Chrome = YamlList(yaml, "Chrome"); - Assemblies = YamlList(yaml, "Assemblies"); - ChromeLayout = YamlList(yaml, "ChromeLayout"); - Weapons = YamlList(yaml, "Weapons"); - Voices = YamlList(yaml, "Voices"); - Music = YamlList(yaml, "Music"); - Movies = YamlList(yaml, "Movies"); - TileSets = YamlList(yaml, "TileSets"); - - ShellmapUid = yaml["ShellmapUid"].Value; - } - - static string[] YamlList(Dictionary ys, string key) - { - return ys.ContainsKey(key) ? ys[key].Nodes.Keys.ToArray() : new string[] { }; - } - } }