You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@@ -58,9 +58,6 @@ namespace System.IO
|
||||
return false;
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
protected override Iterator<string> Clone()
|
||||
{
|
||||
// NOTE: To maintain the same behavior with the previous yield-based
|
||||
@@ -96,9 +93,6 @@ namespace System.IO
|
||||
return CreateIterator(path, encoding, (StreamReader)null);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
private static ReadLinesIterator CreateIterator(string path, Encoding encoding, StreamReader reader)
|
||||
{
|
||||
return new ReadLinesIterator(path, encoding, reader ?? new StreamReader(path, encoding));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// ==--==
|
||||
// <OWNER>[....]</OWNER>
|
||||
// <OWNER>kimhamil</OWNER>
|
||||
//
|
||||
|
||||
#if _DEBUG
|
||||
@@ -12,7 +12,7 @@
|
||||
// output for some good old-fashioned console spew in MSDEV's debug output window.
|
||||
|
||||
// <STRIP>This really shouldn't ship at all, but is intended as a quick, inefficient hack
|
||||
// for debugging. -- [....], 9/26/2000</STRIP>
|
||||
// for debugging. -- BrianGru, 9/26/2000</STRIP>
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
// Class: __HResults
|
||||
//
|
||||
// <OWNER>[....]</OWNER>
|
||||
// <OWNER>kimhamil</OWNER>
|
||||
//
|
||||
// Author: Automatically generated
|
||||
//
|
||||
|
||||
@@ -42,9 +42,6 @@ namespace System.IO {
|
||||
private bool m_isMemoryStream; // "do we sit on MemoryStream?" for Read/ReadInt32 perf
|
||||
private bool m_leaveOpen;
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public BinaryReader(Stream input) : this(input, new UTF8Encoding(), false) {
|
||||
}
|
||||
|
||||
@@ -133,9 +130,6 @@ namespace System.IO {
|
||||
return InternalReadOneChar();
|
||||
}
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public virtual bool ReadBoolean(){
|
||||
FillBuffer(1);
|
||||
return (m_buffer[0]!=0);
|
||||
@@ -152,9 +146,6 @@ namespace System.IO {
|
||||
}
|
||||
|
||||
[CLSCompliant(false)]
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public virtual sbyte ReadSByte() {
|
||||
FillBuffer(1);
|
||||
return (sbyte)(m_buffer[0]);
|
||||
@@ -168,9 +159,6 @@ namespace System.IO {
|
||||
return (char)value;
|
||||
}
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public virtual short ReadInt16() {
|
||||
FillBuffer(2);
|
||||
return (short)(m_buffer[0] | m_buffer[1] << 8);
|
||||
|
||||
@@ -64,9 +64,6 @@ namespace System.IO {
|
||||
_encoder = _encoding.GetEncoder();
|
||||
}
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public BinaryWriter(Stream output) : this(output, new UTF8Encoding(false, true), false)
|
||||
{
|
||||
}
|
||||
@@ -150,9 +147,6 @@ namespace System.IO {
|
||||
// Writes a byte to this stream. The current position of the stream is
|
||||
// advanced by one.
|
||||
//
|
||||
#if !FEATURE_CORECLR
|
||||
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
|
||||
#endif
|
||||
public virtual void Write(byte value)
|
||||
{
|
||||
OutStream.WriteByte(value);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -64,11 +64,7 @@ namespace System.IO {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public DirectoryInfo(String path)
|
||||
@@ -99,13 +95,13 @@ namespace System.IO {
|
||||
String fullPath = Path.GetFullPathInternal(path);
|
||||
|
||||
demandDir = new String[] {Directory.GetDemandDir(fullPath, true)};
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
if (checkHost)
|
||||
{
|
||||
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, OriginalPath, fullPath);
|
||||
state.EnsureState();
|
||||
}
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
new FileIOPermission(FileIOPermissionAccess.Read, demandDir, false, false ).Demand();
|
||||
#endif
|
||||
|
||||
@@ -116,11 +112,7 @@ namespace System.IO {
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
#if FEATURE_CORESYSTEM
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
#endif //FEATURE_CORESYSTEM
|
||||
internal DirectoryInfo(String fullPath, bool junk)
|
||||
{
|
||||
@@ -159,11 +151,7 @@ namespace System.IO {
|
||||
}
|
||||
|
||||
public DirectoryInfo Parent {
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
get {
|
||||
@@ -177,10 +165,10 @@ namespace System.IO {
|
||||
if (parentName==null)
|
||||
return null;
|
||||
DirectoryInfo dir = new DirectoryInfo(parentName,false);
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.PathDiscovery | FileSecurityStateAccess.Read, String.Empty, dir.demandDir[0]);
|
||||
state.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
new FileIOPermission(FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read, dir.demandDir, false, false).Demand();
|
||||
#endif
|
||||
return dir;
|
||||
@@ -191,11 +179,7 @@ namespace System.IO {
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
#if FEATURE_CORECLR
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
#endif
|
||||
public DirectoryInfo CreateSubdirectory(String path) {
|
||||
if (path == null)
|
||||
@@ -246,10 +230,10 @@ namespace System.IO {
|
||||
|
||||
// Ensure we have permission to create this subdirectory.
|
||||
String demandDirForCreation = Directory.GetDemandDir(fullPath, true);
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Write, OriginalPath, demandDirForCreation);
|
||||
state.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
new FileIOPermission(FileIOPermissionAccess.Write, new String[] { demandDirForCreation }, false, false).Demand();
|
||||
#endif
|
||||
|
||||
@@ -261,9 +245,6 @@ namespace System.IO {
|
||||
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
public void Create()
|
||||
{
|
||||
Directory.InternalCreateDirectory(FullPath, OriginalPath, null, true);
|
||||
@@ -330,9 +311,6 @@ namespace System.IO {
|
||||
// given search criteria (ie, "*.txt").
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[SecurityCritical]
|
||||
#endif
|
||||
public FileInfo[] GetFiles(String searchPattern)
|
||||
{
|
||||
if (searchPattern == null)
|
||||
@@ -359,9 +337,6 @@ namespace System.IO {
|
||||
|
||||
// Returns an array of Files in the current DirectoryInfo matching the
|
||||
// given search criteria (ie, "*.txt").
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
private FileInfo[] InternalGetFiles(String searchPattern, SearchOption searchOption)
|
||||
@@ -377,10 +352,6 @@ namespace System.IO {
|
||||
// Returns an array of Files in the DirectoryInfo specified by path
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[SecurityCritical]
|
||||
#endif
|
||||
|
||||
public FileInfo[] GetFiles()
|
||||
{
|
||||
return InternalGetFiles("*", SearchOption.TopDirectoryOnly);
|
||||
@@ -389,9 +360,6 @@ namespace System.IO {
|
||||
// Returns an array of Directories in the current directory.
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[SecurityCritical]
|
||||
#endif
|
||||
public DirectoryInfo[] GetDirectories()
|
||||
{
|
||||
return InternalGetDirectories("*", SearchOption.TopDirectoryOnly);
|
||||
@@ -401,9 +369,6 @@ namespace System.IO {
|
||||
// given search criteria (ie, "*.txt").
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[SecurityCritical]
|
||||
#endif
|
||||
public FileSystemInfo[] GetFileSystemInfos(String searchPattern)
|
||||
{
|
||||
if (searchPattern == null)
|
||||
@@ -430,9 +395,6 @@ namespace System.IO {
|
||||
|
||||
// Returns an array of strongly typed FileSystemInfo entries in the path with the
|
||||
// given search criteria (ie, "*.txt").
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
private FileSystemInfo[] InternalGetFileSystemInfos(String searchPattern, SearchOption searchOption)
|
||||
@@ -449,9 +411,6 @@ namespace System.IO {
|
||||
// of all the files and directories.
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[SecurityCritical]
|
||||
#endif
|
||||
public FileSystemInfo[] GetFileSystemInfos()
|
||||
{
|
||||
return InternalGetFileSystemInfos("*", SearchOption.TopDirectoryOnly);
|
||||
@@ -462,9 +421,6 @@ namespace System.IO {
|
||||
// directories).
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[SecurityCritical]
|
||||
#endif
|
||||
public DirectoryInfo[] GetDirectories(String searchPattern)
|
||||
{
|
||||
if (searchPattern == null)
|
||||
@@ -493,9 +449,6 @@ namespace System.IO {
|
||||
// Returns an array of Directories in the current DirectoryInfo matching the
|
||||
// given search criteria (ie, "System*" could match the System & System32
|
||||
// directories).
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
private DirectoryInfo[] InternalGetDirectories(String searchPattern, SearchOption searchOption)
|
||||
@@ -508,9 +461,6 @@ namespace System.IO {
|
||||
return fileList.ToArray();
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public IEnumerable<DirectoryInfo> EnumerateDirectories()
|
||||
@@ -518,9 +468,6 @@ namespace System.IO {
|
||||
return InternalEnumerateDirectories("*", SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public IEnumerable<DirectoryInfo> EnumerateDirectories(String searchPattern)
|
||||
@@ -532,9 +479,6 @@ namespace System.IO {
|
||||
return InternalEnumerateDirectories(searchPattern, SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public IEnumerable<DirectoryInfo> EnumerateDirectories(String searchPattern, SearchOption searchOption)
|
||||
@@ -548,9 +492,6 @@ namespace System.IO {
|
||||
return InternalEnumerateDirectories(searchPattern, searchOption);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
private IEnumerable<DirectoryInfo> InternalEnumerateDirectories(String searchPattern, SearchOption searchOption)
|
||||
@@ -561,9 +502,6 @@ namespace System.IO {
|
||||
return FileSystemEnumerableFactory.CreateDirectoryInfoIterator(FullPath, OriginalPath, searchPattern, searchOption);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public IEnumerable<FileInfo> EnumerateFiles()
|
||||
@@ -571,9 +509,6 @@ namespace System.IO {
|
||||
return InternalEnumerateFiles("*", SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public IEnumerable<FileInfo> EnumerateFiles(String searchPattern)
|
||||
@@ -585,9 +520,6 @@ namespace System.IO {
|
||||
return InternalEnumerateFiles(searchPattern, SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public IEnumerable<FileInfo> EnumerateFiles(String searchPattern, SearchOption searchOption)
|
||||
@@ -601,9 +533,6 @@ namespace System.IO {
|
||||
return InternalEnumerateFiles(searchPattern, searchOption);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
private IEnumerable<FileInfo> InternalEnumerateFiles(String searchPattern, SearchOption searchOption)
|
||||
@@ -614,9 +543,6 @@ namespace System.IO {
|
||||
return FileSystemEnumerableFactory.CreateFileInfoIterator(FullPath, OriginalPath, searchPattern, searchOption);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos()
|
||||
@@ -624,9 +550,6 @@ namespace System.IO {
|
||||
return InternalEnumerateFileSystemInfos("*", SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos(String searchPattern)
|
||||
@@ -638,9 +561,6 @@ namespace System.IO {
|
||||
return InternalEnumerateFileSystemInfos(searchPattern, SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos(String searchPattern, SearchOption searchOption)
|
||||
@@ -654,9 +574,6 @@ namespace System.IO {
|
||||
return InternalEnumerateFileSystemInfos(searchPattern, searchOption);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
private IEnumerable<FileSystemInfo> InternalEnumerateFileSystemInfos(String searchPattern, SearchOption searchOption)
|
||||
@@ -667,7 +584,6 @@ namespace System.IO {
|
||||
return FileSystemEnumerableFactory.CreateFileSystemInfoIterator(FullPath, OriginalPath, searchPattern, searchOption);
|
||||
}
|
||||
|
||||
#if !PLATFORM_UNIX
|
||||
// Returns the root portion of the given path. The resulting string
|
||||
// consists of those rightmost characters of the path that constitute the
|
||||
// root of the path. Possible patterns for the resulting string are: An
|
||||
@@ -677,22 +593,9 @@ namespace System.IO {
|
||||
// and "\\server\share" (a UNC path for a given server and share name).
|
||||
// The resulting string is null if path is null.
|
||||
//
|
||||
#else
|
||||
// Returns the root portion of the given path. The resulting string
|
||||
// consists of those rightmost characters of the path that constitute the
|
||||
// root of the path. Possible patterns for the resulting string are: An
|
||||
// empty string (a relative path on the current drive), "\" (an absolute
|
||||
// path on the current drive)
|
||||
// The resulting string is null if path is null.
|
||||
//
|
||||
#endif // !PLATFORM_UNIX
|
||||
|
||||
public DirectoryInfo Root {
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
|
||||
get
|
||||
@@ -702,21 +605,17 @@ namespace System.IO {
|
||||
String rootPath = FullPath.Substring(0, rootLength);
|
||||
demandPath = Directory.GetDemandDir(rootPath, true);
|
||||
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPath);
|
||||
sourceState.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new String[] { demandPath }, false, false).Demand();
|
||||
#endif
|
||||
return new DirectoryInfo(rootPath);
|
||||
}
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public void MoveTo(String destDirName) {
|
||||
@@ -726,10 +625,10 @@ namespace System.IO {
|
||||
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "destDirName");
|
||||
Contract.EndContractBlock();
|
||||
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Write | FileSecurityStateAccess.Read, DisplayPath, Directory.GetDemandDir(FullPath, true));
|
||||
sourceState.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, demandDir, false, false).Demand();
|
||||
#endif
|
||||
String fullDestDirName = Path.GetFullPathInternal(destDirName);
|
||||
@@ -745,10 +644,10 @@ namespace System.IO {
|
||||
// had the ability to read the file contents in the old location,
|
||||
// but you technically also need read permissions to the new
|
||||
// location as well, and write is not a true superset of read.
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState destState = new FileSecurityState(FileSecurityStateAccess.Write, destDirName, demandPath);
|
||||
destState.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, demandPath).Demand();
|
||||
#endif
|
||||
|
||||
@@ -790,11 +689,7 @@ namespace System.IO {
|
||||
_dataInitialised = -1;
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
|
||||
public override void Delete()
|
||||
@@ -802,11 +697,7 @@ namespace System.IO {
|
||||
Directory.Delete(FullPath, OriginalPath, false, true);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
|
||||
public void Delete(bool recursive)
|
||||
|
||||
181
external/referencesource/mscorlib/system/io/file.cs
vendored
181
external/referencesource/mscorlib/system/io/file.cs
vendored
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
||||
**
|
||||
** Enum: FileAccess
|
||||
**
|
||||
** <OWNER>[....]</OWNER>
|
||||
** <OWNER>kimhamil</OWNER>
|
||||
**
|
||||
**
|
||||
** Purpose: Enum describing whether you want read and/or write
|
||||
|
||||
@@ -37,8 +37,8 @@ namespace System.IO {
|
||||
Offline = 0x1000,
|
||||
NotContentIndexed = 0x2000,
|
||||
Encrypted = 0x4000,
|
||||
|
||||
#if !FEATURE_NETCORE
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
#if FEATURE_COMINTEROP
|
||||
[System.Runtime.InteropServices.ComVisible(false)]
|
||||
#endif // FEATURE_COMINTEROP
|
||||
|
||||
@@ -63,11 +63,7 @@ namespace System.IO {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public FileInfo(String fileName)
|
||||
@@ -104,14 +100,14 @@ namespace System.IO {
|
||||
OriginalPath = fileName;
|
||||
// Must fully qualify the path for the security check
|
||||
String fullPath = Path.GetFullPathInternal(fileName);
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
if (checkHost)
|
||||
{
|
||||
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, fileName, fullPath);
|
||||
state.EnsureState();
|
||||
}
|
||||
#elif !FEATURE_CORECLR
|
||||
new FileIOPermission(FileIOPermissionAccess.Read, new String[] { fullPath }, false, false).Demand();
|
||||
#else
|
||||
FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, fullPath, false, false);
|
||||
#endif
|
||||
|
||||
_name = Path.GetFileName(fileName);
|
||||
@@ -140,11 +136,7 @@ namespace System.IO {
|
||||
}
|
||||
|
||||
#if FEATURE_CORESYSTEM
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
#endif //FEATURE_CORESYSTEM
|
||||
internal FileInfo(String fullPath, bool ignoreThis)
|
||||
{
|
||||
@@ -179,20 +171,16 @@ namespace System.IO {
|
||||
/* Returns the name of the directory that the file is in */
|
||||
public String DirectoryName
|
||||
{
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
get
|
||||
{
|
||||
String directoryName = Path.GetDirectoryName(FullPath);
|
||||
if (directoryName != null)
|
||||
{
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, DisplayPath, FullPath);
|
||||
state.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new String[] { directoryName }, false, false).Demand();
|
||||
#endif
|
||||
}
|
||||
@@ -203,9 +191,6 @@ namespace System.IO {
|
||||
/* Creates an instance of the the parent directory */
|
||||
public DirectoryInfo Directory
|
||||
{
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
get
|
||||
@@ -260,9 +245,6 @@ namespace System.IO {
|
||||
return new StreamReader(FullPath, Encoding.UTF8, true, StreamReader.DefaultBufferSize, false);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public StreamWriter CreateText()
|
||||
@@ -270,9 +252,6 @@ namespace System.IO {
|
||||
return new StreamWriter(FullPath,false);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public StreamWriter AppendText()
|
||||
@@ -290,9 +269,6 @@ namespace System.IO {
|
||||
// Read permission to sourceFileName
|
||||
// and Write permissions to destFileName.
|
||||
//
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public FileInfo CopyTo(String destFileName) {
|
||||
@@ -316,9 +292,6 @@ namespace System.IO {
|
||||
// Read permission to sourceFileName and Create
|
||||
// and Write permissions to destFileName.
|
||||
//
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public FileInfo CopyTo(String destFileName, bool overwrite) {
|
||||
@@ -332,9 +305,6 @@ namespace System.IO {
|
||||
return new FileInfo(destFileName, false);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
|
||||
public FileStream Create() {
|
||||
@@ -351,19 +321,15 @@ namespace System.IO {
|
||||
//
|
||||
// Your application must have Delete permission to the target file.
|
||||
//
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
|
||||
public override void Delete()
|
||||
{
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Write, DisplayPath, FullPath);
|
||||
state.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
// For security check, path should be resolved to an absolute path.
|
||||
new FileIOPermission(FileIOPermissionAccess.Write, new String[] { FullPath }, false, false).Demand();
|
||||
#endif
|
||||
@@ -424,27 +390,18 @@ namespace System.IO {
|
||||
|
||||
|
||||
// User must explicitly specify opening a new file or appending to one.
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public FileStream Open(FileMode mode) {
|
||||
return Open(mode, FileAccess.ReadWrite, FileShare.None);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public FileStream Open(FileMode mode, FileAccess access) {
|
||||
return Open(mode, access, FileShare.None);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public FileStream Open(FileMode mode, FileAccess access, FileShare share) {
|
||||
@@ -464,9 +421,6 @@ namespace System.IO {
|
||||
}
|
||||
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public FileStream OpenWrite() {
|
||||
@@ -487,11 +441,7 @@ namespace System.IO {
|
||||
// sourceFileName and Write
|
||||
// permissions to destFileName.
|
||||
//
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
[ResourceExposure(ResourceScope.Machine)]
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
public void MoveTo(String destFileName) {
|
||||
@@ -502,14 +452,14 @@ namespace System.IO {
|
||||
Contract.EndContractBlock();
|
||||
|
||||
String fullDestFileName = Path.GetFullPathInternal(destFileName);
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Write | FileSecurityStateAccess.Read, DisplayPath, FullPath);
|
||||
FileSecurityState destState = new FileSecurityState(FileSecurityStateAccess.Write, destFileName, fullDestFileName);
|
||||
sourceState.EnsureState();
|
||||
destState.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, new String[] { FullPath }, false, false).Demand();
|
||||
new FileIOPermission(FileIOPermissionAccess.Write, new String[] { fullDestFileName }, false, false).Demand();
|
||||
FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, fullDestFileName, false, false);
|
||||
#endif
|
||||
|
||||
if (!Win32Native.MoveFile(FullPath, fullDestFileName))
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
**
|
||||
** Enum: FileMode
|
||||
**
|
||||
** <OWNER>[....]</OWNER>
|
||||
** <OWNER>kimhamil</OWNER>
|
||||
**
|
||||
**
|
||||
** Purpose: Enum describing whether to create a new file or
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
**
|
||||
** Enum: FileShare
|
||||
**
|
||||
** <OWNER>[....]</OWNER>
|
||||
** <OWNER>kimhamil</OWNER>
|
||||
**
|
||||
**
|
||||
** Purpose: Enum describing how to share files with other
|
||||
|
||||
@@ -1 +1 @@
|
||||
a544fe200fe45fedd62b532b479394f2ad18719b
|
||||
38b86735241ea07f3ab33268fed4980d92d915dd
|
||||
@@ -37,9 +37,6 @@ namespace System.IO
|
||||
// additional required permission demands.
|
||||
internal static class FileSystemEnumerableFactory
|
||||
{
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
internal static IEnumerable<String> CreateFileNameIterator(String path, String originalUserPath, String searchPattern,
|
||||
bool includeFiles, bool includeDirs, SearchOption searchOption, bool checkHost)
|
||||
{
|
||||
@@ -51,9 +48,6 @@ namespace System.IO
|
||||
return new FileSystemEnumerableIterator<String>(path, originalUserPath, searchPattern, searchOption, handler, checkHost);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
internal static IEnumerable<FileInfo> CreateFileInfoIterator(String path, String originalUserPath, String searchPattern, SearchOption searchOption)
|
||||
{
|
||||
Contract.Requires(path != null);
|
||||
@@ -64,9 +58,6 @@ namespace System.IO
|
||||
return new FileSystemEnumerableIterator<FileInfo>(path, originalUserPath, searchPattern, searchOption, handler, true);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
internal static IEnumerable<DirectoryInfo> CreateDirectoryInfoIterator(String path, String originalUserPath, String searchPattern, SearchOption searchOption)
|
||||
{
|
||||
|
||||
@@ -78,9 +69,6 @@ namespace System.IO
|
||||
return new FileSystemEnumerableIterator<DirectoryInfo>(path, originalUserPath, searchPattern, searchOption, handler, true);
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
internal static IEnumerable<FileSystemInfo> CreateFileSystemInfoIterator(String path, String originalUserPath, String searchPattern, SearchOption searchOption)
|
||||
{
|
||||
Contract.Requires(path != null);
|
||||
@@ -201,11 +189,7 @@ namespace System.IO
|
||||
private int oldMode;
|
||||
private bool _checkHost;
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
internal FileSystemEnumerableIterator(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler<TSource> resultHandler, bool checkHost)
|
||||
{
|
||||
Contract.Requires(path != null);
|
||||
@@ -241,7 +225,7 @@ namespace System.IO
|
||||
// Do a demand on the combined path so that we can fail early in case of deny
|
||||
demandPaths[1] = Directory.GetDemandDir(normalizedSearchPath, true);
|
||||
_checkHost = checkHost;
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
if (checkHost)
|
||||
{
|
||||
FileSecurityState state1 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[0]);
|
||||
@@ -249,7 +233,7 @@ namespace System.IO
|
||||
FileSecurityState state2 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[1]);
|
||||
state2.EnsureState();
|
||||
}
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand();
|
||||
#endif
|
||||
|
||||
@@ -325,11 +309,7 @@ namespace System.IO
|
||||
}
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
private FileSystemEnumerableIterator(String fullPath, String normalizedSearchPath, String searchCriteria, String userPath, SearchOption searchOption, SearchResultHandler<TSource> resultHandler, bool checkHost)
|
||||
{
|
||||
this.fullPath = fullPath;
|
||||
@@ -351,7 +331,7 @@ namespace System.IO
|
||||
// For filters like foo\*.cs we need to verify if the directory foo is not denied access.
|
||||
// Do a demand on the combined path so that we can fail early in case of deny
|
||||
demandPaths[1] = Directory.GetDemandDir(normalizedSearchPath, true);
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
if (checkHost)
|
||||
{
|
||||
FileSecurityState state1 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[0]);
|
||||
@@ -359,7 +339,7 @@ namespace System.IO
|
||||
FileSecurityState state2 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[1]);
|
||||
state2.EnsureState();
|
||||
}
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand();
|
||||
#endif
|
||||
searchData = new Directory.SearchData(normalizedSearchPath, userPath, searchOption);
|
||||
@@ -371,9 +351,6 @@ namespace System.IO
|
||||
}
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
protected override Iterator<TSource> Clone()
|
||||
{
|
||||
return new FileSystemEnumerableIterator<TSource>(fullPath, normalizedSearchPath, searchCriteria, userPath, searchOption, _resultHandler, _checkHost);
|
||||
@@ -606,13 +583,13 @@ namespace System.IO
|
||||
[System.Security.SecurityCritical]
|
||||
internal void DoDemand(String fullPathToDemand)
|
||||
{
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
if(_checkHost) {
|
||||
String demandDir = Directory.GetDemandDir(fullPathToDemand, true);
|
||||
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandDir);
|
||||
state.EnsureState();
|
||||
}
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
String demandDir = Directory.GetDemandDir(fullPathToDemand, true);
|
||||
String[] demandPaths = new String[] { demandDir };
|
||||
new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand();
|
||||
@@ -725,10 +702,10 @@ namespace System.IO
|
||||
internal override FileInfo CreateObject(SearchResult result)
|
||||
{
|
||||
String name = result.FullPath;
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, name);
|
||||
state.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
String[] names = new String[] { name };
|
||||
new FileIOPermission(FileIOPermissionAccess.Read, names, false, false).Demand();
|
||||
#endif
|
||||
@@ -752,10 +729,10 @@ namespace System.IO
|
||||
String name = result.FullPath;
|
||||
String permissionName = name + "\\.";
|
||||
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, permissionName);
|
||||
state.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
String[] permissionNames = new String[] { permissionName };
|
||||
new FileIOPermission(FileIOPermissionAccess.Read, permissionNames, false, false).Demand();
|
||||
#endif
|
||||
@@ -789,10 +766,10 @@ namespace System.IO
|
||||
String name = result.FullPath;
|
||||
String permissionName = name + "\\.";
|
||||
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, permissionName);
|
||||
state.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
String[] permissionNames = new String[] { permissionName };
|
||||
new FileIOPermission(FileIOPermissionAccess.Read, permissionNames, false, false).Demand();
|
||||
#endif
|
||||
@@ -805,10 +782,10 @@ namespace System.IO
|
||||
Contract.Assert(isFile);
|
||||
String name = result.FullPath;
|
||||
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, name);
|
||||
state.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
String[] names = new String[] { name };
|
||||
new FileIOPermission(FileIOPermissionAccess.Read, names, false, false).Demand();
|
||||
#endif
|
||||
|
||||
@@ -89,11 +89,7 @@ namespace System.IO {
|
||||
|
||||
// Full path of the direcory/file
|
||||
public virtual String FullName {
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
get
|
||||
{
|
||||
String demandDir;
|
||||
@@ -101,10 +97,10 @@ namespace System.IO {
|
||||
demandDir = Directory.GetDemandDir(FullPath, true);
|
||||
else
|
||||
demandDir = FullPath;
|
||||
#if FEATURE_CORECLR && !FEATURE_LEGACYNETCFIOSECURITY
|
||||
#if FEATURE_CORECLR
|
||||
FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandDir);
|
||||
sourceState.EnsureState();
|
||||
#elif !FEATURE_CORECLR
|
||||
#else
|
||||
new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandDir).Demand();
|
||||
#endif
|
||||
return FullPath;
|
||||
@@ -158,24 +154,15 @@ namespace System.IO {
|
||||
}
|
||||
|
||||
// Delete a file/directory
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
public abstract void Delete();
|
||||
|
||||
public DateTime CreationTime
|
||||
{
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
get {
|
||||
// depends on the security check in get_CreationTimeUtc
|
||||
return CreationTimeUtc.ToLocalTime();
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
set {
|
||||
CreationTimeUtc = value.ToUniversalTime();
|
||||
}
|
||||
@@ -183,18 +170,12 @@ namespace System.IO {
|
||||
|
||||
[ComVisible(false)]
|
||||
public DateTime CreationTimeUtc {
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
get {
|
||||
#if FEATURE_CORECLR
|
||||
#if !FEATURE_LEGACYNETCFIOSECURITY
|
||||
// get_CreationTime also depends on this security check
|
||||
FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, FullPath);
|
||||
sourceState.EnsureState();
|
||||
#endif //!FEATURE_LEGACYNETCFIOSECURITY
|
||||
#endif
|
||||
if (_dataInitialised == -1) {
|
||||
_data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA();
|
||||
@@ -223,16 +204,10 @@ namespace System.IO {
|
||||
|
||||
public DateTime LastAccessTime
|
||||
{
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
get {
|
||||
// depends on the security check in get_LastAccessTimeUtc
|
||||
return LastAccessTimeUtc.ToLocalTime();
|
||||
}
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
set {
|
||||
LastAccessTimeUtc = value.ToUniversalTime();
|
||||
}
|
||||
@@ -240,18 +215,12 @@ namespace System.IO {
|
||||
|
||||
[ComVisible(false)]
|
||||
public DateTime LastAccessTimeUtc {
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
get {
|
||||
#if FEATURE_CORECLR
|
||||
#if !FEATURE_LEGACYNETCFIOSECURITY
|
||||
// get_LastAccessTime also depends on this security check
|
||||
FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, FullPath);
|
||||
sourceState.EnsureState();
|
||||
#endif //!FEATURE_LEGACYNETCFIOSECURITY
|
||||
#endif
|
||||
if (_dataInitialised == -1) {
|
||||
_data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA();
|
||||
@@ -279,17 +248,11 @@ namespace System.IO {
|
||||
|
||||
public DateTime LastWriteTime
|
||||
{
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
get {
|
||||
// depends on the security check in get_LastWriteTimeUtc
|
||||
return LastWriteTimeUtc.ToLocalTime();
|
||||
}
|
||||
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
set {
|
||||
LastWriteTimeUtc = value.ToUniversalTime();
|
||||
}
|
||||
@@ -297,18 +260,12 @@ namespace System.IO {
|
||||
|
||||
[ComVisible(false)]
|
||||
public DateTime LastWriteTimeUtc {
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
get {
|
||||
#if FEATURE_CORECLR
|
||||
#if !FEATURE_LEGACYNETCFIOSECURITY
|
||||
// get_LastWriteTime also depends on this security check
|
||||
FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, FullPath);
|
||||
sourceState.EnsureState();
|
||||
#endif //!FEATURE_LEGACYNETCFIOSECURITY
|
||||
#endif
|
||||
if (_dataInitialised == -1) {
|
||||
_data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA();
|
||||
@@ -343,18 +300,12 @@ namespace System.IO {
|
||||
}
|
||||
|
||||
public FileAttributes Attributes {
|
||||
#if FEATURE_LEGACYNETCFIOSECURITY
|
||||
[System.Security.SecurityCritical]
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical]
|
||||
#endif //FEATURE_LEGACYNETCFIOSECURITY
|
||||
get
|
||||
{
|
||||
#if FEATURE_CORECLR
|
||||
#if !FEATURE_LEGACYNETCFIOSECURITY
|
||||
FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, FullPath);
|
||||
sourceState.EnsureState();
|
||||
#endif //!FEATURE_LEGACYNETCFIOSECURITY
|
||||
#endif
|
||||
if (_dataInitialised == -1) {
|
||||
_data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA();
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* Class: __HResults
|
||||
//
|
||||
// <OWNER>[....]</OWNER>
|
||||
// <OWNER>kimhamil</OWNER>
|
||||
*
|
||||
* <EMAIL>Author: Sh----n Dasan</EMAIL>
|
||||
* <EMAIL>Author: Shajan Dasan</EMAIL>
|
||||
*
|
||||
* Purpose: The HRESULTS used by IsolatedStorage
|
||||
*
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* Class: INormalizeForIsolatedStorage
|
||||
//
|
||||
// <OWNER>[....]</OWNER>
|
||||
// <OWNER>kimhamil</OWNER>
|
||||
*
|
||||
* <EMAIL>Author: Sh----n Dasan</EMAIL>
|
||||
* <EMAIL>Author: Shajan Dasan</EMAIL>
|
||||
*
|
||||
* Purpose: Evidence types can optionaly implement this interface.
|
||||
* IsolatedStorage calls Normalize method before evidence
|
||||
|
||||
@@ -200,12 +200,7 @@ namespace System.IO.IsolatedStorage {
|
||||
|
||||
private String GetNameFromID(String typeID, String instanceID)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(typeID);
|
||||
sb.Append(SeparatorInternal);
|
||||
sb.Append(instanceID);
|
||||
|
||||
return sb.ToString();
|
||||
return typeID + SeparatorInternal + instanceID;
|
||||
}
|
||||
|
||||
private static String GetPredefinedTypeName(Object o)
|
||||
|
||||
@@ -482,11 +482,9 @@ namespace System.IO {
|
||||
|
||||
int lengthRoot = LongPath.GetRootLength(fullPath);
|
||||
|
||||
#if !PLATFORM_UNIX
|
||||
// For UNC paths that are only // or ///
|
||||
if (length == 2 && Path.IsDirectorySeparator(fullPath[1]))
|
||||
throw new IOException(Environment.GetResourceString("IO.IO_CannotCreateDirectory", path));
|
||||
#endif // !PLATFORM_UNIX
|
||||
|
||||
List<string> stackDir = new List<string>();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user