Exemple #1
0
 /// <summary>
 ///     Overloaded.
 ///     Gets the main file name from a path.
 ///     If you only expect one single extension, please call GetMainFileName(String) overload.
 /// </summary>
 /// <param name="path">File path.</param>
 /// <param name="maxExtensions">Maximum number of extensions to consider</param>
 /// <param name="validator">IFileExtValidator that determines what extensions are valid</param>
 /// <returns>File name component of the path, not including the extension.</returns>
 public static String GetMainFileName(String path, Int32 maxExtensions, IFileExtValidator validator)
 {
     return (new FileNameDescriptor(path, maxExtensions, validator)).FileName;
 }
Exemple #2
0
 /// <summary>
 ///     Overloaded.
 ///     Changes extension of a file to the specified one.
 /// </summary>
 /// <param name="path">File path.</param>
 /// <param name="newExt">New file extension.</param>
 /// <param name="maxExtensions">Maximum number of extensions to consider</param>
 /// <param name="validator">IFileExtValidator that determines what extensions are valid</param>
 /// <returns>New file path with changed extension.</returns>
 public static String ChangeExtension(String path, String newExt, Int32 maxExtensions,
     IFileExtValidator validator)
 {
     FileNameDescriptor fds = new FileNameDescriptor(path, maxExtensions, validator) {Extensions = newExt};
     return fds.ToString();
 }
Exemple #3
0
 /// <summary>
 ///     Gets descriptor for the specified path.
 /// </summary>
 /// <param name="path">File path.</param>
 /// <param name="maxExtensions">Maximum number of extensions to consider</param>
 /// <param name="validator">IFileExtValidator that determines what extensions are valid</param>
 /// <returns>FileNameDescriptor object for the specified path.</returns>
 public static FileNameDescriptor GetFileNameDescriptor(String path, Int32 maxExtensions,
     IFileExtValidator validator)
 {
     return new FileNameDescriptor(path, maxExtensions, validator);
 }