Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,372 @@
//
// System.IO.BinaryWriter
//
// Authors:
// Matt Kimball (matt@kimball.net)
// Marek Safar (marek.safar@gmail.com)
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
// Copyright 2011 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Text;
using System.Globalization;
using Mono.Security;
using System.Runtime.InteropServices;
namespace System.IO {
[Serializable]
[ComVisible (true)]
public class BinaryWriter : IDisposable {
// Null is a BinaryWriter with no backing store.
public static readonly BinaryWriter Null = new BinaryWriter ();
protected Stream OutStream;
private Encoding m_encoding;
private byte [] buffer;
byte [] stringBuffer;
int maxCharsPerRound;
bool disposed;
protected BinaryWriter() : this (Stream.Null, Encoding.UTF8UnmarkedUnsafe)
{
}
public BinaryWriter(Stream output) : this(output, Encoding.UTF8UnmarkedUnsafe)
{
}
#if NET_4_5
readonly bool leave_open;
public BinaryWriter(Stream output, Encoding encoding)
: this (output, encoding, false)
{
}
public BinaryWriter(Stream output, Encoding encoding, bool leaveOpen)
#else
const bool leave_open = false;
public BinaryWriter(Stream output, Encoding encoding)
#endif
{
if (output == null)
throw new ArgumentNullException("output");
if (encoding == null)
throw new ArgumentNullException("encoding");
if (!output.CanWrite)
throw new ArgumentException(Locale.GetText ("Stream does not support writing or already closed."));
#if NET_4_5
leave_open = leaveOpen;
#endif
OutStream = output;
m_encoding = encoding;
buffer = new byte [16];
}
public virtual Stream BaseStream {
get {
Flush ();
return OutStream;
}
}
public virtual void Close() {
Dispose (true);
}
#if NET_4_0
public void Dispose ()
#else
void IDisposable.Dispose()
#endif
{
Dispose (true);
}
protected virtual void Dispose (bool disposing)
{
if (disposing && OutStream != null && !leave_open)
OutStream.Close();
buffer = null;
m_encoding = null;
disposed = true;
}
public virtual void Flush() {
OutStream.Flush();
}
public virtual long Seek(int offset, SeekOrigin origin) {
return OutStream.Seek(offset, origin);
}
public virtual void Write(bool value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
buffer [0] = (byte) (value ? 1 : 0);
OutStream.Write(buffer, 0, 1);
}
public virtual void Write(byte value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
OutStream.WriteByte(value);
}
public virtual void Write(byte[] buffer) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
if (buffer == null)
throw new ArgumentNullException("buffer");
OutStream.Write(buffer, 0, buffer.Length);
}
public virtual void Write(byte[] buffer, int index, int count) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
if (buffer == null)
throw new ArgumentNullException("buffer");
OutStream.Write(buffer, index, count);
}
public virtual void Write(char ch) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
char[] dec = new char[1];
dec[0] = ch;
byte[] enc = m_encoding.GetBytes(dec, 0, 1);
OutStream.Write(enc, 0, enc.Length);
}
public virtual void Write(char[] chars) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
if (chars == null)
throw new ArgumentNullException("chars");
byte[] enc = m_encoding.GetBytes(chars, 0, chars.Length);
OutStream.Write(enc, 0, enc.Length);
}
public virtual void Write(char[] chars, int index, int count) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
if (chars == null)
throw new ArgumentNullException("chars");
byte[] enc = m_encoding.GetBytes(chars, index, count);
OutStream.Write(enc, 0, enc.Length);
}
unsafe public virtual void Write(decimal value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
byte* value_ptr = (byte *)&value;
/*
* decimal in stream is lo32, mi32, hi32, ss32
* but its internal structure si ss32, hi32, lo32, mi32
*/
if (BitConverter.IsLittleEndian) {
for (int i = 0; i < 16; i++) {
if (i < 4)
buffer [i + 12] = value_ptr [i];
else if (i < 8)
buffer [i + 4] = value_ptr [i];
else if (i < 12)
buffer [i - 8] = value_ptr [i];
else
buffer [i - 8] = value_ptr [i];
}
} else {
for (int i = 0; i < 16; i++) {
if (i < 4)
buffer [15 - i] = value_ptr [i];
else if (i < 8)
buffer [15 - i] = value_ptr [i];
else if (i < 12)
buffer [11 - i] = value_ptr [i];
else
buffer [19 - i] = value_ptr [i];
}
}
OutStream.Write(buffer, 0, 16);
}
public virtual void Write(double value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
OutStream.Write(BitConverterLE.GetBytes(value), 0, 8);
}
public virtual void Write(short value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
buffer [0] = (byte) value;
buffer [1] = (byte) (value >> 8);
OutStream.Write(buffer, 0, 2);
}
public virtual void Write(int value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
buffer [0] = (byte) value;
buffer [1] = (byte) (value >> 8);
buffer [2] = (byte) (value >> 16);
buffer [3] = (byte) (value >> 24);
OutStream.Write(buffer, 0, 4);
}
public virtual void Write(long value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
for (int i = 0, sh = 0; i < 8; i++, sh += 8)
buffer [i] = (byte) (value >> sh);
OutStream.Write(buffer, 0, 8);
}
[CLSCompliant(false)]
public virtual void Write(sbyte value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
buffer [0] = (byte) value;
OutStream.Write(buffer, 0, 1);
}
public virtual void Write(float value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
OutStream.Write(BitConverterLE.GetBytes(value), 0, 4);
}
public virtual void Write(string value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
int len = m_encoding.GetByteCount (value);
Write7BitEncodedInt (len);
if (stringBuffer == null) {
stringBuffer = new byte [512];
maxCharsPerRound = 512 / m_encoding.GetMaxByteCount (1);
}
int chpos = 0;
int chrem = value.Length;
while (chrem > 0) {
int cch = (chrem > maxCharsPerRound) ? maxCharsPerRound : chrem;
int blen = m_encoding.GetBytes (value, chpos, cch, stringBuffer, 0);
OutStream.Write (stringBuffer, 0, blen);
chpos += cch;
chrem -= cch;
}
}
[CLSCompliant(false)]
public virtual void Write(ushort value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
buffer [0] = (byte) value;
buffer [1] = (byte) (value >> 8);
OutStream.Write(buffer, 0, 2);
}
[CLSCompliant(false)]
public virtual void Write(uint value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
buffer [0] = (byte) value;
buffer [1] = (byte) (value >> 8);
buffer [2] = (byte) (value >> 16);
buffer [3] = (byte) (value >> 24);
OutStream.Write(buffer, 0, 4);
}
[CLSCompliant(false)]
public virtual void Write(ulong value) {
if (disposed)
throw new ObjectDisposedException ("BinaryWriter", "Cannot write to a closed BinaryWriter");
for (int i = 0, sh = 0; i < 8; i++, sh += 8)
buffer [i] = (byte) (value >> sh);
OutStream.Write(buffer, 0, 8);
}
protected void Write7BitEncodedInt(int value) {
do {
int high = (value >> 7) & 0x01ffffff;
byte b = (byte)(value & 0x7f);
if (high != 0) {
b = (byte)(b | 0x80);
}
Write(b);
value = high;
} while(value != 0);
}
}
}

View File

@@ -0,0 +1,323 @@
//
// System.IO.BufferedStream
//
// Author:
// Matt Kimball (matt@kimball.net)
// Ville Palo <vi64pa@kolumbus.fi>
//
// Copyright (C) 2004 Novell (http://www.novell.com)
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Globalization;
using System.Runtime.InteropServices;
namespace System.IO {
[ComVisible (true)]
public sealed class BufferedStream : Stream {
Stream m_stream;
byte[] m_buffer;
int m_buffer_pos;
int m_buffer_read_ahead;
bool m_buffer_reading;
private bool disposed = false;
public BufferedStream (Stream stream) : this (stream, 4096)
{
}
public BufferedStream (Stream stream, int bufferSize)
{
if (stream == null)
throw new ArgumentNullException ("stream");
// LAMESPEC: documented as < 0
if (bufferSize <= 0)
throw new ArgumentOutOfRangeException ("bufferSize", "<= 0");
if (!stream.CanRead && !stream.CanWrite) {
throw new ObjectDisposedException (
Locale.GetText ("Cannot access a closed Stream."));
}
m_stream = stream;
m_buffer = new byte [bufferSize];
}
public override bool CanRead {
get {
return m_stream.CanRead;
}
}
public override bool CanWrite {
get {
return m_stream.CanWrite;
}
}
public override bool CanSeek {
get {
return m_stream.CanSeek;
}
}
public override long Length {
get {
Flush ();
return m_stream.Length;
}
}
public override long Position {
get {
CheckObjectDisposedException ();
return m_stream.Position - m_buffer_read_ahead + m_buffer_pos;
}
set {
if (value < Position && (Position - value <= m_buffer_pos) && m_buffer_reading) {
m_buffer_pos -= (int) (Position - value);
}
else if (value > Position && (value - Position < m_buffer_read_ahead - m_buffer_pos) && m_buffer_reading) {
m_buffer_pos += (int) (value - Position);
}
else {
Flush();
m_stream.Position = value;
}
}
}
protected override void Dispose (bool disposing)
{
if (disposed)
return;
if (m_buffer != null)
Flush();
m_stream.Close();
m_buffer = null;
disposed = true;
}
public override void Flush ()
{
CheckObjectDisposedException ();
if (m_buffer_reading) {
if (CanSeek)
m_stream.Position = Position;
} else if (m_buffer_pos > 0) {
m_stream.Write(m_buffer, 0, m_buffer_pos);
}
m_buffer_read_ahead = 0;
m_buffer_pos = 0;
}
public override long Seek (long offset, SeekOrigin origin)
{
CheckObjectDisposedException ();
if (!CanSeek) {
throw new NotSupportedException (
Locale.GetText ("Non seekable stream."));
}
Flush ();
return m_stream.Seek (offset, origin);
}
public override void SetLength (long value)
{
CheckObjectDisposedException ();
if (value < 0)
throw new ArgumentOutOfRangeException ("value must be positive");
if (!m_stream.CanWrite && !m_stream.CanSeek)
throw new NotSupportedException ("the stream cannot seek nor write.");
if ((m_stream == null) || (!m_stream.CanRead && !m_stream.CanWrite))
throw new IOException ("the stream is not open");
m_stream.SetLength(value);
if (Position > value)
Position = value;
}
public override int ReadByte ()
{
CheckObjectDisposedException ();
if (!m_stream.CanRead) {
throw new NotSupportedException (
Locale.GetText ("Cannot read from stream"));
}
if (!m_buffer_reading) {
Flush ();
m_buffer_reading = true;
}
if (1 <= m_buffer_read_ahead - m_buffer_pos) {
return m_buffer [m_buffer_pos++];
}
else
{
if (m_buffer_pos >= m_buffer_read_ahead) {
m_buffer_pos = 0;
m_buffer_read_ahead = 0;
}
m_buffer_read_ahead = m_stream.Read (m_buffer, 0, m_buffer.Length);
if (1 <= m_buffer_read_ahead) {
return m_buffer [m_buffer_pos++];
} else {
return -1;
}
}
}
public override void WriteByte (byte value)
{
CheckObjectDisposedException ();
if (!m_stream.CanWrite) {
throw new NotSupportedException (
Locale.GetText ("Cannot write to stream"));
}
if (m_buffer_reading) {
Flush ();
m_buffer_reading = false;
}
else
// reordered to avoid possible integer overflow
if (m_buffer_pos >= m_buffer.Length - 1) {
Flush ();
}
m_buffer [m_buffer_pos++] = value;
}
public override int Read ([In,Out] byte[] array, int offset, int count)
{
if (array == null)
throw new ArgumentNullException ("array");
CheckObjectDisposedException ();
if (!m_stream.CanRead) {
throw new NotSupportedException (
Locale.GetText ("Cannot read from stream"));
}
if (offset < 0)
throw new ArgumentOutOfRangeException ("offset", "< 0");
if (count < 0)
throw new ArgumentOutOfRangeException ("count", "< 0");
// re-ordered to avoid possible integer overflow
if (array.Length - offset < count)
throw new ArgumentException ("array.Length - offset < count");
if (!m_buffer_reading) {
Flush();
m_buffer_reading = true;
}
if (count <= m_buffer_read_ahead - m_buffer_pos) {
Buffer.BlockCopyInternal (m_buffer, m_buffer_pos, array, offset, count);
m_buffer_pos += count;
if (m_buffer_pos == m_buffer_read_ahead) {
m_buffer_pos = 0;
m_buffer_read_ahead = 0;
}
return count;
}
int ret = m_buffer_read_ahead - m_buffer_pos;
Buffer.BlockCopyInternal (m_buffer, m_buffer_pos, array, offset, ret);
m_buffer_pos = 0;
m_buffer_read_ahead = 0;
offset += ret;
count -= ret;
if (count >= m_buffer.Length) {
ret += m_stream.Read (array, offset, count);
} else {
m_buffer_read_ahead = m_stream.Read (m_buffer, 0, m_buffer.Length);
if (count < m_buffer_read_ahead) {
Buffer.BlockCopyInternal (m_buffer, 0, array, offset, count);
m_buffer_pos = count;
ret += count;
} else {
Buffer.BlockCopyInternal (m_buffer, 0, array, offset, m_buffer_read_ahead);
ret += m_buffer_read_ahead;
m_buffer_read_ahead = 0;
}
}
return ret;
}
public override void Write (byte[] array, int offset, int count)
{
if (array == null)
throw new ArgumentNullException ("array");
CheckObjectDisposedException ();
if (!m_stream.CanWrite) {
throw new NotSupportedException (
Locale.GetText ("Cannot write to stream"));
}
if (offset < 0)
throw new ArgumentOutOfRangeException ("offset", "< 0");
if (count < 0)
throw new ArgumentOutOfRangeException ("count", "< 0");
// avoid possible integer overflow
if (array.Length - offset < count)
throw new ArgumentException ("array.Length - offset < count");
if (m_buffer_reading) {
Flush();
m_buffer_reading = false;
}
// reordered to avoid possible integer overflow
if (m_buffer_pos >= m_buffer.Length - count) {
Flush ();
m_stream.Write (array, offset, count);
}
else {
Buffer.BlockCopyInternal (array, offset, m_buffer, m_buffer_pos, count);
m_buffer_pos += count;
}
}
private void CheckObjectDisposedException ()
{
if (disposed) {
throw new ObjectDisposedException ("BufferedStream",
Locale.GetText ("Stream is closed"));
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,471 @@
//
// System.IO.DirectoryInfo.cs
//
// Authors:
// Miguel de Icaza, miguel@ximian.com
// Jim Richardson, develop@wtfo-guru.com
// Dan Lewis, dihlewis@yahoo.co.uk
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2002 Ximian, Inc.
// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
using System.Text;
using System.Security.AccessControl;
namespace System.IO {
[Serializable]
[ComVisible (true)]
public sealed class DirectoryInfo : FileSystemInfo {
private string current;
private string parent;
public DirectoryInfo (string path) : this (path, false)
{
}
internal DirectoryInfo (string path, bool simpleOriginalPath)
{
CheckPath (path);
SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
FullPath = Path.GetFullPath (path);
if (simpleOriginalPath)
OriginalPath = Path.GetFileName (path);
else
OriginalPath = path;
Initialize ();
}
private DirectoryInfo (SerializationInfo info, StreamingContext context)
: base (info, context)
{
Initialize ();
}
void Initialize ()
{
int len = FullPath.Length - 1;
if ((len > 1) && (FullPath [len] == Path.DirectorySeparatorChar))
len--;
int last = FullPath.LastIndexOf (Path.DirectorySeparatorChar, len);
if ((last == -1) || ((last == 0) && (len == 0))) {
current = FullPath;
parent = null;
} else {
current = FullPath.Substring (last + 1, len - last);
if (last == 0 && !Environment.IsRunningOnWindows)
parent = Path.DirectorySeparatorStr;
else
parent = FullPath.Substring (0, last);
// adjust for drives, i.e. a special case for windows
if (Environment.IsRunningOnWindows) {
if ((parent.Length == 2) && (parent [1] == ':') && Char.IsLetter (parent [0]))
parent += Path.DirectorySeparatorChar;
}
}
}
// properties
public override bool Exists {
get {
Refresh (false);
if (stat.Attributes == MonoIO.InvalidFileAttributes)
return false;
if ((stat.Attributes & FileAttributes.Directory) == 0)
return false;
return true;
}
}
public override string Name {
get { return current; }
}
public DirectoryInfo Parent {
get {
if ((parent == null) || (parent.Length == 0))
return null;
return new DirectoryInfo (parent);
}
}
public DirectoryInfo Root {
get {
string root = Path.GetPathRoot (FullPath);
if (root == null)
return null;
return new DirectoryInfo (root);
}
}
// creational methods
public void Create ()
{
Directory.CreateDirectory (FullPath);
}
public DirectoryInfo CreateSubdirectory (string path)
{
CheckPath (path);
path = Path.Combine (FullPath, path);
Directory.CreateDirectory (path);
return new DirectoryInfo (path);
}
// directory listing methods
public FileInfo [] GetFiles ()
{
return GetFiles ("*");
}
public FileInfo [] GetFiles (string searchPattern)
{
if (searchPattern == null)
throw new ArgumentNullException ("searchPattern");
string [] names = Directory.GetFiles (FullPath, searchPattern);
FileInfo[] infos = new FileInfo [names.Length];
int i = 0;
foreach (string name in names)
infos [i++] = new FileInfo (name);
return infos;
}
public DirectoryInfo [] GetDirectories ()
{
return GetDirectories ("*");
}
public DirectoryInfo [] GetDirectories (string searchPattern)
{
if (searchPattern == null)
throw new ArgumentNullException ("searchPattern");
string [] names = Directory.GetDirectories (FullPath, searchPattern);
DirectoryInfo[] infos = new DirectoryInfo [names.Length];
int i = 0;
foreach (string name in names)
infos [i++] = new DirectoryInfo (name);
return infos;
}
public FileSystemInfo [] GetFileSystemInfos ()
{
return GetFileSystemInfos ("*");
}
public FileSystemInfo [] GetFileSystemInfos (string searchPattern)
{
return GetFileSystemInfos (searchPattern, SearchOption.TopDirectoryOnly);
}
#if NET_4_0
public
#endif
FileSystemInfo [] GetFileSystemInfos (string searchPattern, SearchOption searchOption)
{
if (searchPattern == null)
throw new ArgumentNullException ("searchPattern");
if (searchOption != SearchOption.TopDirectoryOnly && searchOption != SearchOption.AllDirectories)
throw new ArgumentOutOfRangeException ("searchOption", "Must be TopDirectoryOnly or AllDirectories");
if (!Directory.Exists (FullPath))
throw new IOException ("Invalid directory");
List<FileSystemInfo> infos = new List<FileSystemInfo> ();
InternalGetFileSystemInfos (searchPattern, searchOption, infos);
return infos.ToArray ();
}
void InternalGetFileSystemInfos (string searchPattern, SearchOption searchOption, List<FileSystemInfo> infos)
{
// UnauthorizedAccessExceptions might happen here and break everything for SearchOption.AllDirectories
string [] dirs = Directory.GetDirectories (FullPath, searchPattern);
string [] files = Directory.GetFiles (FullPath, searchPattern);
Array.ForEach<string> (dirs, (dir) => { infos.Add (new DirectoryInfo (dir)); });
Array.ForEach<string> (files, (file) => { infos.Add (new FileInfo (file)); });
if (dirs.Length == 0 || searchOption == SearchOption.TopDirectoryOnly)
return;
foreach (string dir in dirs) {
DirectoryInfo dinfo = new DirectoryInfo (dir);
dinfo.InternalGetFileSystemInfos (searchPattern, searchOption, infos);
}
}
// directory management methods
public override void Delete ()
{
Delete (false);
}
public void Delete (bool recursive)
{
Directory.Delete (FullPath, recursive);
}
public void MoveTo (string destDirName)
{
if (destDirName == null)
throw new ArgumentNullException ("destDirName");
if (destDirName.Length == 0)
throw new ArgumentException ("An empty file name is not valid.", "destDirName");
Directory.Move (FullPath, Path.GetFullPath (destDirName));
FullPath = OriginalPath = destDirName;
Initialize ();
}
public override string ToString ()
{
return OriginalPath;
}
public DirectoryInfo[] GetDirectories (string searchPattern, SearchOption searchOption)
{
//NULL-check of searchPattern is done in Directory.GetDirectories
string [] names = Directory.GetDirectories (FullPath, searchPattern, searchOption);
//Convert the names to DirectoryInfo instances
DirectoryInfo[] infos = new DirectoryInfo [names.Length];
for (int i = 0; i<names.Length; ++i){
string name = names[i];
infos [i] = new DirectoryInfo (name);
}
return infos;
}
internal int GetFilesSubdirs (ArrayList l, string pattern)
{
int count;
FileInfo [] thisdir = null;
try {
thisdir = GetFiles (pattern);
} catch (System.UnauthorizedAccessException){
return 0;
}
count = thisdir.Length;
l.Add (thisdir);
foreach (DirectoryInfo subdir in GetDirectories ()){
count += subdir.GetFilesSubdirs (l, pattern);
}
return count;
}
public FileInfo[] GetFiles (string searchPattern, SearchOption searchOption)
{
switch (searchOption) {
case SearchOption.TopDirectoryOnly:
return GetFiles (searchPattern);
case SearchOption.AllDirectories: {
ArrayList groups = new ArrayList ();
int count = GetFilesSubdirs (groups, searchPattern);
int current = 0;
FileInfo [] all = new FileInfo [count];
foreach (FileInfo [] p in groups){
p.CopyTo (all, current);
current += p.Length;
}
return all;
}
default:
string msg = Locale.GetText ("Invalid enum value '{0}' for '{1}'.", searchOption, "SearchOption");
throw new ArgumentOutOfRangeException ("searchOption", msg);
}
}
// access control methods
[MonoLimitation ("DirectorySecurity isn't implemented")]
public void Create (DirectorySecurity directorySecurity)
{
if (directorySecurity != null)
throw new UnauthorizedAccessException ();
Create ();
}
[MonoLimitation ("DirectorySecurity isn't implemented")]
public DirectoryInfo CreateSubdirectory (string path, DirectorySecurity directorySecurity)
{
if (directorySecurity != null)
throw new UnauthorizedAccessException ();
return CreateSubdirectory (path);
}
public DirectorySecurity GetAccessControl ()
{
return Directory.GetAccessControl (FullPath);
}
public DirectorySecurity GetAccessControl (AccessControlSections includeSections)
{
return Directory.GetAccessControl (FullPath, includeSections);
}
public void SetAccessControl (DirectorySecurity directorySecurity)
{
Directory.SetAccessControl (FullPath, directorySecurity);
}
#if NET_4_0
public IEnumerable<DirectoryInfo> EnumerateDirectories ()
{
return EnumerateDirectories ("*", SearchOption.TopDirectoryOnly);
}
public IEnumerable<DirectoryInfo> EnumerateDirectories (string searchPattern)
{
return EnumerateDirectories (searchPattern, SearchOption.TopDirectoryOnly);
}
public IEnumerable<DirectoryInfo> EnumerateDirectories (string searchPattern, SearchOption searchOption)
{
if (searchPattern == null)
throw new ArgumentNullException ("searchPattern");
return CreateEnumerateDirectoriesIterator (searchPattern, searchOption);
}
IEnumerable<DirectoryInfo> CreateEnumerateDirectoriesIterator (string searchPattern, SearchOption searchOption)
{
foreach (string name in Directory.EnumerateDirectories (FullPath, searchPattern, searchOption))
yield return new DirectoryInfo (name);
}
public IEnumerable<FileInfo> EnumerateFiles ()
{
return EnumerateFiles ("*", SearchOption.TopDirectoryOnly);
}
public IEnumerable<FileInfo> EnumerateFiles (string searchPattern)
{
return EnumerateFiles (searchPattern, SearchOption.TopDirectoryOnly);
}
public IEnumerable<FileInfo> EnumerateFiles (string searchPattern, SearchOption searchOption)
{
if (searchPattern == null)
throw new ArgumentNullException ("searchPattern");
return CreateEnumerateFilesIterator (searchPattern, searchOption);
}
IEnumerable<FileInfo> CreateEnumerateFilesIterator (string searchPattern, SearchOption searchOption)
{
foreach (string name in Directory.EnumerateFiles (FullPath, searchPattern, searchOption))
yield return new FileInfo (name);
}
public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos ()
{
return EnumerateFileSystemInfos ("*", SearchOption.TopDirectoryOnly);
}
public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos (string searchPattern)
{
return EnumerateFileSystemInfos (searchPattern, SearchOption.TopDirectoryOnly);
}
public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos (string searchPattern, SearchOption searchOption)
{
if (searchPattern == null)
throw new ArgumentNullException ("searchPattern");
if (searchOption != SearchOption.TopDirectoryOnly && searchOption != SearchOption.AllDirectories)
throw new ArgumentOutOfRangeException ("searchoption");
return EnumerateFileSystemInfos (FullPath, searchPattern, searchOption);
}
static internal IEnumerable<FileSystemInfo> EnumerateFileSystemInfos (string full, string searchPattern, SearchOption searchOption)
{
string path_with_pattern = Path.Combine (full, searchPattern);
IntPtr handle;
MonoIOError error;
FileAttributes rattr;
bool subdirs = searchOption == SearchOption.AllDirectories;
Path.Validate (full);
string s = MonoIO.FindFirst (full, path_with_pattern, out rattr, out error, out handle);
if (s == null)
yield break;
if (error != 0)
throw MonoIO.GetException (Path.GetDirectoryName (path_with_pattern), (MonoIOError) error);
try {
if (((rattr & FileAttributes.ReparsePoint) == 0)){
if ((rattr & FileAttributes.Directory) != 0)
yield return new DirectoryInfo (s);
else
yield return new FileInfo (s);
}
while ((s = MonoIO.FindNext (handle, out rattr, out error)) != null){
if ((rattr & FileAttributes.ReparsePoint) != 0)
continue;
if ((rattr & FileAttributes.Directory) != 0)
yield return new DirectoryInfo (s);
else
yield return new FileInfo (s);
if (((rattr & FileAttributes.Directory) != 0) && subdirs)
foreach (FileSystemInfo child in EnumerateFileSystemInfos (s, searchPattern, searchOption))
yield return child;
}
} finally {
MonoIO.FindClose (handle);
}
}
#endif
}
}

View File

@@ -0,0 +1,63 @@
//
// System.IO.DirectoryNotFoundException.cs
//
// Author:
// Paolo Molaro (lupus@ximian.com)
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
namespace System.IO {
[Serializable]
[ComVisible (true)]
public class DirectoryNotFoundException : IOException {
// Constructors
public DirectoryNotFoundException ()
: base ("Directory not found")
{
}
public DirectoryNotFoundException (string message)
: base (message)
{
}
public DirectoryNotFoundException (string message, Exception innerException)
: base (message, innerException)
{
}
protected DirectoryNotFoundException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
}
}
}

View File

@@ -0,0 +1,183 @@
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace System.IO {
[SerializableAttribute]
[ComVisibleAttribute(true)]
public sealed class DriveInfo : ISerializable {
string drive_format;
string path;
DriveInfo (string path, string fstype)
{
this.drive_format = fstype;
this.path = path;
}
public DriveInfo (string driveName)
{
if (!Environment.IsUnix) {
if (driveName == null || driveName.Length == 0)
throw new ArgumentException ("The drive name is null or empty", "driveName");
if (driveName.Length >= 2 && driveName [1] != ':')
throw new ArgumentException ("Invalid drive name", "driveName");
// Convert the path to a standard format so we can find it later.
driveName = String.Concat (Char.ToUpperInvariant (driveName [0]).ToString (), ":\\");
}
DriveInfo [] drives = GetDrives ();
foreach (DriveInfo d in drives){
if (d.path == driveName){
this.path = d.path;
this.drive_format = d.drive_format;
this.path = d.path;
return;
}
}
throw new ArgumentException ("The drive name does not exist", "driveName");
}
static void GetDiskFreeSpace (string path, out ulong availableFreeSpace, out ulong totalSize, out ulong totalFreeSpace)
{
MonoIOError error;
if (!GetDiskFreeSpaceInternal (path, out availableFreeSpace, out totalSize, out totalFreeSpace, out error))
throw MonoIO.GetException (path, error);
}
public long AvailableFreeSpace {
get {
ulong availableFreeSpace;
ulong totalSize;
ulong totalFreeSpace;
GetDiskFreeSpace (path, out availableFreeSpace, out totalSize, out totalFreeSpace);
return availableFreeSpace > long.MaxValue ? long.MaxValue : (long) availableFreeSpace;
}
}
public long TotalFreeSpace {
get {
ulong availableFreeSpace;
ulong totalSize;
ulong totalFreeSpace;
GetDiskFreeSpace (path, out availableFreeSpace, out totalSize, out totalFreeSpace);
return totalFreeSpace > long.MaxValue ? long.MaxValue : (long) totalFreeSpace;
}
}
public long TotalSize {
get {
ulong availableFreeSpace;
ulong totalSize;
ulong totalFreeSpace;
GetDiskFreeSpace (path, out availableFreeSpace, out totalSize, out totalFreeSpace);
return totalSize > long.MaxValue ? long.MaxValue : (long) totalSize;
}
}
[MonoTODO ("Currently get only works on Mono/Unix; set not implemented")]
public string VolumeLabel {
get {
return path;
}
set {
throw new NotImplementedException ();
}
}
public string DriveFormat {
get {
return drive_format;
}
}
public DriveType DriveType {
get {
return (DriveType) GetDriveTypeInternal (path);
}
}
public string Name {
get {
return path;
}
}
public DirectoryInfo RootDirectory {
get {
return new DirectoryInfo (path);
}
}
[MonoTODO("It always returns true")]
public bool IsReady {
get {
return true;
}
}
[MonoTODO("In windows, alldrives are 'Fixed'")]
public static DriveInfo[] GetDrives ()
{
var drives = Environment.GetLogicalDrives ();
DriveInfo [] infos = new DriveInfo [drives.Length];
int i = 0;
foreach (string s in drives)
infos [i++] = new DriveInfo (s, GetDriveFormat (s));
return infos;
}
void ISerializable.GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
{
throw new NotImplementedException ();
}
public override string ToString ()
{
return(Name);
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern static bool GetDiskFreeSpaceInternal (string pathName, out ulong freeBytesAvail,
out ulong totalNumberOfBytes, out ulong totalNumberOfFreeBytes,
out MonoIOError error);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern static uint GetDriveTypeInternal (string rootPathName);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern static string GetDriveFormat (string rootPathName);
}
}

View File

@@ -0,0 +1,66 @@
//
// System.IO.DriveNotFoundException.cs
//
// Author:
// Kornél Pál <http://www.kornelpal.hu/>
//
// Copyright (C) 2006 Kornél Pál
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.IO
{
[Serializable]
[ComVisible (true)]
public class DriveNotFoundException : IOException
{
private const int ErrorCode = unchecked((int)0x80070003);
// Constructors
public DriveNotFoundException ()
: base ("Attempted to access a drive that is not available.")
{
this.HResult = ErrorCode;
}
public DriveNotFoundException (string message)
: base (message)
{
this.HResult = ErrorCode;
}
public DriveNotFoundException (string message, Exception innerException)
: base (message, innerException)
{
this.HResult = ErrorCode;
}
protected DriveNotFoundException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
}
}
}

View File

@@ -0,0 +1,41 @@
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace System.IO {
[ComVisible (true)]
[Serializable]
public enum DriveType {
CDRom = 5,
Fixed = 3,
Network = 4,
NoRootDirectory = 1,
Ram = 6,
Removable = 2,
Unknown = 0
}
}

View File

@@ -0,0 +1,68 @@
//
// System.IO.EndOfStreamException.cs
//
// Author:
// Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Globalization;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
namespace System.IO
{
[Serializable]
[ComVisible (true)]
public class EndOfStreamException : IOException
{
// Constructors
public EndOfStreamException ()
: base (Locale.GetText ("Failed to read past end of stream."))
{
}
public EndOfStreamException (string message)
: base (message)
{
}
protected EndOfStreamException (SerializationInfo info,
StreamingContext context)
: base (info, context)
{
}
public EndOfStreamException (string message, Exception innerException)
:base (message, innerException)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,59 @@
// FileAccess.cs
//
// This code was automatically generated from
// ECMA CLI XML Library Specification.
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
// Created: Fri, 7 Sep 2001 16:32:20 UTC
// Source file: AllTypes.xml
// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.IO {
/// <summary>
/// </summary>
[Flags]
[ComVisible (true)]
[Serializable]
public enum FileAccess : int {
/// <summary>
/// </summary>
Read = 0x00000001,
/// <summary>
/// </summary>
Write = 0x00000002,
/// <summary>
/// </summary>
ReadWrite = Read | Write,
} // FileAccess
} // System.IO

View File

@@ -0,0 +1,68 @@
//------------------------------------------------------------------------------
//
// System.IO.FileAttributes.cs
//
// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
//
// Author: Jim Richardson, develop@wtfo-guru.com
// Created: Monday, August 13, 2001
//
//------------------------------------------------------------------------------
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.IO
{
[Flags]
[Serializable]
[ComVisible (true)]
public enum FileAttributes
{
Archive = 0x00020,
Compressed = 0x00800,
Device = 0x00040, // Reserved for future use (NOT the w32 value).
Directory = 0x00010,
Encrypted = 0x04000, // NOT the w32 value
Hidden = 0x00002,
Normal = 0x00080,
NotContentIndexed = 0x02000,
Offline = 0x01000,
ReadOnly = 0x00001,
ReparsePoint = 0x00400,
SparseFile = 0x00200,
System = 0x00004,
Temporary = 0x00100,
#if NET_4_5
IntegrityStream = 0x8000,
NoScrubData = 0x20000,
#endif
//
// This flag is used internall by Mono to make it Executable
//
// Executable = 0x80000000
}
}

View File

@@ -0,0 +1,334 @@
//------------------------------------------------------------------------------
//
// System.IO.FileInfo.cs
//
// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
//
// Author: Jim Richardson, develop@wtfo-guru.com
// Dan Lewis (dihlewis@yahoo.co.uk)
// Created: Monday, August 13, 2001
//
//------------------------------------------------------------------------------
//
// Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
#if !NET_2_1
using System.Security.AccessControl;
#endif
namespace System.IO {
[Serializable]
[ComVisible (true)]
public sealed class FileInfo : FileSystemInfo
{
private bool exists;
public FileInfo (string fileName)
{
if (fileName == null)
throw new ArgumentNullException ("fileName");
CheckPath (fileName);
SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
OriginalPath = fileName;
FullPath = Path.GetFullPath (fileName);
}
private FileInfo (SerializationInfo info, StreamingContext context)
: base (info, context)
{
}
internal override void InternalRefresh ()
{
exists = File.Exists (FullPath);
}
// public properties
public override bool Exists {
get {
Refresh (false);
if (stat.Attributes == MonoIO.InvalidFileAttributes)
return false;
if ((stat.Attributes & FileAttributes.Directory) != 0)
return false;
return exists;
}
}
public override string Name {
get {
return Path.GetFileName (FullPath);
}
}
#if !NET_2_1
public bool IsReadOnly {
get {
if (!Exists)
throw new FileNotFoundException ("Could not find file \"" + OriginalPath + "\".", OriginalPath);
return ((stat.Attributes & FileAttributes.ReadOnly) != 0);
}
set {
if (!Exists)
throw new FileNotFoundException ("Could not find file \"" + OriginalPath + "\".", OriginalPath);
FileAttributes attrs = File.GetAttributes(FullPath);
if (value)
attrs |= FileAttributes.ReadOnly;
else
attrs &= ~FileAttributes.ReadOnly;
File.SetAttributes(FullPath, attrs);
}
}
[MonoLimitation ("File encryption isn't supported (even on NTFS).")]
[ComVisible (false)]
public void Encrypt ()
{
// MS.NET support this only on NTFS file systems, i.e. it's a file-system (not a framework) feature.
// otherwise it throws a NotSupportedException (or a PlatformNotSupportedException on older OS).
// we throw the same (instead of a NotImplementedException) because most code should already be
// handling this exception to work properly.
throw new NotSupportedException (Locale.GetText ("File encryption isn't supported on any file system."));
}
[MonoLimitation ("File encryption isn't supported (even on NTFS).")]
[ComVisible (false)]
public void Decrypt ()
{
// MS.NET support this only on NTFS file systems, i.e. it's a file-system (not a framework) feature.
// otherwise it throws a NotSupportedException (or a PlatformNotSupportedException on older OS).
// we throw the same (instead of a NotImplementedException) because most code should already be
// handling this exception to work properly.
throw new NotSupportedException (Locale.GetText ("File encryption isn't supported on any file system."));
}
#endif
public long Length {
get {
if (!Exists)
throw new FileNotFoundException ("Could not find file \"" + OriginalPath + "\".", OriginalPath);
return stat.Length;
}
}
public string DirectoryName {
get {
return Path.GetDirectoryName (FullPath);
}
}
public DirectoryInfo Directory {
get {
return new DirectoryInfo (DirectoryName);
}
}
// streamreader methods
public StreamReader OpenText ()
{
return new StreamReader (Open (FileMode.Open, FileAccess.Read));
}
public StreamWriter CreateText ()
{
return new StreamWriter (Open (FileMode.Create, FileAccess.Write));
}
public StreamWriter AppendText ()
{
return new StreamWriter (Open (FileMode.Append, FileAccess.Write));
}
// filestream methods
public FileStream Create ()
{
return File.Create (FullPath);
}
public FileStream OpenRead ()
{
return Open (FileMode.Open, FileAccess.Read, FileShare.Read);
}
public FileStream OpenWrite ()
{
return Open (FileMode.OpenOrCreate, FileAccess.Write);
}
public FileStream Open (FileMode mode)
{
return Open (mode, FileAccess.ReadWrite);
}
public FileStream Open (FileMode mode, FileAccess access)
{
return Open (mode, access, FileShare.None);
}
public FileStream Open (FileMode mode, FileAccess access, FileShare share)
{
return new FileStream (FullPath, mode, access, share);
}
// file methods
public override void Delete ()
{
MonoIOError error;
SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
if (!MonoIO.Exists (FullPath, out error))
// a weird MS.NET behaviour
return;
if (MonoIO.ExistsDirectory (FullPath, out error))
throw new UnauthorizedAccessException ("Access to the path \"" + FullPath + "\" is denied.");
if (!MonoIO.DeleteFile (FullPath, out error))
throw MonoIO.GetException (OriginalPath, error);
}
public void MoveTo (string destFileName)
{
if (destFileName == null)
throw new ArgumentNullException ("destFileName");
if (destFileName == Name || destFileName == FullName)
return;
if (!File.Exists (FullPath))
throw new FileNotFoundException ();
File.Move (FullPath, destFileName);
this.FullPath = Path.GetFullPath (destFileName);
}
public FileInfo CopyTo (string destFileName)
{
return CopyTo (destFileName, false);
}
public FileInfo CopyTo (string destFileName, bool overwrite)
{
if (destFileName == null)
throw new ArgumentNullException ("destFileName");
if (destFileName.Length == 0)
throw new ArgumentException ("An empty file name is not valid.", "destFileName");
string dest = Path.GetFullPath (destFileName);
if (overwrite && File.Exists (dest))
File.Delete (dest);
File.Copy (FullPath, dest);
return new FileInfo (dest);
}
public override string ToString ()
{
#if NET_2_1
// for Moonlight we *never* return paths, since ToString is not [SecurityCritical] we simply return the Name
return Name;
#else
return OriginalPath;
#endif
}
#if !NET_2_1
public FileSecurity GetAccessControl ()
{
return File.GetAccessControl (FullPath);
}
public FileSecurity GetAccessControl (AccessControlSections includeSections)
{
return File.GetAccessControl (FullPath, includeSections);
}
[ComVisible (false)]
public FileInfo Replace (string destinationFileName,
string destinationBackupFileName)
{
string destinationFullPath = null;
if (!Exists)
throw new FileNotFoundException ();
if (destinationFileName == null)
throw new ArgumentNullException ("destinationFileName");
if (destinationFileName.Length == 0)
throw new ArgumentException ("An empty file name is not valid.", "destinationFileName");
destinationFullPath = Path.GetFullPath (destinationFileName);
if (!File.Exists (destinationFullPath))
throw new FileNotFoundException ();
FileAttributes attrs = File.GetAttributes (destinationFullPath);
if ( (attrs & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
throw new UnauthorizedAccessException ();
if (destinationBackupFileName != null) {
if (destinationBackupFileName.Length == 0)
throw new ArgumentException ("An empty file name is not valid.", "destinationBackupFileName");
File.Copy (destinationFullPath, Path.GetFullPath (destinationBackupFileName), true);
}
File.Copy (FullPath, destinationFullPath,true);
File.Delete (FullPath);
return new FileInfo (destinationFullPath);
}
[ComVisible (false)]
[MonoLimitation ("We ignore the ignoreMetadataErrors parameter")]
public FileInfo Replace (string destinationFileName,
string destinationBackupFileName,
bool ignoreMetadataErrors)
{
return Replace (destinationFileName, destinationBackupFileName);
}
public void SetAccessControl (FileSecurity fileSecurity)
{
File.SetAccessControl (FullPath, fileSecurity);
}
#endif
}
}

View File

@@ -0,0 +1,139 @@
//
// System.IO.FileLoadException.cs
//
// Author:
// Paolo Molaro (lupus@ximian.com)
// Duncan Mak (duncan@ximian.com)
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Globalization;
using System.Runtime.Serialization;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Runtime.InteropServices;
namespace System.IO {
[Serializable]
[ComVisible (true)]
public class FileLoadException : IOException {
// Fields
const int Result = unchecked ((int)0x80070002);
string msg;
string fileName;
string fusionLog;
// Constructors
public FileLoadException ()
: base (Locale.GetText ("I/O Error"))
{
HResult = Result;
msg = Locale.GetText ("I/O Error");
}
public FileLoadException (string message)
: base (message)
{
HResult = Result;
msg = message;
}
public FileLoadException (string message, string fileName)
: base (message)
{
HResult = Result;
this.msg = message;
this.fileName = fileName;
}
public FileLoadException (string message, Exception inner)
: base (message, inner)
{
HResult = Result;
msg = message;
}
public FileLoadException (string message, string fileName, Exception inner)
: base (message, inner)
{
HResult = Result;
this.msg = message;
this.fileName = fileName;
}
protected FileLoadException (SerializationInfo info, StreamingContext context)
{
fileName = info.GetString ("FileLoad_FileName");
fusionLog = info.GetString ("FileLoad_FusionLog");
}
// Properties
public override string Message {
get { return msg; }
}
public string FileName
{
get { return fileName; }
}
public string FusionLog {
// note: MS runtime throws a SecurityException when the Exception is created
// but a FileLoadException once the exception as been thrown. Mono always
// throw a SecurityException in both case (anyway fusionLog is currently empty)
[SecurityPermission (SecurityAction.Demand, ControlEvidence=true, ControlPolicy=true)]
get { return fusionLog; }
}
// Methods
public override void GetObjectData (SerializationInfo info, StreamingContext context)
{
base.GetObjectData (info, context);
info.AddValue ("FileLoad_FileName", fileName);
info.AddValue ("FileLoad_FusionLog", fusionLog);
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder (GetType ().FullName);
sb.AppendFormat (": {0}", msg);
if (fileName != null)
sb.AppendFormat (" : {0}", fileName);
if (this.InnerException != null)
sb.AppendFormat (" ----> {0}", InnerException);
if (this.StackTrace != null) {
sb.Append (Environment.NewLine);
sb.Append (StackTrace);
}
return sb.ToString ();
}
}
}

View File

@@ -0,0 +1,71 @@
// FileMode.cs
//
// This code was automatically generated from
// ECMA CLI XML Library Specification.
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
// Created: Fri, 7 Sep 2001 16:32:13 UTC
// Source file: AllTypes.xml
// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.IO {
/// <summary>
/// </summary>
[ComVisible (true)]
[Serializable]
public enum FileMode {
/// <summary>
/// </summary>
CreateNew = 1,
/// <summary>
/// </summary>
Create = 2,
/// <summary>
/// </summary>
Open = 3,
/// <summary>
/// </summary>
OpenOrCreate = 4,
/// <summary>
/// </summary>
Truncate = 5,
/// <summary>
/// </summary>
Append = 6,
} // FileMode
} // System.IO

View File

@@ -0,0 +1,144 @@
//
// System.IO.FileNotFoundException.cs
//
// Author:
// Paolo Molaro (lupus@ximian.com)
// Duncan Mak (duncan@ximian.com)
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Globalization;
using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Text;
using System.Runtime.InteropServices;
namespace System.IO {
[Serializable]
[ComVisible (true)]
public class FileNotFoundException : IOException {
const int Result = unchecked ((int)0x80131621);
private string fileName;
private string fusionLog;
// Constructors
public FileNotFoundException ()
: base (Locale.GetText ("Unable to find the specified file."))
{
HResult = Result;
}
public FileNotFoundException (string message)
: base (message)
{
HResult = Result;
}
public FileNotFoundException (string message, Exception innerException)
: base (message, innerException)
{
HResult = Result;
}
public FileNotFoundException (string message, string fileName)
: base (message)
{
HResult = Result;
this.fileName = fileName;
}
public FileNotFoundException (string message, string fileName, Exception innerException)
: base (message, innerException)
{
HResult = Result;
this.fileName = fileName;
}
protected FileNotFoundException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
fileName = info.GetString ("FileNotFound_FileName");
fusionLog = info.GetString ("FileNotFound_FusionLog");
}
public string FileName
{
get { return fileName; }
}
public string FusionLog {
// note: MS runtime throws a SecurityException when the Exception is created
// but a FileLoadException once the exception as been thrown. Mono always
// throw a SecurityException in both case (anyway fusionLog is currently empty)
[SecurityPermission (SecurityAction.Demand, ControlEvidence=true, ControlPolicy=true)]
get { return fusionLog; }
}
public override string Message {
get {
if (base.message == null) {
if (fileName != null) {
string message = string.Format (
"Could not load file or assembly '{0}' or one of"
+ " its dependencies. The system cannot find the"
+ " file specified.", fileName);
return message;
}
}
return base.message;
}
}
public override void GetObjectData (SerializationInfo info, StreamingContext context)
{
base.GetObjectData (info, context);
info.AddValue ("FileNotFound_FileName", fileName);
info.AddValue ("FileNotFound_FusionLog", fusionLog);
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder (GetType ().FullName);
sb.AppendFormat (": {0}", Message);
if (fileName != null && fileName.Length > 0) {
sb.Append (Environment.NewLine);
sb.AppendFormat ("File name: '{0}'", fileName);
}
if (this.InnerException != null)
sb.AppendFormat (" ---> {0}", InnerException);
if (this.StackTrace != null) {
sb.Append (Environment.NewLine);
sb.Append (StackTrace);
}
return sb.ToString ();
}
}
}

View File

@@ -0,0 +1,57 @@
//------------------------------------------------------------------------------
//
// System.IO.FileOptions.cs
//
// Author: Zoltan Varga (vargaz@gmail.com)
//
//------------------------------------------------------------------------------
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.IO
{
[Flags]
[Serializable]
[ComVisible(true)]
public enum FileOptions
{
None = 0,
Encrypted = 0x4000,
DeleteOnClose = 0x4000000,
SequentialScan = 0x8000000,
RandomAccess = 0x10000000,
Asynchronous = 0x40000000,
WriteThrough = -2147483648
//
// FileIsTemporary = 1
// The above is an internal value used by Path.GetTempFile to
// get a file with 600 permissions, regardless of the umask
// settings. If a value "1" must be introduced here, update
// both metadata/file-io.c and Path.GetTempFile
//
}
}

View File

@@ -0,0 +1,55 @@
// FileShare.cs
//
// This code was automatically generated from
// ECMA CLI XML Library Specification.
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
// Created: Fri, 7 Sep 2001 16:32:26 UTC
// Source file: AllTypes.xml
// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.IO {
/// <summary>
/// </summary>
[Flags]
[ComVisible (true)]
[Serializable]
public enum FileShare : int {
None = 0,
Read = 1,
Write = 2,
ReadWrite = 3,
Delete = 4,
Inheritable = 16,
} // FileShare
} // System.IO

Some files were not shown because too many files have changed in this diff Show More