using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.IO
{
/// Exposes static methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
/// 1
// Token: 0x020001AA RID: 426
[ComVisible(true)]
public static class Directory
{
/// Creates all directories and subdirectories as specified by .
/// A as specified by .
/// The directory path to create.
/// The directory specified by is a file.-or-The network name was not found.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .-or- is prefixed with, or contains only a colon character (:).
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The specified path is invalid (for example, it is on an unmapped drive).
///
/// contains a colon character (:) that is not part of a drive label ("C:\").
/// 1
///
///
///
// Token: 0x060015D8 RID: 5592 RVA: 0x00054120 File Offset: 0x00052320
public static DirectoryInfo CreateDirectory(string path)
{
if (path == null)
{
throw new ArgumentNullException("path");
}
if (path.Length == 0)
{
throw new ArgumentException("Path is empty");
}
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
{
throw new ArgumentException("Path contains invalid chars");
}
if (path.Trim().Length == 0)
{
throw new ArgumentException("Only blank characters in path");
}
if (File.Exists(path))
{
throw new IOException("Cannot create " + path + " because a file with the same name already exists.");
}
if (path == ":")
{
throw new ArgumentException("Only ':' In path");
}
return Directory.CreateDirectoriesInternal(path);
}
// Token: 0x060015D9 RID: 5593 RVA: 0x000541D0 File Offset: 0x000523D0
private static DirectoryInfo CreateDirectoriesInternal(string path)
{
DirectoryInfo directoryInfo = new DirectoryInfo(path, true);
if (directoryInfo.Parent != null && !directoryInfo.Parent.Exists)
{
directoryInfo.Parent.Create();
}
MonoIOError monoIOError;
if (!MonoIO.CreateDirectory(path, out monoIOError) && monoIOError != MonoIOError.ERROR_ALREADY_EXISTS && monoIOError != MonoIOError.ERROR_FILE_EXISTS)
{
throw MonoIO.GetException(path, monoIOError);
}
return directoryInfo;
}
/// Deletes an empty directory from a specified path.
/// The name of the empty directory to remove. This directory must be writable or empty.
/// A file with the same name and location specified by exists.-or-The directory is the application's current working directory.-or-The directory specified by is not empty.-or-The directory is read-only or contains a read-only file.-or-The directory is being used by another process..
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
///
/// does not exist or could not be found.-or- refers to a file instead of a directory.-or-The specified path is invalid (for example, it is on an unmapped drive).
/// 1
///
///
///
// Token: 0x060015DA RID: 5594 RVA: 0x00054234 File Offset: 0x00052434
public static void Delete(string path)
{
if (path == null)
{
throw new ArgumentNullException("path");
}
if (path.Length == 0)
{
throw new ArgumentException("Path is empty");
}
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
{
throw new ArgumentException("Path contains invalid chars");
}
if (path.Trim().Length == 0)
{
throw new ArgumentException("Only blank characters in path");
}
if (path == ":")
{
throw new NotSupportedException("Only ':' In path");
}
MonoIOError monoIOError;
bool flag;
if (MonoIO.ExistsSymlink(path, out monoIOError))
{
flag = MonoIO.DeleteFile(path, out monoIOError);
}
else
{
flag = MonoIO.RemoveDirectory(path, out monoIOError);
}
if (flag)
{
return;
}
if (monoIOError != MonoIOError.ERROR_FILE_NOT_FOUND)
{
throw MonoIO.GetException(path, monoIOError);
}
if (File.Exists(path))
{
throw new IOException("Directory does not exist, but a file of the same name exist.");
}
throw new DirectoryNotFoundException("Directory does not exist.");
}
// Token: 0x060015DB RID: 5595 RVA: 0x00054314 File Offset: 0x00052514
private static void RecursiveDelete(string path)
{
foreach (string text in Directory.GetDirectories(path))
{
MonoIOError monoIOError;
if (MonoIO.ExistsSymlink(text, out monoIOError))
{
MonoIO.DeleteFile(text, out monoIOError);
}
else
{
Directory.RecursiveDelete(text);
}
}
foreach (string text2 in Directory.GetFiles(path))
{
File.Delete(text2);
}
Directory.Delete(path);
}
/// Deletes an empty directory and, if indicated, any subdirectories and files in the directory.
/// The name of the directory to remove.
/// true to remove directories, subdirectories, and files in ; otherwise, false.
/// A file with the same name and location specified by exists.-or-The directory specified by is read-only, or is false and is not an empty directory. -or-The directory is the application's current working directory. -or-The directory contains a read-only file.-or-The directory is being used by another process.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
///
/// does not exist or could not be found.-or- refers to a file instead of a directory.-or-The specified path is invalid (for example, it is on an unmapped drive).
/// 1
///
///
///
// Token: 0x060015DC RID: 5596 RVA: 0x00054398 File Offset: 0x00052598
public static void Delete(string path, bool recursive)
{
Directory.CheckPathExceptions(path);
if (recursive)
{
Directory.RecursiveDelete(path);
}
else
{
Directory.Delete(path);
}
}
/// Determines whether the given path refers to an existing directory on disk.
/// true if refers to an existing directory; otherwise, false.
/// The path to test.
/// 1
///
///
///
// Token: 0x060015DD RID: 5597 RVA: 0x000543B8 File Offset: 0x000525B8
public static bool Exists(string path)
{
MonoIOError monoIOError;
return path != null && MonoIO.ExistsDirectory(path, out monoIOError);
}
/// Returns the date and time the specified file or directory was last accessed.
/// A structure set to the date and time the specified file or directory was last accessed. This value is expressed in local time.
/// The file or directory for which to obtain access date and time information.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The parameter is in an invalid format.
/// 1
///
///
///
// Token: 0x060015DE RID: 5598 RVA: 0x000543D8 File Offset: 0x000525D8
public static DateTime GetLastAccessTime(string path)
{
return File.GetLastAccessTime(path);
}
/// Returns the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last accessed.
/// A structure set to the date and time the specified file or directory was last accessed. This value is expressed in UTC time.
/// The file or directory for which to obtain access date and time information.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The parameter is in an invalid format.
/// 1
///
///
///
// Token: 0x060015DF RID: 5599 RVA: 0x000543E0 File Offset: 0x000525E0
public static DateTime GetLastAccessTimeUtc(string path)
{
return Directory.GetLastAccessTime(path).ToUniversalTime();
}
/// Returns the date and time the specified file or directory was last written to.
/// A structure set to the date and time the specified file or directory was last written to. This value is expressed in local time.
/// The file or directory for which to obtain modification date and time information.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// 1
///
///
///
// Token: 0x060015E0 RID: 5600 RVA: 0x000543FC File Offset: 0x000525FC
public static DateTime GetLastWriteTime(string path)
{
return File.GetLastWriteTime(path);
}
/// Returns the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last written to.
/// A structure set to the date and time the specified file or directory was last written to. This value is expressed in UTC time.
/// The file or directory for which to obtain modification date and time information.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// 2
///
///
///
// Token: 0x060015E1 RID: 5601 RVA: 0x00054404 File Offset: 0x00052604
public static DateTime GetLastWriteTimeUtc(string path)
{
return Directory.GetLastWriteTime(path).ToUniversalTime();
}
/// Gets the creation date and time of a directory.
/// A structure set to the creation date and time for the specified directory. This value is expressed in local time.
/// The path of the directory.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// 1
///
///
///
// Token: 0x060015E2 RID: 5602 RVA: 0x00054420 File Offset: 0x00052620
public static DateTime GetCreationTime(string path)
{
return File.GetCreationTime(path);
}
/// Gets the creation date and time, in Coordinated Universal Time (UTC) format, of a directory.
/// A structure set to the creation date and time for the specified directory. This value is expressed in UTC time.
/// The path of the directory.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// 2
///
///
///
// Token: 0x060015E3 RID: 5603 RVA: 0x00054428 File Offset: 0x00052628
public static DateTime GetCreationTimeUtc(string path)
{
return Directory.GetCreationTime(path).ToUniversalTime();
}
/// Gets the current working directory of the application.
/// A string that contains the path of the current working directory, and does not end with a backslash ("\").
/// The caller does not have the required permission.
/// The operating system is Windows CE, which does not have current directory functionality.This method is available in the .NET Compact Framework, but is not currently supported.
/// 1
///
///
///
// Token: 0x060015E4 RID: 5604 RVA: 0x00054444 File Offset: 0x00052644
public static string GetCurrentDirectory()
{
MonoIOError monoIOError;
string currentDirectory = MonoIO.GetCurrentDirectory(out monoIOError);
if (monoIOError != MonoIOError.ERROR_SUCCESS)
{
throw MonoIO.GetException(monoIOError);
}
return currentDirectory;
}
/// Gets the names of subdirectories in the specified directory.
/// An array of type String containing the names of subdirectories in .
/// The path for which an array of subdirectory names is returned.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
///
/// is a file name.
/// The specified path is invalid (for example, it is on an unmapped drive).
/// 1
///
///
///
// Token: 0x060015E5 RID: 5605 RVA: 0x00054468 File Offset: 0x00052668
public static string[] GetDirectories(string path)
{
return Directory.GetDirectories(path, "*");
}
/// Gets an array of directories matching the specified search pattern from the current directory.
/// A String array of directories matching the search pattern.
/// The path to search.
/// The search string to match against the names of files in . The parameter cannot end in two periods ("..") or contain two periods ("..") followed by or , nor can it contain any of the characters in .
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .-or- does not contain a valid pattern.
///
/// or is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
///
/// is a file name.
/// The specified path is invalid (for example, it is on an unmapped drive).
/// 1
///
///
///
// Token: 0x060015E6 RID: 5606 RVA: 0x00054478 File Offset: 0x00052678
public static string[] GetDirectories(string path, string searchPattern)
{
return Directory.GetFileSystemEntries(path, searchPattern, FileAttributes.Directory, FileAttributes.Directory);
}
/// Gets an array of directories matching the specified search pattern from the current directory, using a value to determine whether to search subdirectories.
/// A String array of directories matching the search pattern.
/// The path to search.
/// The search string to match against the names of files in . The parameter cannot end in two periods ("..") or contain two periods ("..") followed by or , nor can it contain any of the characters in .
/// One of the values that specifies whether the search operation should include all subdirectories or only the current directory.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .-or- does not contain a valid pattern.
///
/// or is null.
///
/// is not a valid value.
/// The caller does not have the required permission.
/// The specified path is invalid (for example, it is on an unmapped drive).
///
/// is a file name.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
// Token: 0x060015E7 RID: 5607 RVA: 0x00054488 File Offset: 0x00052688
public static string[] GetDirectories(string path, string searchPattern, SearchOption searchOption)
{
if (searchOption == SearchOption.TopDirectoryOnly)
{
return Directory.GetDirectories(path, searchPattern);
}
ArrayList arrayList = new ArrayList();
Directory.GetDirectoriesRecurse(path, searchPattern, arrayList);
return (string[])arrayList.ToArray(typeof(string));
}
// Token: 0x060015E8 RID: 5608 RVA: 0x000544C8 File Offset: 0x000526C8
private static void GetDirectoriesRecurse(string path, string searchPattern, ArrayList all)
{
all.AddRange(Directory.GetDirectories(path, searchPattern));
foreach (string text in Directory.GetDirectories(path))
{
Directory.GetDirectoriesRecurse(text, searchPattern, all);
}
}
/// Returns the volume information, root information, or both for the specified path.
/// A string containing the volume information, root information, or both for the specified path.
/// The path of a file or directory.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// 1
///
///
///
// Token: 0x060015E9 RID: 5609 RVA: 0x0005450C File Offset: 0x0005270C
public static string GetDirectoryRoot(string path)
{
return new string(Path.DirectorySeparatorChar, 1);
}
/// Returns the names of files (including their paths) in the specified directory.
/// A String array of file names in the specified directory. File names include the full path.
/// The directory from which to retrieve the files.
///
/// is a file name.-or-A network error has occurred.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The specified path is invalid (for example, it is on an unmapped drive).
/// 1
///
///
///
// Token: 0x060015EA RID: 5610 RVA: 0x0005451C File Offset: 0x0005271C
public static string[] GetFiles(string path)
{
return Directory.GetFiles(path, "*");
}
/// Returns the names of files (including their paths) in the specified directory that match the specified search pattern.
/// A String array containing the names of files in the specified directory that match the specified search pattern. File names include the full path.
/// The directory to search.
/// The search string to match against the names of files in . The parameter cannot end in two periods ("..") or contain two periods ("..") followed by or , nor can it contain any of the characters in .
///
/// is a file name.-or-A network error has occurred.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .-or- does not contain a valid pattern.
///
/// or is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The specified path is invalid (for example, it is on an unmapped drive).
/// 1
///
///
///
// Token: 0x060015EB RID: 5611 RVA: 0x0005452C File Offset: 0x0005272C
public static string[] GetFiles(string path, string searchPattern)
{
return Directory.GetFileSystemEntries(path, searchPattern, FileAttributes.Directory, (FileAttributes)0);
}
/// Returns the names of files (including their paths) in the specified directory that match the specified search pattern, using a value to determine whether to search subdirectories.
/// A String array containing the names of files in the specified directory that match the specified search pattern. File names include the full path.
/// The directory to search.
/// The search string to match against the names of files in . The parameter cannot end in two periods ("..") or contain two periods ("..") followed by or , nor can it contain any of the characters in .
/// One of the values that specifies whether the search operation should include all subdirectories or only the current directory.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by . -or- does not contain a valid pattern.
///
/// or is null.
///
/// is not a valid value.
/// The caller does not have the required permission.
/// The specified path is invalid (for example, it is on an unmapped drive).
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
///
/// is a file name.-or-A network error has occurred.
// Token: 0x060015EC RID: 5612 RVA: 0x00054538 File Offset: 0x00052738
public static string[] GetFiles(string path, string searchPattern, SearchOption searchOption)
{
if (searchOption == SearchOption.TopDirectoryOnly)
{
return Directory.GetFiles(path, searchPattern);
}
ArrayList arrayList = new ArrayList();
Directory.GetFilesRecurse(path, searchPattern, arrayList);
return (string[])arrayList.ToArray(typeof(string));
}
// Token: 0x060015ED RID: 5613 RVA: 0x00054578 File Offset: 0x00052778
private static void GetFilesRecurse(string path, string searchPattern, ArrayList all)
{
all.AddRange(Directory.GetFiles(path, searchPattern));
foreach (string text in Directory.GetDirectories(path))
{
Directory.GetFilesRecurse(text, searchPattern, all);
}
}
/// Returns the names of all files and subdirectories in the specified directory.
/// A String array containing the names of file system entries in the specified directory.
/// The directory for which file and subdirectory names are returned.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
///
/// is a file name.
/// The specified path is invalid (for example, it is on an unmapped drive).
/// 1
///
///
///
// Token: 0x060015EE RID: 5614 RVA: 0x000545BC File Offset: 0x000527BC
public static string[] GetFileSystemEntries(string path)
{
return Directory.GetFileSystemEntries(path, "*");
}
/// Returns an array of file system entries matching the specified search criteria.
/// A String array of file system entries matching the search criteria.
/// The path to be searched.
/// The search string to match against the names of files in . The parameter cannot end in two periods ("..") or contain two periods ("..") followed by or , nor can it contain any of the characters in .
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .-or- does not contain a valid pattern.
///
/// or is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
///
/// is a file name.
/// The specified path is invalid (for example, it is on an unmapped drive).
/// 1
///
///
///
// Token: 0x060015EF RID: 5615 RVA: 0x000545CC File Offset: 0x000527CC
public static string[] GetFileSystemEntries(string path, string searchPattern)
{
return Directory.GetFileSystemEntries(path, searchPattern, (FileAttributes)0, (FileAttributes)0);
}
/// Retrieves the names of the logical drives on this computer in the form "<drive letter>:\".
/// The logical drives on this computer.
/// An I/O error occured (for example, a disk error).
/// The caller does not have the required permission.
/// 1
///
///
///
// Token: 0x060015F0 RID: 5616 RVA: 0x000545D8 File Offset: 0x000527D8
public static string[] GetLogicalDrives()
{
return Environment.GetLogicalDrives();
}
// Token: 0x060015F1 RID: 5617 RVA: 0x000545E0 File Offset: 0x000527E0
private static bool IsRootDirectory(string path)
{
return (Path.DirectorySeparatorChar == '/' && path == "/") || (Path.DirectorySeparatorChar == '\\' && path.Length == 3 && path.EndsWith(":\\"));
}
/// Retrieves the parent directory of the specified path, including both absolute and relative paths.
/// The parent directory, or null if is the root directory, including the root of a UNC server or share name.
/// The path for which to retrieve the parent directory.
/// The directory specified by is read-only.
/// The caller does not have the required permission.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The specified path was not found.
/// 1
///
///
///
// Token: 0x060015F2 RID: 5618 RVA: 0x00054638 File Offset: 0x00052838
public static DirectoryInfo GetParent(string path)
{
if (path == null)
{
throw new ArgumentNullException("path");
}
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
{
throw new ArgumentException("Path contains invalid characters");
}
if (path.Length == 0)
{
throw new ArgumentException("The Path do not have a valid format");
}
if (Directory.IsRootDirectory(path))
{
return null;
}
string text = Path.GetDirectoryName(path);
if (text.Length == 0)
{
text = Directory.GetCurrentDirectory();
}
return new DirectoryInfo(text);
}
/// Moves a file or a directory and its contents to a new location.
/// The path of the file or directory to move.
/// The path to the new location for . If is a file, then must also be a file name.
/// An attempt was made to move a directory to a different volume. -or- already exists. -or- The and parameters refer to the same file or directory.
/// The caller does not have the required permission.
///
/// or is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// or is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The path specified by is invalid (for example, it is on an unmapped drive).
/// 1
///
///
///
// Token: 0x060015F3 RID: 5619 RVA: 0x000546B4 File Offset: 0x000528B4
public static void Move(string sourceDirName, string destDirName)
{
if (sourceDirName == null)
{
throw new ArgumentNullException("sourceDirName");
}
if (destDirName == null)
{
throw new ArgumentNullException("destDirName");
}
if (sourceDirName.Trim().Length == 0 || sourceDirName.IndexOfAny(Path.InvalidPathChars) != -1)
{
throw new ArgumentException("Invalid source directory name: " + sourceDirName, "sourceDirName");
}
if (destDirName.Trim().Length == 0 || destDirName.IndexOfAny(Path.InvalidPathChars) != -1)
{
throw new ArgumentException("Invalid target directory name: " + destDirName, "destDirName");
}
if (sourceDirName == destDirName)
{
throw new IOException("Source and destination path must be different.");
}
if (Directory.Exists(destDirName))
{
throw new IOException(destDirName + " already exists.");
}
if (!Directory.Exists(sourceDirName) && !File.Exists(sourceDirName))
{
throw new DirectoryNotFoundException(sourceDirName + " does not exist");
}
MonoIOError monoIOError;
if (!MonoIO.MoveFile(sourceDirName, destDirName, out monoIOError))
{
throw MonoIO.GetException(monoIOError);
}
}
/// Sets the creation date and time for the specified file or directory.
/// The file or directory for which to set the creation date and time information.
/// A containing the value to set for the creation date and time of . This value is expressed in local time.
/// The specified path was not found.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The caller does not have the required permission.
///
/// specifies a value outside the range of dates or times permitted for this operation.
/// The current operating system is not Microsoft Windows NT or later.
/// 1
///
///
///
// Token: 0x060015F4 RID: 5620 RVA: 0x000547C0 File Offset: 0x000529C0
public static void SetCreationTime(string path, DateTime creationTime)
{
File.SetCreationTime(path, creationTime);
}
/// Sets the creation date and time, in Coordinated Universal Time (UTC) format, for the specified file or directory.
/// The file or directory for which to set the creation date and time information.
/// A containing the value to set for the creation date and time of . This value is expressed in UTC time.
/// The specified path was not found.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The caller does not have the required permission.
///
/// specifies a value outside the range of dates or times permitted for this operation.
/// The current operating system is not Microsoft Windows NT or later.
/// 2
///
///
///
// Token: 0x060015F5 RID: 5621 RVA: 0x000547CC File Offset: 0x000529CC
public static void SetCreationTimeUtc(string path, DateTime creationTimeUtc)
{
Directory.SetCreationTime(path, creationTimeUtc.ToLocalTime());
}
/// Sets the application's current working directory to the specified directory.
/// The path to which the current working directory is set.
/// An IO error occurred.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The caller does not have the required permission to access unmanaged code.
/// The specified path was not found.
/// The specified directory was not found.
/// 1
///
///
///
// Token: 0x060015F6 RID: 5622 RVA: 0x000547DC File Offset: 0x000529DC
public static void SetCurrentDirectory(string path)
{
if (path == null)
{
throw new ArgumentNullException("path");
}
if (path.Trim().Length == 0)
{
throw new ArgumentException("path string must not be an empty string or whitespace string");
}
if (!Directory.Exists(path))
{
throw new DirectoryNotFoundException("Directory \"" + path + "\" not found.");
}
MonoIOError monoIOError;
MonoIO.SetCurrentDirectory(path, out monoIOError);
if (monoIOError != MonoIOError.ERROR_SUCCESS)
{
throw MonoIO.GetException(path, monoIOError);
}
}
/// Sets the date and time the specified file or directory was last accessed.
/// The file or directory for which to set the access date and time information.
/// A containing the value to set for the access date and time of . This value is expressed in local time.
/// The specified path was not found.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The caller does not have the required permission.
/// The current operating system is not Microsoft Windows NT or later.
///
/// specifies a value outside the range of dates or times permitted for this operation.
/// 1
///
///
///
// Token: 0x060015F7 RID: 5623 RVA: 0x00054850 File Offset: 0x00052A50
public static void SetLastAccessTime(string path, DateTime lastAccessTime)
{
File.SetLastAccessTime(path, lastAccessTime);
}
/// Sets the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last accessed.
/// The file or directory for which to set the access date and time information.
/// A containing the value to set for the access date and time of . This value is expressed in UTC time.
/// The specified path was not found.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The caller does not have the required permission.
/// The current operating system is not Microsoft Windows NT or later.
///
/// specifies a value outside the range of dates or times permitted for this operation.
/// 1
///
///
///
// Token: 0x060015F8 RID: 5624 RVA: 0x0005485C File Offset: 0x00052A5C
public static void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)
{
Directory.SetLastAccessTime(path, lastAccessTimeUtc.ToLocalTime());
}
/// Sets the date and time a directory was last written to.
/// The path of the directory.
/// The date and time the directory was last written to. This value is expressed in local time.
/// The specified path was not found.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The caller does not have the required permission.
/// The current operating system is not Microsoft Windows NT or later.
///
/// specifies a value outside the range of dates or times permitted for this operation.
/// 1
///
///
///
// Token: 0x060015F9 RID: 5625 RVA: 0x0005486C File Offset: 0x00052A6C
public static void SetLastWriteTime(string path, DateTime lastWriteTime)
{
File.SetLastWriteTime(path, lastWriteTime);
}
/// Sets the date and time, in Coordinated Universal Time (UTC) format, that a directory was last written to.
/// The path of the directory.
/// The date and time the directory was last written to. This value is expressed in UTC time.
/// The specified path was not found.
///
/// is a zero-length string, contains only white space, or contains one or more invalid characters as defined by .
///
/// is null.
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
/// The caller does not have the required permission.
/// The current operating system is not Microsoft Windows NT or later.
///
/// specifies a value outside the range of dates or times permitted for this operation.
/// 2
///
///
///
// Token: 0x060015FA RID: 5626 RVA: 0x00054878 File Offset: 0x00052A78
public static void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)
{
Directory.SetLastWriteTime(path, lastWriteTimeUtc.ToLocalTime());
}
// Token: 0x060015FB RID: 5627 RVA: 0x00054888 File Offset: 0x00052A88
private static void CheckPathExceptions(string path)
{
if (path == null)
{
throw new ArgumentNullException("path");
}
if (path.Length == 0)
{
throw new ArgumentException("Path is Empty");
}
if (path.Trim().Length == 0)
{
throw new ArgumentException("Only blank characters in path");
}
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
{
throw new ArgumentException("Path contains invalid chars");
}
}
// Token: 0x060015FC RID: 5628 RVA: 0x000548F4 File Offset: 0x00052AF4
private static string[] GetFileSystemEntries(string path, string searchPattern, FileAttributes mask, FileAttributes attrs)
{
if (path == null || searchPattern == null)
{
throw new ArgumentNullException();
}
if (searchPattern.Length == 0)
{
return new string[0];
}
if (path.Trim().Length == 0)
{
throw new ArgumentException("The Path does not have a valid format");
}
string text = Path.Combine(path, searchPattern);
string directoryName = Path.GetDirectoryName(text);
if (directoryName.IndexOfAny(Path.InvalidPathChars) != -1)
{
throw new ArgumentException("Path contains invalid characters");
}
MonoIOError monoIOError;
if (directoryName.IndexOfAny(Path.InvalidPathChars) != -1)
{
if (path.IndexOfAny(SearchPattern.InvalidChars) == -1)
{
throw new ArgumentException("Path contains invalid characters", "path");
}
throw new ArgumentException("Pattern contains invalid characters", "pattern");
}
else if (!MonoIO.ExistsDirectory(directoryName, out monoIOError))
{
MonoIOError monoIOError2;
if (monoIOError == MonoIOError.ERROR_SUCCESS && MonoIO.ExistsFile(directoryName, out monoIOError2))
{
return new string[] { directoryName };
}
if (monoIOError != MonoIOError.ERROR_PATH_NOT_FOUND)
{
throw MonoIO.GetException(directoryName, monoIOError);
}
if (directoryName.IndexOfAny(SearchPattern.WildcardChars) == -1)
{
throw new DirectoryNotFoundException("Directory '" + directoryName + "' not found.");
}
if (path.IndexOfAny(SearchPattern.WildcardChars) == -1)
{
throw new ArgumentException("Pattern is invalid", "searchPattern");
}
throw new ArgumentException("Path is invalid", "path");
}
else
{
string text2 = Path.Combine(directoryName, searchPattern);
string[] fileSystemEntries = MonoIO.GetFileSystemEntries(path, text2, (int)attrs, (int)mask, out monoIOError);
if (monoIOError != MonoIOError.ERROR_SUCCESS)
{
throw MonoIO.GetException(directoryName, monoIOError);
}
return fileSystemEntries;
}
}
}
}