From 6b4bffe5ec11336f2975d0b5cc2148e2f177c5ea Mon Sep 17 00:00:00 2001 From: DaPi Date: Tue, 18 Mar 2025 00:26:18 +0100 Subject: [PATCH] Format --- Jugenddienst Stunden/Models/Note.cs | 68 ++++++++++++++--------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/Jugenddienst Stunden/Models/Note.cs b/Jugenddienst Stunden/Models/Note.cs index 3f7fa70..6f58350 100644 --- a/Jugenddienst Stunden/Models/Note.cs +++ b/Jugenddienst Stunden/Models/Note.cs @@ -1,49 +1,49 @@ namespace Jugenddienst_Stunden.Models; internal class Note { - public string Filename { get; set; } - public string Text { get; set; } - public DateTime Date { get; set; } + public string Filename { get; set; } + public string Text { get; set; } + public DateTime Date { get; set; } - public void Save() => + public void Save() => File.WriteAllText(System.IO.Path.Combine(FileSystem.AppDataDirectory, Filename), Text); - public void Delete() => - File.Delete(System.IO.Path.Combine(FileSystem.AppDataDirectory, Filename)); + public void Delete() => + File.Delete(System.IO.Path.Combine(FileSystem.AppDataDirectory, Filename)); - public static Note Load(string filename) { - filename = System.IO.Path.Combine(FileSystem.AppDataDirectory, filename); + public static Note Load(string filename) { + filename = System.IO.Path.Combine(FileSystem.AppDataDirectory, filename); - if (!File.Exists(filename)) - throw new FileNotFoundException("Unable to find file on local storage.", filename); + if (!File.Exists(filename)) + throw new FileNotFoundException("Unable to find file on local storage.", filename); - return - new() { - Filename = Path.GetFileName(filename), - Text = File.ReadAllText(filename), - Date = File.GetLastWriteTime(filename) - }; - } + return + new() { + Filename = Path.GetFileName(filename), + Text = File.ReadAllText(filename), + Date = File.GetLastWriteTime(filename) + }; + } - public static IEnumerable LoadAll() { - // Get the folder where the notes are stored. - string appDataPath = FileSystem.AppDataDirectory; + public static IEnumerable LoadAll() { + // Get the folder where the notes are stored. + string appDataPath = FileSystem.AppDataDirectory; - // Use Linq extensions to load the *.notes.txt files. - return Directory + // Use Linq extensions to load the *.notes.txt files. + return Directory - // Select the file names from the directory - .EnumerateFiles(appDataPath, "*.notes.txt") + // Select the file names from the directory + .EnumerateFiles(appDataPath, "*.notes.txt") - // Each file name is used to load a note - .Select(filename => Note.Load(Path.GetFileName(filename))) + // Each file name is used to load a note + .Select(filename => Note.Load(Path.GetFileName(filename))) - // With the final collection of notes, order them by date - .OrderByDescending(note => note.Date); - } + // With the final collection of notes, order them by date + .OrderByDescending(note => note.Date); + } - public Note() { - Filename = $"{Path.GetRandomFileName()}.notes.txt"; - Date = DateTime.Now; - Text = ""; - } + public Note() { + Filename = $"{Path.GetRandomFileName()}.notes.txt"; + Date = DateTime.Now; + Text = ""; + } }