Commit Graph
73 Commits
Author SHA1 Message Date
Radek Doulik 50dacc2e31 revert my 2 last commits
Revert "add System.Net.Http.Formatting to monodroid build"
        Revert "added System.Configuration and System.Security to monodroid build to fix it"

        This reverts commit 85cb9e3176 and
                     commit 6566273367.
2013-05-16 17:29:26 +02:00
Radek Doulik 85cb9e3176 add System.Net.Http.Formatting to monodroid build
- changed the Create method with FileOptions to not depend on FileSecurity
   to avoid dragging System.Security assembly in monodroid build as well
2013-05-15 22:26:32 +02:00
Rodrigo Kumpera 1b92a4148c Since MOBILE implies NET_4_* now, take this into account and simplify our ifdefs. 2013-02-11 18:42:18 -05:00
Rodrigo Kumpera b96d05dac3 Kill the MOONLIGHT define in corlib. 2013-02-11 16:03:28 -05:00
James Bellinger 9322e0d16b ACLs now work on Windows. Tests all the way up to DirectorySecurityTest and FileSecurityTest.
NativeObjectSecurity is implemented.
I've done it in such a way that, for OSes that do not have a unified API for all ACLs,
overrides can be done in subclasses such as FileSystemSecurity without trouble.

ObjectSecurity, CommonObjectSecurity, and DirectoryObjectSecurity all implemented.
MutexSecurity, PipeSecurity, etc. all just add type specialization and nothing else. Implemented all of these as well.

Access and Audit rules now correctly use NTAccount in their string overloads (see unit tests).
The constructors all provide correct AccessMasks now. In other words, these classes are all now un-broken/no longer stubs.

More unit tests for CommonSecurityDescriptor and fixes to pass them.
A few had checks that were redundant (implemented by (Authorization|Audit|Access)Rule) as well. These have been removed.
The Allow Everyone Full Access default for null DiscretionaryAcls in CommonSecurityDescriptor is, I think,
properly implemented. This required some changes to GenericSecurityDescriptor as well, but now Mono matches
MS.NET on GetSddl/GetBinaryForm for null DiscretionaryAcl including roundtrip.

What's still missing:
(1) CommonAcl's RemoveAccess/RemoveAudit. RemoveAll and RemoveSpecific work so it's not a big issue.
(2) CommonAcl merging will not yet try to merge a CommonAce together with an ObjectAce.
(3) The various *Security constructors. Get/SetAccessControl work on files and directories.
However, you still have to create and then set. I am not too familiar with Mono runtime internal
calls, but to someone who is: If the SECURITY_ATTRIBUTES parameter to Create*'s lpSecurityDescriptor
pointed to the output of GenericSecurityDescriptor's GetBinaryForm, that would be a complete
implementation.
2012-07-07 18:45:06 -04:00
Sebastien Pouliot a62f13f74f Expose new ReadLines extension methods in the mobile-based profiles 2011-07-23 11:03:44 -04:00
Gonzalo Paniagua Javier b2dc477570 In *AllLines use WriteLine instead of Write.
This fixes bug #689670.
2011-04-25 16:22:44 -04:00
Gonzalo Paniagua Javier c22160538c [File.ReadLines] Dispose the StreamReader in the right place.
The StreamReader was being disposed immediately after the call to
	ReadLines() causing the enumerator to fails.

	Fixes bug #649464.
2010-11-21 15:14:31 -05:00
Sebastien Pouliot e6fd69e444 2010-04-16 Sebastien Pouliot <[email protected]>
* Directory.cs: Ensure elevated trust when calling on 
	Moonlight.
	* DirectoryInfo.cs: Ensure elevated trust when calling a .ctor 
	on Moonlight.
	* File.cs: Ensure elevated trust when calling a .ctor on 
	Moonlight.
	* FileInfo.cs: Ensure elevated trust when calling a .ctor on 
	Moonlight.
	* FileStream.cs: Ensure elevated trust when calling a .ctor on 
	Moonlight. Name property returns "[Unknown]" unless a Moonlight
	application is executed with elevated trust.
	* Path.cs: Ensure elevated trust when calling a GetTempPath,
	GetTempFileName or GetFullPath on Moonlight. Add a shared 
	internal method to validate paths to reduce code duplication.


svn path=/trunk/mcs/; revision=155643
2010-04-16 17:29:07 +00:00
Jb Evain 05a5b21fa0 use MOONLIGHT symbol
svn path=/trunk/mcs/; revision=153656
2010-03-16 12:10:19 +00:00
Sebastien Pouliot 0b7db61902 In System:
2010-03-12  Sebastien Pouliot  <[email protected]>

	* Tuple.cs, Tuples.cs: Add them to NET_2_1 since they are parts
	of SL4

In System.Collections:
2010-03-12  Sebastien Pouliot  <[email protected]>

	* IStructuralComparable.cs, IStructuralEquatable.cs: Add them to
	NET_2_1 since they are parts of SL4

In System.IO:
2010-03-12  Sebastien Pouliot  <[email protected]>

	* File.cs: Enable some NET_4_0 features in NET_2_1 since they are
	part of SL4. Throw a SecurityException in Moonlight in non-debug
	builds until we're ready for elevated trust.


svn path=/trunk/mcs/; revision=153506
2010-03-12 13:11:11 +00:00
Sebastien Pouliot ad24f7d093 2009-12-21 Sebastien Pouliot <[email protected]>
* File.cs (ReadAllBytes): We cannot assume that a single call to
	Read will return all the data we require.


svn path=/trunk/mcs/; revision=148822
2009-12-21 22:40:25 +00:00
Miguel de Icaza 53e7b9d5b6 2009-10-21 Miguel de Icaza <[email protected]>
* BinaryWriter.cs, BinaryReader.cs: 4.0 signature update.

	* File.cs (ReadLines, AppendAllLines, WriteAllLines): Add
	IEnumerable methods.

	* Path.cs (Combine): add the params overload. 

svn path=/trunk/mcs/; revision=144597
2009-10-22 03:19:06 +00:00
Miguel de Icaza 0204abe803 Drop more obsolete defines
svn path=/trunk/mcs/; revision=144304
2009-10-17 01:35:27 +00:00
Sebastien Pouliot 2203a2bb29 2009-09-18 Sebastien Pouliot <[email protected]>
* Directory.cs: Avoid imperative CAS checks and remove 
	AccessControl types for NET_2_1
	* DirectoryInfo.cs: Remove AccessControl types for NET_2_1
	* File.cs: Remove AccessControl types for NET_2_1
	* FileInfo.cs: Remove AccessControl types for NET_2_1
	* FileStream.cs: Remove AccessControl types for NET_2_1
	* Path.cs: Avoid imperative CAS checks for NET_2_1


svn path=/trunk/mcs/; revision=142197
2009-09-18 15:57:32 +00:00
Marek Safar cc9c53a109 Warnings cleanup
svn path=/trunk/mcs/; revision=111713
2008-08-27 15:40:13 +00:00
Marek Safar 234af04edd 2008-07-28 Marek Safar <[email protected]>
* File.cs: Delay DateTime .cctor invocation.


svn path=/trunk/mcs/; revision=108982
2008-07-28 10:44:06 +00:00
Andreas N d0426bff7e 2008-07-04 Andreas Nahr <[email protected]>
* File.cs: Fix parameter name

svn path=/trunk/mcs/; revision=107222
2008-07-04 07:45:10 +00:00
Andreas N b7ebfaf624 2008-07-03 Andreas Nahr <[email protected]>
* TextWriter.cs:
	* StreamWriter.cs:
	* StreamReader.cs:
	* Stream.cs:
	* MemoryStream.cs:
	* File.cs:
	* DriveNotFoundException.cs:
	* Directory.cs: Fix parameter names

svn path=/trunk/mcs/; revision=107182
2008-07-03 20:00:51 +00:00
Gert Driesen 5d4e8d2ce4 * DirectoryInfo.cs: Added new internal ctor, which takes a bool that
indicates whether the original path should only container the last
part of the directory. Moved logic for determining the Name and
Parent to Initialize method, to allow it to be re-used on
deserialization. Renamed argument names to fix corcompare issues.
Added missing argument checks.
* Directory.cs (CreateDirectoriesInternal): Use internal ctor for
DirectoryInfo to ensure OriginalPath only contains last part of
the directory.
* File.cs: Removed redundant checks from Create. On 2.0 profile, pass
FileOptions to FileStream. Removed redundant directory check from
Delete and modified exceptions to more closely match MS.
* FileInfo.cs: Added argument check to ctor to match MS. Added missing
deserialization ctor. Modified argument checks in MoveTo, and removed
redundant checks. Added missing argument checks in CopyTo. Code
formatting.
* FileSystemInfo.cs: Modified argument checks in CheckPath to more
closely match MS.
* MonoIO.cs: Added msg that does not disclose filename for
ERROR_FILE_EXISTS.
* Path.cs: Use String.Length instead of comparing with String.Empty.
Removed exceptions argument names to match MS.
* File.cs: Added/improved tests for Create and Move.
* DirectoryInfoTest.cs: No longer derive from deprecated Assertion
class. Improved tests for ctor, Create, Name, Parent, ...
* FileInfoTest.cs: No longer derive from deprecated Assertion class.
Improved/added tests, 
* PathTest.cs: Added tests for IsPathRooted and GetFullPath.
* FileSystemInfoTest.cs: Fixed test. Now passes on both Mono and MS.

svn path=/trunk/mcs/; revision=101006
2008-04-17 15:04:25 +00:00
Gert Driesen 9770502338 * File.cs: Changed argument names and thrown exception to better match
.NET. Use String.Length instead of comparison with empty string.
* DirectoryInfo.cs: Added missing deserialization ctor.
* FileTest.cs: Renamed and improved existing tests. Avoid use of
ExpectedException.
* FileSystemInfoTest.cs: No longer derive from deprecated Assertion
class. Added (de)serialization tests.

svn path=/trunk/mcs/; revision=100870
2008-04-16 14:01:25 +00:00
Dick Porter 7c5b9da5e5 2008-04-04 Dick Porter <[email protected]>
* File.cs: Pretty up the file share exception with the path name.

2008-04-04  Dick Porter  <[email protected]>

	* FileTest.cs: Test moving a file when the access mode disallows
	it.  Test from Eric Albright <[email protected]>, see bug 377049.



svn path=/trunk/mcs/; revision=99860
2008-04-04 17:18:47 +00:00
Bill Holmes f18043102f 2007-08-20 William Holmes <[email protected]>
Implementing System.IO.File.Replace
	*File.cs:  Add implementation for IO.File.Replace methods.
	*MonoIO.cs: Declared an internal call for ReplaceFile
	*FileTest.cs:  Added a test for IO.File.Replace.  

	Code is contributed under MIT/X11 license.

svn path=/trunk/mcs/; revision=84485
2007-08-20 18:48:55 +00:00
Dick Porter bf9bb4bc89 2007-05-01 Dick Porter <[email protected]>
* File.cs:
	* Stream.cs: Missed a few 2.0 methods

2007-05-01  Dick Porter  <[email protected]>

	* RegistryKeyPermissionCheck.cs: Not serializable



svn path=/trunk/mcs/; revision=76523
2007-05-01 11:08:28 +00:00
Dick Porter 5b79519900 2007-04-30 Dick Porter <[email protected]>
* Directory.cs: 
	* FileShare.cs: 
	* DirectoryNotFoundException.cs: 
	* SeekOrigin.cs: 
	* FileAttributes.cs: 
	* IOException.cs: 
	* MemoryStream.cs: 
	* FileMode.cs: 
	* BinaryWriter.cs: 
	* TextWriter.cs: 
	* File.cs: 
	* BinaryReader.cs: 
	* TextReader.cs: 
	* UnmanagedMemoryStream.cs: 
	* StringWriter.cs: 
	* FileAccess.cs: 
	* FileLoadException.cs: 
	* BufferedStream.cs: 
	* Stream.cs: 
	* FileInfo.cs: 
	* FileStream.cs:
	* StringReader.cs: 
	* StreamWriter.cs: 
	* EndOfStreamException.cs: 
	* DriveInfo.cs: 
	* StreamReader.cs: 
	* PathTooLongException.cs: 
	* DriveType.cs: 
	* FileNotFoundException.cs: 2.0 profile updates



svn path=/trunk/mcs/; revision=76495
2007-04-30 14:05:12 +00:00
Miguel de Icaza 3a23274a17 Revert Patch 72756 until we review and discuss this publicly
svn path=/trunk/mcs/; revision=72768
2007-02-13 13:07:41 +00:00
Boris Kirzner 04052b1827 Path handling fixes in File, Directory and Path including windows-specific negative flows.
svn path=/trunk/mcs/; revision=72756
2007-02-13 12:04:32 +00:00
Sebastien Pouliot ff518b0de4 2006-12-22 Sebastien Pouliot <[email protected]>
* File.cs: Add stubs for Encrypt and Decrypt that throws 
	NotSupportedException just like non-NTFS file systems would with MS.
	Remove nested #if NET_2_0.
	* FileInfo.cs: Add stubs for Encrypt and Decrypt that throws 
	NotSupportedException just like non-NTFS file systems would with MS.


svn path=/trunk/mcs/; revision=69956
2006-12-22 18:21:25 +00:00
Miguel de Icaza 8a1af5fd38 2006-11-16 Miguel de Icaza <[email protected]>
* DirectoryInfo.cs (GetFiles): Implement option with SearchOptions
	== AllDirectories

And a lot of MonoTODOs updated as well


svn path=/trunk/mcs/; revision=67998
2006-11-16 14:14:01 +00:00
Gonzalo Paniagua Javier 464d17fab8 2006-08-03 Gonzalo Paniagua Javier <[email protected]>
* File.cs: (Delete) avoid creating the exception object for the 'file
	not found' case.


svn path=/trunk/mcs/; revision=63296
2006-08-03 14:43:52 +00:00
Gonzalo Paniagua Javier 98b2dabae1 2006-06-06 Gonzalo Paniagua Javier <[email protected]>
* File.cs: never throw in Exists.


svn path=/trunk/mcs/; revision=61504
2006-06-06 20:58:50 +00:00
Atsushi Eno ad24284d1a 2006-04-28 Atsushi Enomoto <[email protected]>
* StreamReader.cs : implemented EndOfStream property.
	* File.cs : implemented AppendAllText(), WriteAllLines(),
	  WriteAllBytes() and ReadAllLines(). Bug #77813 fixed.


svn path=/trunk/mcs/; revision=60046
2006-04-28 17:14:16 +00:00
Gert Driesen 06a833ea77 * File.cs: In 2.0 profile, File.Get****Time(Utc) should not throw
IOException if specified path does not exist. Fixes bug #77641.
* FileTest.cs: In 2.0 profile, no longer expect IOException when path to
non-existing directory or file is specified in Get***Time(Utc) methods
(bug #77641). Renamed tests and removed trailing tabs. Removed
duplicate test. Fixed GetLastWriteTime(Utc) tests that used
GetLastAccessTime(Utc) instead of GetLastWriteTime(Utc).
* DirectoryTest.cs: No longer expect IOException when path to
non-existing directory or file is specified in Get***Time(Utc) methods
(bug #77641).

svn path=/trunk/mcs/; revision=57338
2006-02-27 17:54:48 +00:00
Ben Maurer c770e5b1a4 In Test/System.IO:
2006-01-12  Ben Maurer  <[email protected]>

	* FileTest.cs: Tests tests for read/writealltext.

In System.IO:
2006-01-12  Ben Maurer  <[email protected]>

	* File.cs: Support for Read/WriteAllText


svn path=/trunk/mcs/; revision=55475
2006-01-13 03:22:19 +00:00
Miguel de Icaza fcca32c6f5 2005-05-26 Miguel de Icaza <[email protected]>
* Dictionary.cs: Remove the `Hash' name from the Dictionary
	internal classes, make them public.

2005-05-26  Miguel de Icaza  <[email protected]>

	* File.cs (ReadAllBytes): add.



svn path=/trunk/mcs/; revision=45058
2005-05-26 15:52:42 +00:00
Ben Maurer 5cbfa93c6e In Test/System.IO:
2005-05-06  Ben Maurer  <[email protected]>

	* FileTest.cs (OpenAppend): Test for #71088.

In System.IO:
2005-05-06  Ben Maurer  <[email protected]>

	* File.cs (Open): If a stream is opened with Append access, you
	only want Write access. Fixes bug #71088.


svn path=/trunk/mcs/; revision=44163
2005-05-06 19:57:29 +00:00
Gonzalo Paniagua Javier 82c2339c3d 2005-02-06 Gonzalo Paniagua Javier <[email protected]>
* Test/System.IO/FileTest.cs: test for invalid characters in file names.
	* System.IO/File.cs: Exists does not throw when there are invalid
	characters in the file name.
	* System.IO/MonoIOError.cs: uncommented INVALID_NAME.


svn path=/trunk/mcs/; revision=40208
2005-02-06 17:10:45 +00:00
Gonzalo Paniagua Javier 3e0146e95b 2004-12-13 Gonzalo Paniagua Javier <[email protected]>
* File.cs: delegate to the runtime the task of checking for destination
	file existence in Move.


svn path=/trunk/mcs/; revision=37714
2004-12-14 03:43:25 +00:00
Miguel de Icaza d83f3856a1 Fix ArgumentNullException arguments, thanks Sebastien
svn path=/trunk/mcs/; revision=33600
2004-09-08 23:11:56 +00:00
Miguel de Icaza 046cc83ddc 2004-09-08 Miguel de Icaza <[email protected]>
* File.cs: Added Gettextification, provide a better error message
	for #62112
2004-09-08  Miguel de Icaza  <[email protected]>

	* Locale.cs: Added overload that calls String.Format.

svn path=/trunk/mcs/; revision=33597
2004-09-08 22:12:40 +00:00
Marek Safar 92587190c7 2004-09-08 Marek Safar <[email protected]>
* Directory.cs,
	* File.cs: Class is static for NET_2_0.

svn path=/trunk/mcs/; revision=33575
2004-09-08 13:56:24 +00:00
Dick Porter 55e8d9fe73 2004-07-05 Dick Porter <[email protected]>
* CheckPermission.cs:
	* File.cs:
	* FileInfo.cs:
	* MonoIO.cs:
	* FileStream.cs: Give the filename when throwing
	FileNotFoundException.  Fixes bug 61120, based on patch from
	Carlos Alberto Cesario <[email protected]>.

svn path=/trunk/mcs/; revision=30744
2004-07-05 15:05:43 +00:00
Dick Porter 5fd2b136bf 2004-07-05 Dick Porter <[email protected]>
* File.cs: File.Move() should check that the destination doesn't
	already exist.  Fixes bug 60915, patch based on one from Carlos
	Alberto Cesario <[email protected]>.

svn path=/trunk/mcs/; revision=30741
2004-07-05 14:30:28 +00:00
Atsushi Eno 5412643255 2004-06-21 Atsushi Enomoto <[email protected]>
* FileStream.cs : Check buffer size before creating file.
	* StreamReader.cs : Check encoding!=null before creating file.
	* File.cs,
	  MonoIO.cs : Convert DateTime to FileTime after checking
	  file IO sharing violation (it just fixes the type of exception).

svn path=/trunk/mcs/; revision=30033
2004-06-21 13:30:46 +00:00
Dick Porter ac70de62f3 2004-06-14 Dick Porter <[email protected]>
* Directory.cs:
	* File.cs: Catch PATH_NOT_FOUND errors in Exists() too.  Fixes bug
	59354.

svn path=/trunk/mcs/; revision=29497
2004-06-14 13:18:13 +00:00
Duncan Mak 13d1764537 Add license and copyright to all source files in corlib
svn path=/trunk/mcs/; revision=29249
2004-06-11 02:09:36 +00:00
Duncan Mak 3f9d81d821 * File.cs: Fix line endings, took out ^Ms.
* Directory.cs (GetParent): Return null if the specified path is
the root directory.

svn path=/trunk/mcs/; revision=29061
2004-06-08 20:09:19 +00:00
Atsushi Eno 4557407d6d 2004-05-31 Atsushi Enomoto <[email protected]>
* Directory.cs, File.cs : Fixed Exists() that raised
	  DirectoryNotFoundException. Quick fix for bug #59354.

svn path=/trunk/mcs/; revision=28557
2004-05-31 16:44:03 +00:00
Dick Porter d024688825 2004-05-27 Dick Porter <[email protected]>
* MonoIO.cs: Define icalls for Lock() and Unlock()

	* FileStream.cs: Implement Lock() and Unlock().  Also improve IO
	error reporting.

	* FileSystemInfo.cs:
	* File.cs:
	* Directory.cs: Improve IO error reporting

svn path=/trunk/mcs/; revision=28285
2004-05-27 16:25:27 +00:00
Lluis Sanchez a186746a8a * File.cs: In Move, throw IOException instead of ArgumentException if destination
is a directory.
	* MonoIO.cs: In ExistsDirectory, return ERROR_PATH_NOT_FOUND instead of
	  ERROR_FILE_NOT_FOUND, since we are looking for a directory, not a file.

svn path=/trunk/mcs/; revision=24527
2004-03-24 17:24:29 +00:00