16 internal Win32Native.WIN32_FILE_ATTRIBUTE_DATA _data;
18 internal int _dataInitialised = -1;
20 private const int ERROR_INVALID_PARAMETER = 87;
22 internal const int ERROR_ACCESS_DENIED = 5;
31 private string _displayPath =
"";
39 [SecuritySafeCritical]
47 internal virtual string UnsafeGetFullName
70 return FullPath.Substring(num, length - num);
83 public abstract string Name 91 public abstract bool Exists 125 [SecuritySafeCritical]
128 if (_dataInitialised == -1)
130 _data =
default(Win32Native.WIN32_FILE_ATTRIBUTE_DATA);
133 if (_dataInitialised != 0)
135 __Error.WinIOError(_dataInitialised, DisplayPath);
137 long fileTime = (long)(((ulong)_data.ftCreationTimeHigh << 32) | _data.ftCreationTimeLow);
150 _dataInitialised = -1;
181 [SecuritySafeCritical]
184 if (_dataInitialised == -1)
186 _data =
default(Win32Native.WIN32_FILE_ATTRIBUTE_DATA);
189 if (_dataInitialised != 0)
191 __Error.WinIOError(_dataInitialised, DisplayPath);
193 long fileTime = (long)(((ulong)_data.ftLastAccessTimeHigh << 32) | _data.ftLastAccessTimeLow);
206 _dataInitialised = -1;
237 [SecuritySafeCritical]
240 if (_dataInitialised == -1)
242 _data =
default(Win32Native.WIN32_FILE_ATTRIBUTE_DATA);
245 if (_dataInitialised != 0)
247 __Error.WinIOError(_dataInitialised, DisplayPath);
249 long fileTime = (long)(((ulong)_data.ftLastWriteTimeHigh << 32) | _data.ftLastWriteTimeLow);
262 _dataInitialised = -1;
277 [SecuritySafeCritical]
280 if (_dataInitialised == -1)
282 _data =
default(Win32Native.WIN32_FILE_ATTRIBUTE_DATA);
285 if (_dataInitialised != 0)
287 __Error.WinIOError(_dataInitialised, DisplayPath);
291 [SecuritySafeCritical]
295 if (!Win32Native.SetFileAttributes(
FullPath, (
int)value))
298 switch (lastWin32Error)
305 __Error.WinIOError(lastWin32Error, DisplayPath);
307 _dataInitialised = -1;
311 internal string DisplayPath
319 _displayPath = value;
338 FullPath =
Path.GetFullPathInternal(info.GetString(
"FullPath"));
340 _dataInitialised = -1;
344 internal void InitializeFrom(Win32Native.WIN32_FIND_DATA findData)
346 _data =
default(Win32Native.WIN32_FILE_ATTRIBUTE_DATA);
347 _data.PopulateFrom(findData);
348 _dataInitialised = 0;
354 public abstract void Delete();
358 [SecuritySafeCritical]
361 _dataInitialised =
File.FillAttributeInfo(
FullPath, ref _data, tryagain:
false, returnErrorOnNotFound:
false);
372 info.AddValue(
"OriginalPath",
OriginalPath, typeof(
string));
373 info.AddValue(
"FullPath",
FullPath, typeof(
string));
abstract string Name
For files, gets the name of the file. For directories, gets the name of the last directory in the hie...
Exposes instance methods for creating, moving, and enumerating through directories and subdirectories...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
FileIOPermissionAccess
Specifies the type of file access requested.
abstract bool Exists
Gets a value indicating whether the file or directory exists.
DateTime CreationTime
Gets or sets the creation time of the current file or directory.
static unsafe void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)
Sets the date and time, in coordinated universal time (UTC), that the specified file was last written...
FileAttributes
Provides attributes for files and directories.
static readonly char AltDirectorySeparatorChar
Provides a platform-specific alternate character used to separate directory levels in a path string t...
Represents an instant in time, typically expressed as a date and time of day. To browse the ....
static readonly char DirectorySeparatorChar
Provides a platform-specific character used to separate directory levels in a path string that reflec...
Describes the source and destination of a given serialized stream, and provides an additional caller-...
static unsafe void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)
Sets the date and time, in Coordinated Universal Time (UTC) format, that the specified file or direct...
DateTime LastAccessTimeUtc
Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was la...
static DateTime FromFileTimeUtc(long fileTime)
Converts the specified Windows file time to an equivalent UTC time.
DateTime ToLocalTime()
Converts the value of the current T:System.DateTime object to local time.
FileSystemInfo()
Initializes a new instance of the T:System.IO.FileSystemInfo class.
DateTime LastAccessTime
Gets or sets the time the current file or directory was last accessed.
FileAttributes Attributes
Gets or sets the attributes for the current file or directory.
SecurityAction
Specifies the security actions that can be performed using declarative security.
DateTime CreationTimeUtc
Gets or sets the creation time, in coordinated universal time (UTC), of the current file or directory...
Provides information about, and means to manipulate, the current environment and platform....
static unsafe void SetCreationTimeUtc(string path, DateTime creationTimeUtc)
Sets the date and time, in coordinated universal time (UTC), that the file was created.
Exposes static methods for creating, moving, and enumerating through directories and subdirectories....
static unsafe void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)
Sets the date and time, in Coordinated Universal Time (UTC) format, that a directory was last written...
static unsafe void SetCreationTimeUtc(string path, DateTime creationTimeUtc)
Sets the creation date and time, in Coordinated Universal Time (UTC) format, for the specified file o...
Provides a collection of methods for allocating unmanaged memory, copying unmanaged memory blocks,...
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
DateTime LastWriteTime
Gets or sets the time when the current file or directory was last written to.
The exception that is thrown when one of the arguments provided to a method is not valid.
FileSystemInfo(SerializationInfo info, StreamingContext context)
Initializes a new instance of the T:System.IO.FileSystemInfo class with serialized data.
Allows an object to control its own serialization and deserialization.
void Refresh()
Refreshes the state of the object.
Specifies that the class can be serialized.
abstract void Delete()
Deletes a file or directory.
string Extension
Gets the string representing the extension part of the file.
DateTime LastWriteTimeUtc
Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was la...
Provides static methods for the creation, copying, deletion, moving, and opening of a single file,...
virtual string FullName
Gets the full path of the directory or file.
Controls the ability to access files and folders. This class cannot be inherited.
static int GetLastWin32Error()
Returns the error code returned by the last unmanaged function that was called using platform invoke ...
static unsafe void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)
Sets the date and time, in coordinated universal time (UTC), that the specified file was last accesse...
Provides the base class for both T:System.IO.FileInfo and T:System.IO.DirectoryInfo objects.
string FullPath
Represents the fully qualified path of the directory or file.
virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Sets the T:System.Runtime.Serialization.SerializationInfo object with the file name and additional ex...
Performs operations on T:System.String instances that contain file or directory path information....
static readonly char VolumeSeparatorChar
Provides a platform-specific volume separator character.
Enables access to objects across application domain boundaries in applications that support remoting.
string OriginalPath
The path originally specified by the user, whether relative or absolute.