4 using System.ComponentModel;
6 namespace SiliconStudio.Core.IO
11 [DataContract(
"UFile")]
20 : base(filePath,
false)
29 public UFile(
string name,
string extension)
30 : this(null, null, name, extension)
40 public UFile(
string directory,
string name,
string extension)
41 : this(null, directory, name, extension)
52 public UFile(
string drive,
string directory,
string name,
string extension)
53 : base(drive, directory, name, extension)
63 var span = DirectorySpan;
66 span.Length = NameSpan.Next - span.Start;
68 return span.IsValid ? FullPath.Substring(span) : null;
77 return NameSpan.IsValid ? FullPath.Substring(NameSpan) : null;
86 return ExtensionSpan.IsValid ? FullPath.Substring(ExtensionSpan) : null;
96 if (ExtensionSpan.IsValid)
98 span.Length = ExtensionSpan.Next - span.Start;
100 return span.IsValid ? FullPath.Substring(span) : null;
110 return (
UFile)base.MakeRelative(anchorDirectory);
120 if (path == null)
throw new ArgumentNullException(
"path");
125 if (path.Length > 0 && path.EndsWith(DirectorySeparatorChar, DirectorySeparatorCharAlt))
137 public static implicit
operator UFile(
string fullPath)
139 return fullPath != null ?
new UFile(fullPath) : null;
UFile(string filePath)
Initializes a new instance of the UFile class.
UFile(string name, string extension)
Initializes a new instance of the UPath class.
static new bool IsValid(string path)
Determines whether the specified path is a valid UFile
string GetFileExtension()
Gets the extension of the file. Can be null.
UFile(string drive, string directory, string name, string extension)
Initializes a new instance of the UPath class.
static bool IsValid(string path)
Determines whether the specified path is a valid UPath
Defines a normalized directory path. See UPath for details. This class cannot be inherited.
string GetFileName()
Gets the name of the file without its extension. Can be null.
Base class that describes a uniform path and provides method to manipulate them. Concrete class are U...
string GetFileNameWithExtension()
Gets the name of the file with its extension.
delegate object TypeConverter(object arg)
UFile(string directory, string name, string extension)
Initializes a new instance of the UPath class.
string GetDirectoryAndFileName()
Gets the file path (UPath.GetDirectory() + '/' + UFile.GetFileName()) without the extension or drive...
new UFile MakeRelative(UDirectory anchorDirectory)
Makes this instance relative to the specified anchor directory.
Defines a normalized file path. See UPath for details. This class cannot be inherited.