working with links

This commit is contained in:
2023-05-12 12:38:13 -04:00
parent 77e6ed78fd
commit 16f4dc9a76
15 changed files with 64 additions and 78 deletions

View File

@ -13,7 +13,7 @@
CheckFile(defaultFileName);
}
public string Get(string? noteName)
public string GetText(string? noteName)
{
CheckFile(noteName);
@ -22,10 +22,12 @@
public ICollection<string> GetNoteNames()
{
return Directory.GetFiles(filePath);
return Directory.GetFiles(filePath)
.Select(f => Path.GetFileName(f))
.ToList();
}
public void Save(string content, string? noteName)
public void SaveText(string content, string? noteName)
{
File.WriteAllText(GetFilePath(noteName), content);
}
@ -37,7 +39,7 @@
// ensure initialized
if (!File.Exists(filePath))
{
Save("Hi! Feel free to start typing. Everything will be saved soon after you are done typing.", noteName);
SaveText("Hi! Feel free to start typing. Everything will be saved soon after you are done typing.", noteName);
}
}

View File

@ -3,7 +3,7 @@
public interface INoteService
{
ICollection<string> GetNoteNames();
string Get(string? noteName);
void Save(string content, string? noteName);
string GetText(string? noteName);
void SaveText(string content, string? noteName);
}
}