Created
October 3, 2023 08:46
-
-
Save PatrickRainer/160d6016619ee0a4282a19b586a55921 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FilePath | |
{ | |
public FilePath(string fullPath) | |
{ | |
FullPath = fullPath; | |
} | |
public string FullPath { get; } | |
public string FileName => Path.GetFileName(FullPath); | |
public string FileNameWithOutExtension => Path.GetFileNameWithoutExtension(FullPath); | |
public string Extension => Path.GetExtension(FullPath); | |
public override string ToString() | |
{ | |
if (FullPath.Length <= 11) return FullPath; | |
if (FullPath.Length == 0) return ""; | |
var fileName = Path.GetFileName(FullPath); | |
return @$"...\{fileName}"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment