FurinaImpact/FurinaImpact.Common/Data/Provider/LocalAssetProvider.cs
2023-12-09 06:45:08 +03:00

27 lines
881 B
C#

using System.Text.Json;
namespace FurinaImpact.Common.Data.Provider;
internal sealed class LocalAssetProvider : IAssetProvider
{
private const string ExcelDirectory = "assets/excel/";
private const string AvatarConfigDirectory = "assets/binout/avatar/";
public IEnumerable<string> EnumerateAvatarConfigFiles()
{
return Directory.GetFiles(AvatarConfigDirectory);
}
public JsonDocument GetFileAsJsonDocument(string fullPath)
{
using FileStream fileStream = new(fullPath, FileMode.Open, FileAccess.Read);
return JsonDocument.Parse(fileStream);
}
public JsonDocument GetExcelTableJson(string assetName)
{
string filePath = string.Concat(ExcelDirectory, assetName);
using FileStream fileStream = new(filePath, FileMode.Open, FileAccess.Read);
return JsonDocument.Parse(fileStream);
}
}