The exception is thrown when direName.Length = 19, for example.
For testing purposes, changed
return startCounter > direName.Length + 3 ? path : $@"{direName.Substring(0, startCounter)}...\{fileName}";
to
return startCounter > direName.Length + 3 ? path : $@"{direName.Substring(0, startCounter - 3)}...\{fileName}";
and it seems to work fine.
Thank you!
The exception is thrown when direName.Length = 19, for example. For testing purposes, changed
return startCounter > direName.Length + 3 ? path : $@"{direName.Substring(0, startCounter)}...\{fileName}";
toreturn startCounter > direName.Length + 3 ? path : $@"{direName.Substring(0, startCounter - 3)}...\{fileName}";
and it seems to work fine. Thank you!