Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DirectoryInfo.cs
Go to the documentation of this file.
3
4namespace System.IO;
5
6public sealed class DirectoryInfo : FileSystemInfo
7{
8 private bool _isNormalized;
9
11 {
12 get
13 {
15 if (directoryName == null)
16 {
17 return null;
18 }
19 return new DirectoryInfo(directoryName, null, null, isNormalized: true);
20 }
21 }
22
24
25 public DirectoryInfo(string path)
26 {
27 Init(path, Path.GetFullPath(path), null, isNormalized: true);
28 }
29
30 internal DirectoryInfo(string originalPath, string fullPath = null, string fileName = null, bool isNormalized = false)
31 {
33 }
34
35 private void Init(string originalPath, string fullPath = null, string fileName = null, bool isNormalized = false)
36 {
37 OriginalPath = originalPath ?? throw new ArgumentNullException("originalPath");
43 }
44
46 {
47 if (path == null)
48 {
49 throw new ArgumentNullException("path");
50 }
52 {
53 throw new ArgumentException(SR.Argument_PathEmpty, "path");
54 }
56 {
57 throw new ArgumentException(SR.Arg_Path2IsRooted, "path");
58 }
62 if (span.StartsWith(value, PathInternal.StringComparison) && (span.Length == value.Length || PathInternal.IsDirectorySeparator(fullPath[value.Length])))
63 {
65 return new DirectoryInfo(fullPath);
66 }
68 }
69
70 public void Create()
71 {
73 Invalidate();
74 }
75
76 public FileInfo[] GetFiles()
77 {
79 }
80
85
90
95
100
105
110
115
120
125
130
135
140
145
150
155
160
165
170
175
180
185
190
195
211
212 public void MoveTo(string destDirName)
213 {
214 if (destDirName == null)
215 {
216 throw new ArgumentNullException("destDirName");
217 }
218 if (destDirName.Length == 0)
219 {
220 throw new ArgumentException(SR.Argument_EmptyFileName, "destDirName");
221 }
225 if (string.Equals(text2, text, PathInternal.StringComparison))
226 {
228 }
229 string pathRoot = Path.GetPathRoot(text2);
230 string pathRoot2 = Path.GetPathRoot(text);
231 if (!string.Equals(pathRoot, pathRoot2, PathInternal.StringComparison))
232 {
234 }
236 {
238 }
240 {
242 }
244 Init(destDirName, text, null, isNormalized: true);
245 Invalidate();
246 }
247
248 public override void Delete()
249 {
250 Delete(recursive: false);
251 }
252
253 public void Delete(bool recursive)
254 {
256 Invalidate();
257 }
258}
void Init(string originalPath, string fullPath=null, string fileName=null, bool isNormalized=false)
IEnumerable< FileInfo > EnumerateFiles(string searchPattern, SearchOption searchOption)
IEnumerable< FileInfo > EnumerateFiles()
DirectoryInfo[] GetDirectories()
DirectoryInfo[] GetDirectories(string searchPattern)
IEnumerable< FileSystemInfo > InternalEnumerateInfos(string path, string searchPattern, SearchTarget searchTarget, EnumerationOptions options)
IEnumerable< DirectoryInfo > EnumerateDirectories(string searchPattern)
IEnumerable< FileSystemInfo > EnumerateFileSystemInfos(string searchPattern, EnumerationOptions enumerationOptions)
IEnumerable< DirectoryInfo > EnumerateDirectories()
IEnumerable< DirectoryInfo > EnumerateDirectories(string searchPattern, SearchOption searchOption)
FileInfo[] GetFiles(string searchPattern, SearchOption searchOption)
IEnumerable< DirectoryInfo > EnumerateDirectories(string searchPattern, EnumerationOptions enumerationOptions)
IEnumerable< FileSystemInfo > EnumerateFileSystemInfos(string searchPattern, SearchOption searchOption)
FileSystemInfo[] GetFileSystemInfos(string searchPattern, SearchOption searchOption)
void Delete(bool recursive)
DirectoryInfo[] GetDirectories(string searchPattern, EnumerationOptions enumerationOptions)
FileInfo[] GetFiles(string searchPattern)
DirectoryInfo(string originalPath, string fullPath=null, string fileName=null, bool isNormalized=false)
FileInfo[] GetFiles(string searchPattern, EnumerationOptions enumerationOptions)
FileSystemInfo[] GetFileSystemInfos()
DirectoryInfo[] GetDirectories(string searchPattern, SearchOption searchOption)
IEnumerable< FileInfo > EnumerateFiles(string searchPattern, EnumerationOptions enumerationOptions)
IEnumerable< FileSystemInfo > EnumerateFileSystemInfos(string searchPattern)
IEnumerable< FileInfo > EnumerateFiles(string searchPattern)
FileSystemInfo[] GetFileSystemInfos(string searchPattern, EnumerationOptions enumerationOptions)
DirectoryInfo CreateSubdirectory(string path)
void MoveTo(string destDirName)
FileSystemInfo[] GetFileSystemInfos(string searchPattern)
IEnumerable< FileSystemInfo > EnumerateFileSystemInfos()
static EnumerationOptions FromSearchOption(SearchOption searchOption)
static EnumerationOptions Compatible
static IEnumerable< FileSystemInfo > FileSystemInfos(string directory, string expression, EnumerationOptions options, bool isNormalized)
static IEnumerable< DirectoryInfo > DirectoryInfos(string directory, string expression, EnumerationOptions options, bool isNormalized)
static IEnumerable< FileInfo > FileInfos(string directory, string expression, EnumerationOptions options, bool isNormalized)
static bool NormalizeInputs(ref string directory, ref string expression, MatchType matchType)
static bool DirectoryExists(string fullPath)
Definition FileSystem.cs:9
static unsafe void CreateDirectory(string fullPath, byte[] securityDescriptor=null)
Definition FileSystem.cs:91
static bool FileExists(string fullPath)
Definition FileSystem.cs:26
static void RemoveDirectory(string fullPath, bool recursive)
static void MoveDirectory(string sourceFullPath, string destFullPath)
static bool IsDirectorySeparator(char c)
static bool IsRoot(ReadOnlySpan< char > path)
static bool IsEffectivelyEmpty(ReadOnlySpan< char > path)
static StringComparison StringComparison
static string EnsureTrailingSeparator(string path)
static string Combine(string path1, string path2)
Definition Path.cs:304
static ? string GetFileName(string? path)
Definition Path.cs:200
static string GetFullPath(string path)
Definition Path.cs:881
static bool IsPathRooted([NotNullWhen(true)] string? path)
Definition Path.cs:985
static string TrimEndingDirectorySeparator(string path)
Definition Path.cs:838
static ? string GetPathRoot(string? path)
Definition Path.cs:1008
static ? string GetDirectoryName(string? path)
Definition Path.cs:121
static string IO_AlreadyExists_Name
Definition SR.cs:34
static string ArgumentOutOfRange_Enum
Definition SR.cs:18
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Arg_Path2IsRooted
Definition SR.cs:2198
static string IO_SourceDestMustBeDifferent
Definition SR.cs:2204
static string IO_SourceDestMustHaveSameRoot
Definition SR.cs:2206
static string Argument_PathEmpty
Definition SR.cs:840
static string Argument_EmptyFileName
Definition SR.cs:582
static string Argument_InvalidSubPath
Definition SR.cs:2202
static string IO_PathNotFound_Path
Definition SR.cs:44
Definition SR.cs:7