This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
+369
View File
@@ -0,0 +1,369 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.IO
{
/// <summary>Provides the base class for both <see cref="T:System.IO.FileInfo" /> and <see cref="T:System.IO.DirectoryInfo" /> objects.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x020001BD RID: 445
[ComVisible(true)]
[Serializable]
public abstract class FileSystemInfo : MarshalByRefObject, ISerializable
{
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileSystemInfo" /> class.</summary>
// Token: 0x060016D6 RID: 5846 RVA: 0x00058390 File Offset: 0x00056590
protected FileSystemInfo()
{
this.valid = false;
this.FullPath = null;
}
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileSystemInfo" /> class with serialized data.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
/// <exception cref="T:System.ArgumentNullException">The specified <see cref="T:System.Runtime.Serialization.SerializationInfo" /> is null.</exception>
// Token: 0x060016D7 RID: 5847 RVA: 0x000583A8 File Offset: 0x000565A8
protected FileSystemInfo(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
this.FullPath = info.GetString("FullPath");
this.OriginalPath = info.GetString("OriginalPath");
}
/// <summary>Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the file name and additional exception information.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
/// </PermissionSet>
// Token: 0x060016D8 RID: 5848 RVA: 0x000583E4 File Offset: 0x000565E4
[ComVisible(false)]
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("OriginalPath", this.OriginalPath, typeof(string));
info.AddValue("FullPath", this.FullPath, typeof(string));
}
/// <summary>Gets a value indicating whether the file or directory exists.</summary>
/// <returns>true if the file or directory exists; otherwise, false.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x17000407 RID: 1031
// (get) Token: 0x060016D9 RID: 5849
public abstract bool Exists { get; }
/// <summary>For files, gets the name of the file. For directories, gets the name of the last directory in the hierarchy if a hierarchy exists. Otherwise, the Name property gets the name of the directory.</summary>
/// <returns>A string that is the name of the parent directory, the name of the last directory in the hierarchy, or the name of a file, including the file name extension.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x17000408 RID: 1032
// (get) Token: 0x060016DA RID: 5850
public abstract string Name { get; }
/// <summary>Gets the full path of the directory or file.</summary>
/// <returns>A string containing the full path.</returns>
/// <exception cref="T:System.IO.PathTooLongException">The fully qualified path and file name is 260 or more characters.</exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000409 RID: 1033
// (get) Token: 0x060016DB RID: 5851 RVA: 0x00058428 File Offset: 0x00056628
public virtual string FullName
{
get
{
return this.FullPath;
}
}
/// <summary>Gets the string representing the extension part of the file.</summary>
/// <returns>A string containing the <see cref="T:System.IO.FileSystemInfo" /> extension.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x1700040A RID: 1034
// (get) Token: 0x060016DC RID: 5852 RVA: 0x00058430 File Offset: 0x00056630
public string Extension
{
get
{
return Path.GetExtension(this.Name);
}
}
/// <summary>Gets or sets the current directory or file.</summary>
/// <returns>
/// <see cref="T:System.IO.FileAttributes" /> of the current <see cref="T:System.IO.FileSystemInfo" />.</returns>
/// <exception cref="T:System.IO.FileNotFoundException">The specified file does not exist. </exception>
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <exception cref="T:System.ArgumentException">The caller attempts to set an invalid file attribute. </exception>
/// <exception cref="T:System.IO.IOException">
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700040B RID: 1035
// (get) Token: 0x060016DD RID: 5853 RVA: 0x00058440 File Offset: 0x00056640
// (set) Token: 0x060016DE RID: 5854 RVA: 0x00058454 File Offset: 0x00056654
public FileAttributes Attributes
{
get
{
this.Refresh(false);
return this.stat.Attributes;
}
set
{
MonoIOError monoIOError;
if (!MonoIO.SetFileAttributes(this.FullName, value, out monoIOError))
{
throw MonoIO.GetException(this.FullName, monoIOError);
}
this.Refresh(true);
}
}
/// <summary>Gets or sets the creation time of the current directory or file.</summary>
/// <returns>The creation date and time of the current <see cref="T:System.IO.FileSystemInfo" /> object.</returns>
/// <exception cref="T:System.IO.IOException">
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700040C RID: 1036
// (get) Token: 0x060016DF RID: 5855 RVA: 0x00058488 File Offset: 0x00056688
// (set) Token: 0x060016E0 RID: 5856 RVA: 0x000584A4 File Offset: 0x000566A4
public DateTime CreationTime
{
get
{
this.Refresh(false);
return DateTime.FromFileTime(this.stat.CreationTime);
}
set
{
long num = value.ToFileTime();
MonoIOError monoIOError;
if (!MonoIO.SetFileTime(this.FullName, num, -1L, -1L, out monoIOError))
{
throw MonoIO.GetException(this.FullName, monoIOError);
}
this.Refresh(true);
}
}
/// <summary>Gets or sets the creation time, in coordinated universal time (UTC), of the current directory or file.</summary>
/// <returns>The creation date and time in UTC format of the current <see cref="T:System.IO.FileSystemInfo" /> object.</returns>
/// <exception cref="T:System.IO.IOException">
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700040D RID: 1037
// (get) Token: 0x060016E1 RID: 5857 RVA: 0x000584E4 File Offset: 0x000566E4
// (set) Token: 0x060016E2 RID: 5858 RVA: 0x00058500 File Offset: 0x00056700
[ComVisible(false)]
public DateTime CreationTimeUtc
{
get
{
return this.CreationTime.ToUniversalTime();
}
set
{
this.CreationTime = value.ToLocalTime();
}
}
/// <summary>Gets or sets the time the current file or directory was last accessed.</summary>
/// <returns>The time that the current file or directory was last accessed.</returns>
/// <exception cref="T:System.IO.IOException">
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700040E RID: 1038
// (get) Token: 0x060016E3 RID: 5859 RVA: 0x00058510 File Offset: 0x00056710
// (set) Token: 0x060016E4 RID: 5860 RVA: 0x0005852C File Offset: 0x0005672C
public DateTime LastAccessTime
{
get
{
this.Refresh(false);
return DateTime.FromFileTime(this.stat.LastAccessTime);
}
set
{
long num = value.ToFileTime();
MonoIOError monoIOError;
if (!MonoIO.SetFileTime(this.FullName, -1L, num, -1L, out monoIOError))
{
throw MonoIO.GetException(this.FullName, monoIOError);
}
this.Refresh(true);
}
}
/// <summary>Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed.</summary>
/// <returns>The UTC time that the current file or directory was last accessed.</returns>
/// <exception cref="T:System.IO.IOException">
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700040F RID: 1039
// (get) Token: 0x060016E5 RID: 5861 RVA: 0x0005856C File Offset: 0x0005676C
// (set) Token: 0x060016E6 RID: 5862 RVA: 0x00058590 File Offset: 0x00056790
[ComVisible(false)]
public DateTime LastAccessTimeUtc
{
get
{
this.Refresh(false);
return this.LastAccessTime.ToUniversalTime();
}
set
{
this.LastAccessTime = value.ToLocalTime();
}
}
/// <summary>Gets or sets the time when the current file or directory was last written to.</summary>
/// <returns>The time the current file was last written.</returns>
/// <exception cref="T:System.IO.IOException">
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000410 RID: 1040
// (get) Token: 0x060016E7 RID: 5863 RVA: 0x000585A0 File Offset: 0x000567A0
// (set) Token: 0x060016E8 RID: 5864 RVA: 0x000585BC File Offset: 0x000567BC
public DateTime LastWriteTime
{
get
{
this.Refresh(false);
return DateTime.FromFileTime(this.stat.LastWriteTime);
}
set
{
long num = value.ToFileTime();
MonoIOError monoIOError;
if (!MonoIO.SetFileTime(this.FullName, -1L, -1L, num, out monoIOError))
{
throw MonoIO.GetException(this.FullName, monoIOError);
}
this.Refresh(true);
}
}
/// <summary>Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.</summary>
/// <returns>The UTC time when the current file was last written to.</returns>
/// <exception cref="T:System.IO.IOException">
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x17000411 RID: 1041
// (get) Token: 0x060016E9 RID: 5865 RVA: 0x000585FC File Offset: 0x000567FC
// (set) Token: 0x060016EA RID: 5866 RVA: 0x00058620 File Offset: 0x00056820
[ComVisible(false)]
public DateTime LastWriteTimeUtc
{
get
{
this.Refresh(false);
return this.LastWriteTime.ToUniversalTime();
}
set
{
this.LastWriteTime = value.ToLocalTime();
}
}
/// <summary>Deletes a file or directory.</summary>
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid; for example, it is on an unmapped drive. </exception>
/// <filterpriority>2</filterpriority>
// Token: 0x060016EB RID: 5867
public abstract void Delete();
/// <summary>Refreshes the state of the object.</summary>
/// <exception cref="T:System.IO.IOException">A device such as a disk drive is not ready. </exception>
/// <filterpriority>1</filterpriority>
// Token: 0x060016EC RID: 5868 RVA: 0x00058630 File Offset: 0x00056830
public void Refresh()
{
this.Refresh(true);
}
// Token: 0x060016ED RID: 5869 RVA: 0x0005863C File Offset: 0x0005683C
internal void Refresh(bool force)
{
if (this.valid && !force)
{
return;
}
MonoIOError monoIOError;
MonoIO.GetFileStat(this.FullName, out this.stat, out monoIOError);
this.valid = true;
this.InternalRefresh();
}
// Token: 0x060016EE RID: 5870 RVA: 0x0005867C File Offset: 0x0005687C
internal virtual void InternalRefresh()
{
}
// Token: 0x060016EF RID: 5871 RVA: 0x00058680 File Offset: 0x00056880
internal void CheckPath(string path)
{
if (path == null)
{
throw new ArgumentNullException("path");
}
if (path.Length == 0)
{
throw new ArgumentException("An empty file name is not valid.");
}
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
{
throw new ArgumentException("Illegal characters in path.");
}
}
/// <summary>Represents the fully qualified path of the directory or file.</summary>
/// <exception cref="T:System.IO.PathTooLongException">The fully qualified path is 260 or more characters.</exception>
// Token: 0x040006A9 RID: 1705
protected string FullPath;
/// <summary>The path originally specified by the user, whether relative or absolute.</summary>
// Token: 0x040006AA RID: 1706
protected string OriginalPath;
// Token: 0x040006AB RID: 1707
internal MonoIOStat stat;
// Token: 0x040006AC RID: 1708
internal bool valid;
}
}