Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ MoveTo() [2/2]

void System.IO.FileInfo.MoveTo ( string destFileName,
bool overwrite )
inline

Definition at line 145 of file FileInfo.cs.

146 {
147 if (destFileName == null)
148 {
149 throw new ArgumentNullException("destFileName");
150 }
151 if (destFileName.Length == 0)
152 {
153 throw new ArgumentException(SR.Argument_EmptyFileName, "destFileName");
154 }
155 string fullPath = Path.GetFullPath(destFileName);
156 if (!new DirectoryInfo(Path.GetDirectoryName(FullName)).Exists)
157 {
158 throw new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, FullName));
159 }
160 if (!Exists)
161 {
162 throw new FileNotFoundException(SR.Format(SR.IO_FileNotFound_FileName, FullName), FullName);
163 }
164 FileSystem.MoveFile(FullPath, fullPath, overwrite);
165 FullPath = fullPath;
166 OriginalPath = destFileName;
167 _name = Path.GetFileName(fullPath);
168 Invalidate();
169 }

References System.IO.FileSystemInfo._name, System.SR.Argument_EmptyFileName, System.IO.FileSystemInfo.Exists, System.SR.Format(), System.IO.FileSystemInfo.FullName, System.IO.FileSystemInfo.FullPath, System.IO.Path.GetDirectoryName(), System.IO.Path.GetFileName(), System.IO.Path.GetFullPath(), System.IO.FileSystemInfo.Invalidate(), System.SR.IO_FileNotFound_FileName, System.SR.IO_PathNotFound_Path, System.IO.FileSystem.MoveFile(), and System.IO.FileSystemInfo.OriginalPath.