12345678910111213141516171819202122232425262728293031323334 |
- using Avalonia;
- using System.IO;
- using System.Reflection;
- using System.Threading.Tasks;
- using VeloeAvaloniaKemonoPartyApp.Services;
- namespace VeloeAvaloniaKemonoPartyApp.Desktop.Services
- {
- public class DesktopStorageService : IStorageService
- {
- private string _cacheFolder;
- public DesktopStorageService()
- {
- _cacheFolder = Directory.GetParent(Assembly.GetEntryAssembly().Location) + "/cache/";
- if (!Directory.Exists(_cacheFolder))
- Directory.CreateDirectory(_cacheFolder);
- }
- public async Task<string?> GetCacheFolderAsync()
- {
- return await Task.FromResult<string?>(_cacheFolder);
- }
- }
- public static class DesktopStorageServiceAppBuilderExtentions
- {
- public static AppBuilder InitStorageService(this AppBuilder appBuilder)
- {
- RegisteredServices.StorageService = new DesktopStorageService();
- return appBuilder;
- }
- }
- }
|