Replaced hardcoded SourceType with custom defined ISourceResolver.

This commit is contained in:
IceReaper
2022-11-06 19:33:01 +01:00
committed by Matthias Mailänder
parent 7188f88ba1
commit 35eb246080
34 changed files with 313 additions and 117 deletions

View File

@@ -18,7 +18,6 @@ namespace OpenRA
{
public class ModContent : IGlobalModData
{
public enum SourceType { Disc, RegistryDirectory, RegistryDirectoryFromFile }
public class ModPackage
{
public readonly string Title;
@@ -42,7 +41,9 @@ namespace OpenRA
public class ModSource
{
public readonly ObjectCreator ObjectCreator;
public readonly SourceType Type = SourceType.Disc;
[FieldLoader.Ignore]
public readonly MiniYaml Type;
// Used to find installation locations for SourceType.Install
public readonly string[] RegistryPrefixes = { string.Empty };
@@ -62,6 +63,10 @@ namespace OpenRA
ObjectCreator = objectCreator;
Title = yaml.Value;
var type = yaml.Nodes.FirstOrDefault(n => n.Key == "Type");
if (type != null)
Type = type.Value;
var idFiles = yaml.Nodes.FirstOrDefault(n => n.Key == "IDFiles");
if (idFiles != null)
IDFiles = idFiles.Value;