BudgetAnalyser.Engine.Widgets.CurrentFileWidget.ShortenFileName C# (CSharp) Метод

ShortenFileName() приватный статический Метод

private static ShortenFileName ( [ fileName ) : string
fileName [
Результат string
        private static string ShortenFileName([NotNull] string fileName)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException(nameof(fileName));
            }

            if (fileName.Length < 30)
            {
                return fileName;
            }

            var proposed = Path.GetFileName(fileName);
            var drive = Path.GetPathRoot(fileName);
            if (proposed.Length < 30)
            {
                return drive + "...\\" + proposed;
            }

            return drive + "...\\" + proposed.Substring(proposed.Length - 30);
        }
    }