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

View File

@@ -0,0 +1,428 @@
2010-06-18 Rolf Bjarne Kvinge <RKvinge@novell.com>
* MoonIsolatedStorageFile.cs: Add IsEnabled.
2010-06-16 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: Remove should catch all the exceptions
caused by DirectoryInfo.Delete and throw an IsolatedStorageException
instead.
2010-06-08 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: Ugh, accidentally forgot to commit the changes for
in the previous commit.
2010-06-07 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: GetUserStoreForSite is only throwing a
NotSupportedException.
* IsolatedStorageFileStream.cs: Implement Flush by calling the base impl.
2010-06-07 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: Remove and DeleteFile must report any
error found in our System.IO classes as IsolatedStorageException.
2010-06-07 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: Update the exceptions we are firing in 4.0
for CreateDirectory, GetFileNames and GetDirectoryNames.
2010-06-06 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageSecurityState.cs: Make our .ctor internal - so we
don't expose a public .ctor at all.
2010-06-06 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: Our 4.0 methods receiving a path should
either return false or throw an IsolatedStorageException if the path
refers to a directory outside the storage root.
2010-06-04 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: In CheckOpen check that the directory for
the current storage is still valid, and throw an exception if needed.
Also, in the static Remove method call Directory.Delete only if the
directory exists, to avoid throwing an exception there.
2010-06-03 Sebastien Pouliot <sebastien@ximian.com>
* MoonIsolatedStorage.cs: Make class internal so we can access it
from System.Window.dll to adjust quotas
2010-06-02 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: Check for empty paths and existing paths in
both MoveFile and MoveDirectory, just as we do in CopyFile. Finally
cover our IO calls with a try-catch block, so all the IOException
instances are reported as IsolatedStorageException.
2010-05-31 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorage.cs:
* IsolatedStorageFile.cs: Implement AvailableFreeSpace, Quota,
UsedSize and IncreaseQuotaTo.
2010-05-27 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: Implement CopyFile.
2010-05-27 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: Implement GetCreationTime, GetLastAccessTime
and GetLastWriteTime, as well as creating a single method to check for
the closed/disposed fields.
2010-05-26 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: Remove should call Close, just as .Net seems
to do.
2010-05-24 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFileStream.cs: When creating the instance, we should check
for diposed first, and for closed on second place.
* IsolatedStorageFile.cs: Add Obsolete to CurrentSize and MaximumSize,
as part of 4.0.
2010-05-24 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFileStream.cs: When creating our instance check that
the IsolatedStorageFile is not closed/disposed.
* IsolatedStorageFile.cs: Expose closed/disposed info as internal
properties, as well as implement 4.0 MoveDirectory/MoveFile, CreateFile
and OpenFile methods.
2010-05-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: Implement FileExists and DirectoryExists, as
well as adding fields to detect that Close/Dispose have been called
and fire the proper exceptions.
2010-05-21 Carlos Alberto Cortez <calberto.cortez@gmail.com>
4.0 Updates.
* IsolatedStorage.cs: Add ObsoleteAttribute to CurrentSize and
MaximumSize.
* IsolatedStorageSecurityState.cs: New, stubbed.
* IsolatedStorageSecurityOptions.cs: New file.
2010-05-20 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* IsolatedStorageFile.cs: Add the new 4.0 overloads for
GetDirectoryNames and GetFileNames.
2010-03-16 Jb Evain <jbevain@novell.com>
* IsolatedStorageFileEnumerator.cs
* MoonIsolatedStorageFileStream.cs
* MoonIsolatedStorageFile.cs
* MoonIsolatedStorage.cs
* IsolatedStorageScope.cs
* IsolatedStorageFileStream.cs
* IsolatedStorage.cs
* IsolatedStorageFile.cs:
use MOONLIGHT symbol to disambiguate MonoTouch and Moonlight code.
2009-11-01 Sebastien Pouliot <sebastien@ximian.com>
* MoonIsolatedStorageFile.cs: Add new CheckSearchPattern
validation method. Fix GetDirectoryNames to behave like
GetFileNames wrt searchPattern
2009-08-30 Jb Evain <jbevain@novell.com>
* IsolatedStorageFileEnumerator.cs
* MoonIsolatedStorageFileStream.cs
* MoonIsolatedStorageFile.cs
* MoonIsolatedStorage.cs
* IsolatedStorageScope.cs
* IsolatedStorageFileStream.cs
* IsolatedStorage.cs
* IsolatedStorageFile.cs:
Use the traditional net_2_0 version of isolated storage
for MonoTouch.
2009-05-27 Jackson Harper <jackson@ximian.com>
* MoonIsolatedStorageFile.cs: Allow paths in search patterns.
2009-04-16 Sebastien Pouliot <sebastien@ximian.com>
* MoonIsolatedStorage.cs: New. Manage the shared (location, quota)
information about Moonlight isolated storage.
* MoonIsolatedStorageFile.cs: Adjust with new MoonIsolatedStorage.
Implement IncreaseQuotaTo UI.
* MoonIsolatedStorageFileStream.cs: Adjust with MoonIsolatedStorage.
2009-04-16 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFile.cs: Fix thread-safety issue at creation time.
[Fix bug #431039]
* IsolatedStorageFileStream.cs: Fix missing path check in Verify.
[Fix bug #487659]
2008-12-23 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFile.cs: Use Url as the default evidence type when
null is supplied.
[Fix bug #430932]
2008-09-11 Sebastien Pouliot <sebastien@ximian.com>
* MoonIsolatedStorageFile.cs: Add application and iste specific
initialization. Add rumenditary quota support (not thread or cross
process safe). Add a bunch of TODO & FIXME.
* MoonIsolatedStorageFileStream.cs: Add quota checks (delegated
into MoonIsolatedStorageFile).
2008-09-05 Sebastien Pouliot <sebastien@ximian.com>
* MoonIsolatedStorageFile.cs: Add calls to PreCheck inside EndRead
and EndWrite methods.
* MoonIsolatedStorageFileStream.cs: Throw an IsolatedStorageException
when DeleteFile is called on an unexisting file.
2008-08-22 Sebastien Pouliot <sebastien@ximian.com>
* MoonIsolatedStorageFile.cs: Implement Remove. Add a bunch of FIXME
mostly related to quota.
* MoonIsolatedStorageFileStream.cs: Add a call to the container's
PreCheck method in most methods. Add FIXME for quota.
2008-08-21 Sebastien Pouliot <sebastien@ximian.com>
* MoonIsolatedStorageFile.cs: Split Application and Site storage.
Start looking at quota.
* MoonIsolatedStorageFileStream.cs: Added more validation to
ctors. Removed IsAsync (not in beta2). (SetLength) Start using some
quota checks
2008-08-20 Sebastien Pouliot <sebastien@ximian.com>
* MoonIsolatedStorageFile.cs: More fixes to match unit tests.
2008-08-20 Sebastien Pouliot <sebastien@ximian.com>
* MoonIsolatedStorageFile.cs: Fix API to match SL2 beta2. Start
implementing new feature (while writing unit tests).
* MoonIsolatedStorageFileStream.cs: Add new async methods [Begin|
End][Read|Write] present in b2. Fix endless recursion in WriteByte.
2008-04-18 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFile.cs: Fix CreateDirectory to accept multiple
subdirectories. Avoid leaking full path in DeleteDirectory. Fix
GetDirectoryNames to work with path (and the search pattern).
[Fix bug #376188]
2008-03-28 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFile.cs: Don't show the full path on exception if a
directory can't be created (fix bug #354539). Also fix path/patterns when
looking for files (it behave differently than DirectoryInfo does).
2008-01-17 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFile.cs: Fix bug #354539
2007-12-18 Stephane Delcroix <sdelcroix@novell.com>
* IsolatedStorageFileEnumerator.cs: Ifdef'ing out too. Fixes the build.
2007-12-18 Miguel de Icaza <miguel@novell.com>
* Ifdef out the large bodies of code that will just not work with
Silverlight, ran into this problem again trying to run
http://fluxtools.net/emailphotos
Its not worth trying to alter this implementation of
IsolatedStorage to work in both the regular and the Moonlight
profiles, instead am going to write a simple implementation while
we wait for the real 2.0 API to come out.
2007-11-06 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFileStream.cs: Handle rooted paths. Patch by Jay
Miller to fix bug #324983.
2006-04-07 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFile.cs: Loading/saving the identities used to
isolate the storage requires the permission to [de]serialize them too.
2005-11-09 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageScope.cs: Added missing [Serializable] in 2.0 profile
2005-10-04 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFile.cs: Add a call to GC.SuppressFinalize in Dispose
(even if we're not disposing anything).
2005-06-22 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFile.cs: Only assembly evidences are considered to
resolve policy. Changed resolve method used (instead of changing it's
code).
2005-06-14 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFileStream.cs: Remove Close method from NET_2_0.
* IsolatedStorageFile.cs: Implemented missing MaximumSize property
and GetPermission method.
2005-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* IsolatedStorageFileStream.cs: check the FileMode here as FileStream
throws a different exception.
2005-04-25 Sebastien Pouliot <sebastien@ximian.com>
* INormalizeForIsolatedStorage.cs: Added [ComVisible(true)] for 2.0.
* IsolatedStorage.cs: Added [ComVisible(true)] for 2.0 except for new
property ApplicationIdentity.
* IsolatedStorageException.cs: Added [ComVisible(true)] for 2.0.
* IsolatedStorageFile.cs: Now calls UnprotectedGetEvidence to get the
assembly evidences. Added [ComVisible(true)] for 2.0.
* IsolatedStorageFileStream.cs: Added [ComVisible(true)] for 2.0.
* IsolatedStorageScope.cs: Added [ComVisible(true)] for 2.0.
2005-03-24 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFile.cs: Added an assert for unrestricted file access
to the class. This is "ok" as the user cannot control the base path
for isolated storage but will be updated to be more "precise" when
imperative assert are supported in the runtime.
* IsolatedStorageFileStream.cs: Changed constructors so the assert
for unrestricted file access is limited to constructors (not the whole
class). Added LinkDemand for UnmanagedCode to get Handle and
SafeFileHandle (2.0) properties.
2005-03-17 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageScope.cs: Add missing BOOTSTRAP_NET_2_0 to new enum
values. Fix #73046.
* IsolatedStorageFile.cs: Remove commented security attributes.
2005-03-15 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorageFile.cs: Added CAS demands (imperative when possible)
for IsolatedStoragePermission. The security attributes for NET_2_0 are
commented until #73046 is fixed.
* IsolatedStorageFileStream.cs: Now use StackFrame(2) to find which
assembly is really calling the IsolatedStorageFileStream when no
default is supplied. Throw DirectoryNotFoundException when a directory
inside the isolated storage is missing.
2005-01-31 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorage.cs: Added checks to get identities.
* IsolatedStorageFile.cs: Added support for identities (assembly,
domain and, for 2.0, application).
* IsolatedStorageFileEnumerator.cs: New. Internal enumerator for
IsolatedStorageFile.
* IsolatedStorageFileStream.cs: Now use the new FileStream
constructor to ensure filestream name stays [Unknown].
* IsolatedStorageInfo.cs: Removed (no more required).
* IsolatedStorageScope.cs: Added new 2.0 scopes: Application and
Machine.
2004-07-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* IsolatedStorageInfo.cs: useGetFolderPath instead of getting "HOME".
2004-06-13 Gert Driesen <drieseng@users.sourceforge.net>
* IsolatedStorage.cs: really mark the storage_scope field private
2004-06-09 Gert Dresen <drieseng@users.sourceforge.net>
* IsolatedStorage.cs: use private variable for holding scope,
set scope in InitStore method, removed need for extra protected
member (public API fix)
* IsolatedStorageFile.cs: use InitStore to initialize scope
2004-05-12 Sebastien Pouliot <sebastien@ximian.com>
* IsolatedStorage.cs: More details on MonoTODO. Throw exceptions on
AssemblyIdentity and DomainIdentity properties.
* IsolatedStorageFile.cs: More details on MonoTODO.
* IsolatedStorageFileStream.cs: Removed MonoTODO on class. Now use
Path.Combine to build filenames (constructor) and throw an exception
when we try to get the handle (as documented).
2003-07-30 Duncan Mak <duncan@ximian.com>
* IsolatedStorageInfo.cs (CreateAssemblyFilename):
(CreateDomainFilename): Replace String.Format with Path.Combine.
* IsolatedStorageFile.cs:
(GetStore): Update storage_scope accordingly.
(GetUseStoreForAssembly): Include IsolatedStorageScope.User.
(GetUseStoreForDomain): Include IsolatedStorageScope.User and
IsolatedStorageScope.Assembly.
* IsolatedStorage.cs:
(CurrentSize):
(MaximumSize): throw InvalidOperationExceptions. This is a
subclass responsibility.
(Scope): Implemented using a static field, storage_scope.
(SeparatorInternal)
(SeparatorExternal): Implemented. Use Path.DirectorySeparatorChar
for SeparatorExternal.
2003-02-18 Jonathan Pryor <jonpryor@vt.edu>
* IsolatedStorageFile.cs: Fix spelling error (GetUseStoreForDomain -->
GetUserStoreFor Domain). Reported by
Torsten Rendelmann <torsten.rendelmann@procos.com>.
2003-01-19 Sebastien Pouliot <spouliot@videotron.ca>
* IsolatedStorageFile.cs: Added missing [CLSCompliant(false)]
to CurrentSize and MaximumSize to fix compilation (at least
under Windows/csc).
2003-01-18 Jonathan Pryor <jonpryor@vt.edu>
- General: Get a simple implementation working. Simple, not-all-there, but
sufficient to get "Programming C#" example 21-17 working under Mono. This
doesn't say much, as it's not a stress-test by any means.
* INormalizeForIsolatedStorage.cs: re-indent to fit mono code style
* IsolatedStorage.cs: match mono coding guidelines
* IsolatedStorageFileStream.cs: Add members that "C# In A Nutshell" claims
the class should override. Most of these members just delegate to the
base class, though. CreateIsolatedPath is used to get the actual filename
for the IsolatedStorageFileStream.
* IsolatedStorageScope.cs: Documentation goes in monodoc, so there's no
point in having C# doc-tags. Add "Roaming" member, which "C# In A
Nutshell" lists.
* IsolatedStorageFile.cs: Public class documented in "C# In A Nutshell".
Simple implementation. Will probably need work to conform with .NET,
address security concerns.
* IsolatedStorageInfo.cs: Abstract IsolatedStorage information used by other
classes, such as the directory isolated storage is located under, how to
calculate the size of isolated storage, etc.
2002-02-19 Duncan Mak <duncan@ximian.com>
* IsolatedStorageFileStream.cs: Added MonoTODO here. This class
is completely stubbed out (over the summer) and didn't get
properly MonoTODO'd.
2002-02-08 Duncan Mak <duncan@ximian.com>
* IsolatedStorage.cs: Looked at MemberInfo.cs, another fellow
abstract class. Oh, that's what it means! Removed unnesscessary
MonoTODO attributes.
2002-02-07 Duncan Mak <duncan@ximian.com>
* IsolatedStorage.cs: Added to CVS, stubbed out the API.
* IsolatedStorageException.cs: Implemented.
2002-01-07 Duco Fijma <duco@lorentz.xs4all.nl>
* Created INormalizeForIsolatedStorage

View File

@@ -0,0 +1,41 @@
//
// System.IO.IsolatedStorage.INormalizeForIsolatedStorage
//
// author:
// Duco Fijma (duco@lorentz.xs4all.nl)
//
// (c) 2002 Duco Fijma
// 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.Runtime.InteropServices;
namespace System.IO.IsolatedStorage {
[ComVisible (true)]
public interface INormalizeForIsolatedStorage {
object Normalize ();
}
}

View File

@@ -0,0 +1,193 @@
//
// System.IO.IsolatedStorage.cs
//
// Authors:
// Duncan Mak (duncan@ximian.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 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.Reflection;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
namespace System.IO.IsolatedStorage {
[ComVisible (true)]
public abstract class IsolatedStorage : MarshalByRefObject {
// Constructor
protected IsolatedStorage ()
: base ()
{
}
internal IsolatedStorageScope storage_scope;
internal object _assemblyIdentity;
internal object _domainIdentity;
internal object _applicationIdentity;
// Properties
[MonoTODO ("Does not currently use the manifest support")]
[ComVisible (false)]
public object ApplicationIdentity {
[SecurityPermission (SecurityAction.Demand, ControlPolicy=true)]
get {
if ((storage_scope & IsolatedStorageScope.Application) == 0) {
throw new InvalidOperationException (Locale.GetText ("Invalid Isolation Scope."));
}
if (_applicationIdentity == null)
throw new InvalidOperationException (Locale.GetText ("Identity unavailable."));
throw new NotImplementedException (Locale.GetText ("CAS related"));
}
}
public object AssemblyIdentity {
[SecurityPermission (SecurityAction.Demand, ControlPolicy=true)]
get {
if ((storage_scope & IsolatedStorageScope.Assembly) == 0) {
throw new InvalidOperationException (Locale.GetText ("Invalid Isolation Scope."));
}
if (_assemblyIdentity == null)
throw new InvalidOperationException (Locale.GetText ("Identity unavailable."));
return _assemblyIdentity;
}
}
[CLSCompliant (false)]
#if NET_4_0
[Obsolete]
#endif
public virtual ulong CurrentSize {
get {
throw new InvalidOperationException (
Locale.GetText ("IsolatedStorage does not have a preset CurrentSize."));
}
}
public object DomainIdentity {
[SecurityPermission (SecurityAction.Demand, ControlPolicy=true)]
get {
if ((storage_scope & IsolatedStorageScope.Domain) == 0) {
throw new InvalidOperationException (Locale.GetText ("Invalid Isolation Scope."));
}
if (_domainIdentity == null)
throw new InvalidOperationException (Locale.GetText ("Identity unavailable."));
return _domainIdentity;
}
}
[CLSCompliant (false)]
#if NET_4_0
[Obsolete]
#endif
public virtual ulong MaximumSize {
get {
throw new InvalidOperationException (
Locale.GetText ("IsolatedStorage does not have a preset MaximumSize."));
}
}
public IsolatedStorageScope Scope {
get { return storage_scope; }
}
#if NET_4_0
[ComVisible (false)]
public virtual long AvailableFreeSpace {
get {
throw new InvalidOperationException ("This property is not defined for this store.");
}
}
[ComVisible (false)]
public virtual long Quota {
get {
throw new InvalidOperationException ("This property is not defined for this store.");
}
}
[ComVisible (false)]
public virtual long UsedSize {
get {
throw new InvalidOperationException ("This property is not defined for this store.");
}
}
#endif
protected virtual char SeparatorExternal {
get { return System.IO.Path.DirectorySeparatorChar; }
}
protected virtual char SeparatorInternal {
get { return '.'; }
}
// Methods
protected abstract IsolatedStoragePermission GetPermission (PermissionSet ps);
protected void InitStore (IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
{
// I know it's useless - but it's tested as such...
switch (scope) {
case (IsolatedStorageScope.Assembly | IsolatedStorageScope.User):
case (IsolatedStorageScope.Assembly | IsolatedStorageScope.User | IsolatedStorageScope.Domain):
throw new NotImplementedException (scope.ToString ());
default:
// invalid (incomplete) scope
throw new ArgumentException (scope.ToString ());
}
}
[MonoTODO ("requires manifest support")]
protected void InitStore (IsolatedStorageScope scope, Type appEvidenceType)
{
#if !MOBILE
if (AppDomain.CurrentDomain.ApplicationIdentity == null)
throw new IsolatedStorageException (Locale.GetText ("No ApplicationIdentity available for AppDomain."));
if (appEvidenceType == null) {
// TODO - Choose evidence
}
#endif
// no exception here because this can work without CAS
storage_scope = scope;
}
public abstract void Remove ();
#if NET_4_0
[ComVisible (false)]
public virtual bool IncreaseQuotaTo (long newQuotaSize)
{
return false;
}
#endif
}
}

View File

@@ -0,0 +1,59 @@
//
// System.IO.IsolatedStorage.IsolatedstorageException
//
// Author: Duncan Mak (duncan@ximian.com)
//
// (C) 2002, 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.InteropServices;
using System.Runtime.Serialization;
namespace System.IO.IsolatedStorage
{
[Serializable]
[ComVisible (true)]
public class IsolatedStorageException : Exception
{
public IsolatedStorageException ()
: base (Locale.GetText ("An Isolated storage operation failed."))
{
}
public IsolatedStorageException (string message)
: base (message)
{
}
public IsolatedStorageException (string message, Exception inner)
: base (message, inner)
{
}
protected IsolatedStorageException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,69 @@
//
// System.IO.IsolatedStorage.IsolatedStorageFileEnumerator
//
// Author
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 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;
namespace System.IO.IsolatedStorage {
internal class IsolatedStorageFileEnumerator : IEnumerator {
private IsolatedStorageScope _scope;
private string[] _storages;
private int _pos;
public IsolatedStorageFileEnumerator (IsolatedStorageScope scope, string root)
{
_scope = scope;
// skip application-isolated storages
if (Directory.Exists (root))
_storages = Directory.GetDirectories (root, "d.*");
_pos = -1;
}
public object Current {
get {
if ((_pos < 0) || (_storages == null) || (_pos >= _storages.Length))
return null;
// recreates a IsolatedStorageFile from the file
return new IsolatedStorageFile (_scope, _storages [_pos]);
}
}
public bool MoveNext ()
{
if (_storages == null)
return false;
return (++_pos < _storages.Length);
}
public void Reset ()
{
_pos = -1;
}
}
}

View File

@@ -0,0 +1,257 @@
//
// System.IO.IsolatedStorage.IsolatedStorageFileStream
//
// Authors
// Sean MacIsaac (macisaac@ximian.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2001 Ximian, Inc.
// 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.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
namespace System.IO.IsolatedStorage {
[ComVisible (true)]
public class IsolatedStorageFileStream : FileStream {
[ReflectionPermission (SecurityAction.Assert, TypeInformation = true)]
private static string CreateIsolatedPath (IsolatedStorageFile isf, string path, FileMode mode)
{
if (path == null)
throw new ArgumentNullException ("path");
if (!Enum.IsDefined (typeof (FileMode), mode))
throw new ArgumentException ("mode");
if (isf == null) {
// we can't call GetUserStoreForDomain here because it depends on
// Assembly.GetCallingAssembly (), which would be our constructor,
// i.e. the result would always be mscorlib.dll. So we need to do
// a small stack walk to find who's calling the constructor
isf = IsolatedStorageFile.GetStore (IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly,
#if MOBILE
null, null);
#else
IsolatedStorageFile.GetDomainIdentityFromEvidence (AppDomain.CurrentDomain.Evidence),
IsolatedStorageFile.GetAssemblyIdentityFromEvidence (new StackFrame (3).GetMethod ().ReflectedType.Assembly.UnprotectedGetEvidence ())); // skip self and constructor
#endif
}
#if NET_4_0
if (isf.IsDisposed)
throw new ObjectDisposedException ("IsolatedStorageFile");
if (isf.IsClosed)
throw new InvalidOperationException ("Storage needs to be open for this operation.");
#endif
// ensure that the _root_ isolated storage can be (and is) created.
FileInfo fi = new FileInfo (isf.Root);
if (!fi.Directory.Exists)
fi.Directory.Create ();
// remove the root path character(s) if they exist
if (Path.IsPathRooted (path)) {
string root = Path.GetPathRoot (path);
path = path.Remove (0, root.Length);
}
// other directories (provided by 'path') must already exists
string file = Path.Combine (isf.Root, path);
string full = Path.GetFullPath (file);
full = Path.GetFullPath (file);
if (!full.StartsWith (isf.Root))
throw new IsolatedStorageException ();
fi = new FileInfo (file);
if (!fi.Directory.Exists) {
// don't leak the path information for isolated storage
string msg = Locale.GetText ("Could not find a part of the path \"{0}\".");
throw new DirectoryNotFoundException (String.Format (msg, path));
}
// FIXME: this is probably a good place to Assert our security
// needs (once Mono supports imperative security stack modifiers)
return file;
}
public IsolatedStorageFileStream (string path, FileMode mode)
: this (path, mode, (mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), FileShare.Read, DefaultBufferSize, null)
{
}
public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access)
: this (path, mode, access, access == FileAccess.Write ? FileShare.None : FileShare.Read, DefaultBufferSize, null)
{
}
public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access, FileShare share)
: this (path, mode, access, share, DefaultBufferSize, null)
{
}
public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize)
: this (path, mode, access, share, bufferSize, null)
{
}
// FIXME: Further limit the assertion when imperative Assert is implemented
[FileIOPermission (SecurityAction.Assert, Unrestricted = true)]
public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, IsolatedStorageFile isf)
: base (CreateIsolatedPath (isf, path, mode), mode, access, share, bufferSize, false, true)
{
}
public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access, FileShare share, IsolatedStorageFile isf)
: this (path, mode, access, share, DefaultBufferSize, isf)
{
}
public IsolatedStorageFileStream (string path, FileMode mode, FileAccess access, IsolatedStorageFile isf)
: this (path, mode, access, access == FileAccess.Write ? FileShare.None : FileShare.Read, DefaultBufferSize, isf)
{
}
public IsolatedStorageFileStream (string path, FileMode mode, IsolatedStorageFile isf)
: this (path, mode, (mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), FileShare.Read, DefaultBufferSize, isf)
{
}
public override bool CanRead {
get {return base.CanRead;}
}
public override bool CanSeek {
get {return base.CanSeek;}
}
public override bool CanWrite {
get {return base.CanWrite;}
}
public override SafeFileHandle SafeFileHandle {
[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
get {
throw new IsolatedStorageException (
Locale.GetText ("Information is restricted"));
}
}
[Obsolete ("Use SafeFileHandle - once available")]
public override IntPtr Handle {
[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
get {
throw new IsolatedStorageException (
Locale.GetText ("Information is restricted"));
}
}
public override bool IsAsync {
get {return base.IsAsync;}
}
public override long Length {
get {return base.Length;}
}
public override long Position {
get {return base.Position;}
set {base.Position = value;}
}
public override IAsyncResult BeginRead (byte[] buffer, int offset, int numBytes, AsyncCallback userCallback, object stateObject)
{
return base.BeginRead (buffer, offset, numBytes, userCallback, stateObject);
}
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int numBytes, AsyncCallback userCallback, object stateObject)
{
return base.BeginWrite (buffer, offset, numBytes, userCallback, stateObject);
}
public override int EndRead (IAsyncResult asyncResult)
{
return base.EndRead (asyncResult);
}
public override void EndWrite (IAsyncResult asyncResult)
{
base.EndWrite (asyncResult);
}
public override void Flush ()
{
base.Flush ();
}
#if NET_4_0
public override void Flush (bool flushToDisk)
{
base.Flush (flushToDisk);
}
#endif
public override int Read (byte[] buffer, int offset, int count)
{
return base.Read (buffer, offset, count);
}
public override int ReadByte ()
{
return base.ReadByte ();
}
public override long Seek (long offset, SeekOrigin origin)
{
return base.Seek (offset, origin);
}
public override void SetLength (long value)
{
base.SetLength (value);
}
public override void Write (byte[] buffer, int offset, int count)
{
base.Write (buffer, offset, count);
}
public override void WriteByte (byte value)
{
base.WriteByte (value);
}
protected override void Dispose (bool disposing)
{
base.Dispose (disposing);
}
}
}

View File

@@ -0,0 +1,53 @@
// IsolatedStorageScope.cs
//
// This code was automatically generated from
// ECMA CLI XML Library Specification.
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
// Created: Wed, 5 Sep 2001 06:41:21 UTC
// Source file: all.xml
// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
//
// (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.Runtime.InteropServices;
namespace System.IO.IsolatedStorage {
[Flags]
[ComVisible (true)]
[Serializable]
public enum IsolatedStorageScope {
None = 0,
User = 1,
Domain = 2,
Assembly = 4,
// Documented in "C# In A Nutshell"
Roaming = 8,
Machine = 16,
Application = 32
}
}

View File

@@ -0,0 +1,39 @@
//
// System.IO.IsolatedStorage.IsolatedStorageSecurityOptions
//
// Author:
// Carlos Alberto Cortez <calberto.cortez@gmail.com>
//
// Copyright (C) 2010 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.
//
#if NET_4_0
namespace System.IO.IsolatedStorage
{
public enum IsolatedStorageSecurityOptions
{
IncreaseQuotaForApplication = 4
}
}
#endif

View File

@@ -0,0 +1,69 @@
//
// System.IO.IsolatedStorage.IsolatedStorageSecurityState
//
// Author:
// Carlos Alberto Cortez <calberto.cortez@gmail.com>
//
// Copyright (C) 2010 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.Security;
#if NET_4_0
namespace System.IO.IsolatedStorage
{
public class IsolatedStorageSecurityState : SecurityState {
internal IsolatedStorageSecurityState ()
{
}
public IsolatedStorageSecurityOptions Options {
get {
return IsolatedStorageSecurityOptions.IncreaseQuotaForApplication;
}
}
public long Quota {
get {
throw new NotImplementedException ();
}
set {
}
}
public long UsedSize {
get {
throw new NotImplementedException ();
}
}
public override void EnsureState ()
{
throw new NotImplementedException ();
}
}
}
#endif