public static void Load(string Module) { LoadedModule = Module; string path = "./Modules/" + Module; ClassLibrary.Instance.ReadBlock(new ParseBlock(new ParseBlock[] { ParseBlock.FromFile(path + "/Theme/Fonts.blk"), new ParseBlock( "class<>", "classes", Enumerable.Repeat(path + "/Theme/Base.blk", 1) .Concat(Directory.EnumerateFiles( path + "/Theme/Components", "*", SearchOption.AllDirectories)) .SelectMany(i => ParseBlock.FromFile(i).Break())) })); var block = new ParseBlock(new ParseBlock[] { ParseBlock.FromFile(path + "/UnitMovementRules.blk"), ParseBlock.FromFile(path + "/Factions.blk"), ParseBlock.FromFile(path + "/FactionRenderDetails.blk"), ParseBlock.FromFile(path + "/Terrain.blk"), ParseBlock.FromFile(path + "/Environments.blk"), ParseBlock.FromFile(path + "/TerrainRenderers.blk"), ParseBlock.FromFile(path + "/NameGenerators.blk"), ParseBlock.FromFile(path + "/TerrainGenerators.blk"), ParseBlock.FromFile(path + "/MatchSettings.blk"), new ParseBlock( "unit-configuration<>", "unit-configurations", LoadDirectory(path + "/UnitConfigurations")), new ParseBlock( "unit-configuration-link<>", "unit-configuration-links", LoadDirectory(path + "/UnitConfigurationLinks")), new ParseBlock( "unit-configuration-lock<>", "unit-configuration-locks", LoadDirectory(path + "/UnitConfigurationLocks")), new ParseBlock( "formation-template<>", "formation-templates", LoadDirectory(path + "/FormationTemplates")), new ParseBlock( "unit-render-details<>", "unit-render-details", LoadDirectory(path + "/UnitRenderDetails")), new ParseBlock( "scenario[]", "scenarios", LoadDirectory(path + "/Scenarios")) }); Load(path, block); }
public static void Load(string Module, SerializationInputStream Stream) { LoadedModule = Module; string Path = "./Modules/" + Module; ClassLibrary.Instance.ReadBlock(new ParseBlock(new ParseBlock[] { ParseBlock.FromFile(Path + "/Theme/Fonts.blk"), new ParseBlock( "class<>", "classes", Enumerable.Repeat(Path + "/Theme/Base.blk", 1) .Concat(Directory.EnumerateFiles( Path + "/Theme/Components", "*", SearchOption.AllDirectories)) .SelectMany(i => ParseBlock.FromFile(i).Break())) })); UnitMovementRules = Stream.ReadEnumerable( i => i.ReadObject(j => new UnitMovementRules(j), false, true)).ToDictionary(i => i.UniqueKey); TileComponentRules = Stream.ReadEnumerable( i => i.ReadObject(j => new TileComponentRules(j), false, true)).ToDictionary(i => i.UniqueKey); Environments = Stream.ReadEnumerable( i => i.ReadObject(j => new Environment(j), false, true)).ToDictionary(i => i.UniqueKey); Factions = Stream.ReadEnumerable( i => i.ReadObject(j => new Faction(j), false, true)).ToDictionary(i => i.UniqueKey); FactionRenderDetails = Stream.ReadEnumerable( i => new KeyValuePair <string, FactionRenderDetails>( i.ReadString(), new FactionRenderDetails(i, Path + "/FactionSymbols/"))).ToDictionary(i => i.Key, i => i.Value); UnitConfigurations = Stream.ReadEnumerable( i => i.ReadObject(j => new UnitConfiguration(j), false, true)).ToDictionary(i => i.UniqueKey); UnitRenderDetails = Stream.ReadEnumerable( i => new KeyValuePair <string, UnitRenderDetails>( i.ReadString(), new UnitRenderDetails(i, Path + "/UnitSprites/"))).ToDictionary(i => i.Key, i => i.Value); UnitConfigurationLinks = Stream.ReadEnumerable(i => new UnitConfigurationLink(i)).ToDictionary(i => i.UniqueKey); UnitConfigurationLocks = Stream.ReadEnumerable(i => new UnitConfigurationLock(i)).ToDictionary(i => i.UniqueKey); Scenarios = Stream.ReadEnumerable(i => new Scenario(i)).ToList(); TileRenderers = Stream.ReadEnumerable(i => new TileRenderer(i)).ToDictionary(i => i.UniqueKey); NameGenerators = Stream.ReadEnumerable( i => new KeyValuePair <string, MarkovGenerator <char> >( Stream.ReadString(), Stream.ReadObject(j => new MarkovGenerator <char>(j)))) .ToDictionary(i => i.Key, i => i.Value); TerrainGenerators = Stream.ReadEnumerable( i => new KeyValuePair <string, TerrainGeneratorConfiguration>( Stream.ReadString(), Stream.ReadObject(j => new TerrainGeneratorConfiguration(j)))) .ToDictionary(i => i.Key, i => i.Value); MatchSettings = Stream.ReadEnumerable(i => new MatchSetting(i)).ToDictionary(i => i.UniqueKey); }
public FlagData(string Path) : this(ParseBlock.FromFile(Path)) { }