2006-04-21 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Fri, 21 Apr 2006 13:43:51 +0000 (13:43 -0000)
committerZoltan Varga <vargaz@gmail.com>
Fri, 21 Apr 2006 13:43:51 +0000 (13:43 -0000)
* FileStream.cs: Add new net 2.0 ctor.

* FileOptions.cs: New file.

svn path=/trunk/mcs/; revision=59750

mcs/class/corlib/System.IO/ChangeLog
mcs/class/corlib/System.IO/FileOptions.cs [new file with mode: 0644]
mcs/class/corlib/System.IO/FileStream.cs

index 5c4a86bc982194054f98b7903340ef26743c36fd..31c5706c1d3bf86389f523413003a9ccf3b5a4aa 100644 (file)
@@ -1,3 +1,9 @@
+2006-04-21  Zoltan Varga  <vargaz@gmail.com>
+
+       * FileStream.cs: Add new net 2.0 ctor.
+
+       * FileOptions.cs: New file.
+
 2006-03-21  Miguel de Icaza  <miguel@novell.com>
 
        * Stream.cs: In 2.0 make Close call Dispose(true).
diff --git a/mcs/class/corlib/System.IO/FileOptions.cs b/mcs/class/corlib/System.IO/FileOptions.cs
new file mode 100644 (file)
index 0000000..3b9dd6d
--- /dev/null
@@ -0,0 +1,56 @@
+//------------------------------------------------------------------------------
+// 
+// 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)]
+       [MonoTODO]
+#if NET_2_0
+       public enum FileOptions
+#else
+       internal enum FileOptions
+#endif
+       {
+               None = 0,
+               Encrypted = 0x4000,
+               DeleteOnClose = 0x4000000,
+               SequentialScan = 0x8000000,
+               RandomAccess = 0x10000000,
+               Asynchronous = 0x40000000,
+               // FIXME: This field cannot be encoded as an int in C#
+               //WriteThrough = 0x80000000
+       }
+}
+
index 9584670a92bff0e4334cd0f46c7ce698f6b05569..7896e893295e2c0a5c8c78f16baca2d19f701914 100644 (file)
@@ -132,7 +132,19 @@ namespace System.IO
                {
                }
 
+#if NET_2_0
+               public FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)
+                       : this (name, mode, access, share, bufferSize, false, false, options)
+               {
+               }
+#endif
+
                internal FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool isAsync, bool anonymous)
+                       : this (name, mode, access, share, bufferSize, isAsync, anonymous, FileOptions.None)
+               {
+               }
+
+               internal FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool isAsync, bool anonymous, FileOptions options)
                {
                        if (name == null) {
                                throw new ArgumentNullException ("name");
@@ -145,6 +157,9 @@ namespace System.IO
 #if NET_2_0
                        // ignore the Inheritable flag
                        share &= ~FileShare.Inheritable;
+
+                       if (options != FileOptions.None)
+                               throw new NotImplementedException ("Only FileOptions.None is supported.");
 #endif
 
                        if (bufferSize <= 0)