StitchATon2/Domain/Configuration.cs

50 lines
No EOL
1.3 KiB
C#

namespace StitchATon2.Domain;
public class Configuration
{
public required string AssetPath { get; init; }
public required string CachePath { get; init; }
public required int Columns { get; init; }
public required int Rows { get; init; }
public required int Width { get; init; }
public required int Height { get; init; }
public int FullWidth => Width * Columns;
public int FullHeight => Height * Rows;
public int BottomTileIndex => Height - 1;
public int RightTileIndex => Width - 1;
public int TileCount => Columns * Rows;
public static Configuration Default
{
get
{
var assetPath = Environment.GetEnvironmentVariable("ASSET_PATH_RO");
var cachePath = Path.Combine(Path.GetTempPath(), "d42df2a2-60ac-4dc3-a6b9-d4c04f2e08e6");
return new Configuration
{
AssetPath = assetPath!,
CachePath = cachePath,
Columns = 55,
Rows = 31,
Width = 720,
Height = 720,
};
}
}
public string GetAssetPath(string assetName)
{
return Path.Combine(AssetPath, assetName);
}
public string GetCachePath(string assetName)
{
return Path.Combine(CachePath, assetName);
}
}