Extract content sources and downloads to external files.

This commit is contained in:
Paul Chote
2016-08-05 21:39:20 +01:00
parent 3261516b51
commit 88c43fa9b3
29 changed files with 5266 additions and 5222 deletions

View File

@@ -95,31 +95,21 @@ namespace OpenRA
}
[FieldLoader.LoadUsing("LoadDownloads")]
public readonly Dictionary<string, ModDownload> Downloads;
public readonly string[] Downloads = { };
static object LoadDownloads(MiniYaml yaml)
{
var downloads = new Dictionary<string, ModDownload>();
var downloadNode = yaml.Nodes.FirstOrDefault(n => n.Key == "Downloads");
if (downloadNode != null)
foreach (var node in downloadNode.Value.Nodes)
downloads.Add(node.Key, new ModDownload(node.Value));
return downloads;
return downloadNode != null ? downloadNode.Value.Nodes.Select(n => n.Key).ToArray() : new string[0];
}
[FieldLoader.LoadUsing("LoadSources")]
public readonly Dictionary<string, ModSource> Sources;
public readonly string[] Sources = { };
static object LoadSources(MiniYaml yaml)
{
var sources = new Dictionary<string, ModSource>();
var sourceNode = yaml.Nodes.FirstOrDefault(n => n.Key == "Sources");
if (sourceNode != null)
foreach (var node in sourceNode.Value.Nodes)
sources.Add(node.Key, new ModSource(node.Value));
return sources;
return sourceNode != null ? sourceNode.Value.Nodes.Select(n => n.Key).ToArray() : new string[0];
}
}
}