Add files via upload

This commit is contained in:
2025-03-24 12:56:43 +01:00
committed by GitHub
commit ada830f4e1
52 changed files with 29040 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
namespace FileReadAndWrite.Service;
public class FileService
{
private readonly string _filePath;
public FileService()
{
// Plik, który będzie przechowywał zawartość naszej aplikacji
_filePath = Path.Combine(FileSystem.AppDataDirectory, "data.txt");
}
public async Task SaveToFile(){
}
public async Task<string> LoadAsset(string asset){
// Odwołując się do pliku Resources/Raw/AboutAssets.txt mamy kod do ładowania danych z pliku w Assets
try{
using var stream = await FileSystem.OpenAppPackageFileAsync(asset);
using var reader = new StreamReader(stream);
return await reader.ReadToEndAsync();
} catch(Exception e){
return $"Error: {e.Message}";
}
}
}