-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
executable file
·61 lines (50 loc) · 1.79 KB
/
Copy pathProgram.cs
File metadata and controls
executable file
·61 lines (50 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using IsometricMapViewer;
using System;
// Check for command-line export mode
if (args.Length > 0 && args[0] == "--export")
{
if (args.Length < 2)
{
Console.WriteLine("Usage: dotnet run -- --export <mapname> [output-path]");
Console.WriteLine("Example: dotnet run -- --export arefarm /home/leduardo/maps");
return;
}
string mapName = args[1];
string outputPath = args.Length > 2 ? args[2] : "/home/leduardo/exported-maps";
ExportMapCLI(mapName, outputPath);
return;
}
// GUI mode
var app = new ExporterApp();
app.Run();
static void ExportMapCLI(string mapName, string outputPath)
{
Console.WriteLine($"Exporting map '{mapName}' for BudgetDungeon...");
try
{
var mapPath = System.IO.Path.Combine("resources", "maps", $"{mapName}.amd");
if (!System.IO.File.Exists(mapPath))
{
Console.WriteLine($"Error: Map file not found: {mapPath}");
return;
}
var map = new Map();
if (!map.Load(mapPath))
{
Console.WriteLine($"Error: Failed to load map: {mapPath}");
return;
}
Console.WriteLine($"✓ Loaded map: {map.Width}x{map.Height} tiles");
var exporter = new BudgetDungeonExporter(null, map);
var mapFolder = System.IO.Path.Combine(outputPath, mapName);
System.IO.Directory.CreateDirectory(mapFolder);
var jsonPath = System.IO.Path.Combine(mapFolder, $"{mapName}.json");
exporter.ExportJsonOnly(jsonPath, mapName);
Console.WriteLine($"✓ Exported map data to: {jsonPath}");
}
catch (Exception ex)
{
Console.WriteLine($"Error during export: {ex.Message}");
Console.WriteLine($"Stack trace: {ex.StackTrace}");
}
}