コード例 #1
0
ファイル: FileFormatter.cs プロジェクト: Guzzter/GBUtils
        public static string Format(string filePath, FilePathFormat format)
        {
            if (filePath.IsBlank())
            {
                return string.Empty;
            }

            return Format(new FileInfo(filePath), format);
        }
コード例 #2
0
        public static string Format(string filePath, FilePathFormat format)
        {
            if (filePath.IsBlank())
            {
                return("");
            }

            return(Format(new FileInfo(filePath), format));
        }
コード例 #3
0
ファイル: FileFormatter.cs プロジェクト: Guzzter/GBUtils
 public static string Format(this FileInfo filePath, FilePathFormat format)
 {
     switch (format)
     {
         case FilePathFormat.Full:
             return filePath.FullName;
         case FilePathFormat.Short:
             return filePath.Name;
         case FilePathFormat.ShortFileFullDir:
             return string.Format("{0} ({1})", filePath.Name, filePath.DirectoryName);
         case FilePathFormat.Ellipsis:
             return string.Format(@"{1}...{0}{2}{0}{3}", Path.DirectorySeparatorChar, filePath.Directory.Root.Name, filePath.Directory.Name, filePath.Name);
         default:
             return filePath.DirectoryName;
     }
 }
コード例 #4
0
        public static string Format(this FileInfo filePath, FilePathFormat format)
        {
            switch (format)
            {
            case FilePathFormat.Full:
                return(filePath.FullName);

            case FilePathFormat.Short:
                return(filePath.Name);

            case FilePathFormat.ShortFileFullDir:
                return(string.Format("{0} ({1})", filePath.Name, filePath.DirectoryName));

            case FilePathFormat.Ellipsis:
                return(string.Format(@"{1}...{0}{2}{0}{3}", Path.DirectorySeparatorChar, filePath.Directory.Root.Name, filePath.Directory.Name, filePath.Name));

            case FilePathFormat.FullDir:
                return(filePath.DirectoryName);

            default:
                throw new ArgumentOutOfRangeException("format");
            }
        }
コード例 #5
0
        public static string Format(string filePath, FilePathFormat format) {
            if (filePath.IsBlank())
                return "";

            return Format(new FileInfo(filePath), format);
        }