private static string GetFullPathAs(this string saveName, HiraFileType fileType) { var name = string.IsNullOrWhiteSpace(saveName) ? DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") : saveName; return(fileType.FolderPath + name + fileType.Extension); }
internal static void DeleteFile(this HiraFileType type, string fileName) { var path = fileName.GetFullPathAs(type); if (File.Exists(path)) { File.Delete(path); } }
internal static HiraFile <T> Get(string fileName, HiraFileType type) => new HiraFile <T>(fileName, type);
private HiraFile(string fileName, HiraFileType type) { _type = type; _fileName = fileName; }
internal static FileStream GetFileStreamAs(this string fileName, HiraFileType type) => File.Open(fileName.GetFullPathAs(type), FileMode.OpenOrCreate);