43 lines
1.2 KiB
C#
Executable File
43 lines
1.2 KiB
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using OpenRA.FileFormats;
|
|
using OpenRA.Graphics;
|
|
using System.IO;
|
|
|
|
namespace OpenRA
|
|
{
|
|
public class ModData
|
|
{
|
|
public readonly Manifest Manifest;
|
|
public readonly ObjectCreator ObjectCreator;
|
|
public readonly SheetBuilder SheetBuilder;
|
|
public readonly CursorSheetBuilder CursorSheetBuilder;
|
|
public readonly Dictionary<string, MapStub> AvailableMaps;
|
|
|
|
public ModData( params string[] mods )
|
|
{
|
|
Manifest = new Manifest( mods );
|
|
ObjectCreator = new ObjectCreator( Manifest );
|
|
FileSystem.LoadFromManifest( Manifest );
|
|
SheetBuilder = new SheetBuilder( TextureChannel.Red );
|
|
CursorSheetBuilder = new CursorSheetBuilder( this );
|
|
|
|
ChromeProvider.Initialize( Manifest.Chrome );
|
|
|
|
AvailableMaps = FindMaps( mods );
|
|
}
|
|
|
|
// TODO: Do this nicer
|
|
static Dictionary<string, MapStub> FindMaps(string[] mods)
|
|
{
|
|
var paths = new[] { "maps/" }.Concat(mods.Select(m => "mods/" + m + "/maps/"))
|
|
.Where(p => Directory.Exists(p))
|
|
.SelectMany(p => Directory.GetDirectories(p)).ToList();
|
|
|
|
return paths.Select(p => new MapStub(new Folder(p))).ToDictionary(m => m.Uid);
|
|
}
|
|
}
|
|
}
|