55 lines
1.5 KiB
C#
55 lines
1.5 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 required int ImageCacheCapacity { get; init; }
|
||
|
|
public required int IntegralCacheCapacity { get; init; }
|
||
|
|
|
||
|
|
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,
|
||
|
|
ImageCacheCapacity = 5,
|
||
|
|
IntegralCacheCapacity = 10,
|
||
|
|
};
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public string GetAssetPath(string assetName)
|
||
|
|
{
|
||
|
|
return Path.Combine(AssetPath, assetName);
|
||
|
|
}
|
||
|
|
|
||
|
|
public string GetCachePath(string assetName)
|
||
|
|
{
|
||
|
|
return Path.Combine(CachePath, assetName);
|
||
|
|
}
|
||
|
|
}
|