static void Main(string[] args) { PerfTracker.StartupEvent("Entered main"); Event.AddEventsFromAssembly(Assembly.GetAssembly(typeof(UAlbion.Api.Event))); Event.AddEventsFromAssembly(Assembly.GetAssembly(typeof(UAlbion.Core.Events.HelpEvent))); Event.AddEventsFromAssembly(Assembly.GetAssembly(typeof(UAlbion.Core.Veldrid.Events.InputEvent))); Event.AddEventsFromAssembly(Assembly.GetAssembly(typeof(UAlbion.Editor.EditorSetPropertyEvent))); Event.AddEventsFromAssembly(Assembly.GetAssembly(typeof(UAlbion.Formats.ScriptEvents.PartyMoveEvent))); Event.AddEventsFromAssembly(Assembly.GetAssembly(typeof(UAlbion.Game.Events.StartEvent))); Event.AddEventsFromAssembly(Assembly.GetAssembly(typeof(UAlbion.Game.Veldrid.Debugging.HideDebugWindowEvent))); Event.AddEventsFromAssembly(Assembly.GetAssembly(typeof(IsoYawEvent))); PerfTracker.StartupEvent("Built event parsers"); var commandLine = new CommandLineOptions(args); if (commandLine.Mode == ExecutionMode.Exit) { return; } PerfTracker.StartupEvent($"Running as {commandLine.Mode}"); var disk = new FileSystem(); var jsonUtil = new FormatJsonUtil(); var baseDir = ConfigUtil.FindBasePath(disk); if (baseDir == null) { throw new InvalidOperationException("No base directory could be found."); } PerfTracker.StartupEvent($"Found base directory {baseDir}"); if (commandLine.Mode == ExecutionMode.ConvertAssets) { ConvertAssets.Convert( disk, jsonUtil, commandLine.ConvertFrom, commandLine.ConvertTo, commandLine.DumpIds, commandLine.DumpAssetTypes, commandLine.ConvertFilePattern); return; } var(exchange, services) = AssetSystem.SetupAsync(baseDir, disk, jsonUtil).Result; if (commandLine.NeedsEngine) { BuildEngine(commandLine, exchange); } services.Add(new StdioConsoleReader()); var assets = exchange.Resolve <IAssetManager>(); AutodetectLanguage(exchange, assets); switch (commandLine.Mode) // ConvertAssets handled above as it requires a specialised asset system setup { case ExecutionMode.Game: Albion.RunGame(exchange, services, baseDir, commandLine); break; case ExecutionMode.BakeIsometric: IsometricTest.Run(exchange, commandLine); break; case ExecutionMode.DumpData: PerfTracker.BeginFrame(); // Don't need to show verbose startup logging while dumping var tf = new TextFormatter(); exchange.Attach(tf); var parsedIds = commandLine.DumpIds?.Select(AssetId.Parse).ToArray(); if ((commandLine.DumpFormats & DumpFormats.Json) != 0) { DumpJson.Dump(baseDir, assets, commandLine.DumpAssetTypes, parsedIds); } if ((commandLine.DumpFormats & DumpFormats.Text) != 0) { DumpText.Dump(assets, baseDir, tf, commandLine.DumpAssetTypes, parsedIds); } if ((commandLine.DumpFormats & DumpFormats.Png) != 0) { var dumper = new DumpGraphics(); exchange.Attach(dumper); dumper.Dump(baseDir, commandLine.DumpAssetTypes, commandLine.DumpFormats, parsedIds); } //if ((commandLine.DumpFormats & DumpFormats.Tiled) != 0) // DumpTiled.Dump(baseDir, assets, commandLine.DumpAssetTypes, parsedIds); break; case ExecutionMode.Exit: break; } Console.WriteLine("Exiting"); exchange.Dispose(); }
public static void Run(EventExchange exchange, CommandLineOptions cmdLine) { using var test = new IsometricTest(cmdLine); exchange.Attach(test); test.Detach(); }