using Harmonia.Core.Models; namespace Harmonia.Core.Data; public class PlaylistRepository : JsonFileRepository { protected override string DirectoryName => string.Empty; protected override string GetNewFileName() { for (int i = 0; i < 1000; i++) { string shortFileName = $"Playlist{i.ToString().PadLeft(3, '0')}.{Extension}"; string filePath = Path.Combine(DirectoryName, shortFileName); if (File.Exists(filePath) == false) return shortFileName; } throw new Exception("Unable to determine new fileName"); } }