dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO/IsolatedStorage INo


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO/IsolatedStorage INormalizeForIsolatedStorage.cs,NONE,1.1 IsolatedStorage.cs,NONE,1.1 IsolatedStorageException.cs,NONE,1.1 IsolatedStorageFile.cs,NONE,1.1IsolatedStorageFileStream.cs,NONE,1.1 IsolatedStorageScope.cs,NONE,1.1 Makefile,NONE,1.1
Date: Sat, 19 Apr 2003 00:03:06 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/IsolatedStorage
In directory subversions:/tmp/cvs-serv10170/runtime/System/IO/IsolatedStorage

Added Files:
        INormalizeForIsolatedStorage.cs IsolatedStorage.cs 
        IsolatedStorageException.cs IsolatedStorageFile.cs 
        IsolatedStorageFileStream.cs IsolatedStorageScope.cs Makefile 
Log Message:


Add various missing classes.


--- NEW FILE ---
/*
 * INormalizeForIsolatedStorage.cs - Implementation of the
 *              "System.IO.IsolatedStorage.INormalizeForIsolatedStorage" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.IO.IsolatedStorage
{

#if !ECMA_COMPAT

public interface INormalizeForIsolatedStorage
{
        Object Normalize();

}; // interface INormalizeForIsolatedStorage

#endif // !ECMA_COMPAT

}; // namespace System.IO.IsolatedStorage

--- NEW FILE ---
/*
 * IsolatedStorage.cs - Implementation of the
 *              "System.IO.IsolatedStorage.IsolatedStorage" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.IO.IsolatedStorage
{

#if !ECMA_COMPAT

using System.Security;
using System.Security.Permissions;

public abstract class IsolatedStorage : MarshalByRefObject
{
        // Internal state.
        private IsolatedStorageScope scope;

        // Constructor.
        protected IsolatedStorage() {}

        // Get the current amount of space that has be used.
        [TODO]
        [CLSCompliant(false)]
        public virtual ulong CurrentSize
                        {
                                get
                                {
                                        // TODO
                                        return 0;
                                }
                        }

        // Get the assembly identity for this isolated storage object.
        [TODO]
        public Object AssemblyIdentity
                        {
                                get
                                {
                                        // TODO
                                        return null;
                                }
                        }

        // Get the domain identity for this isolated storage object.
        [TODO]
        public Object DomainIdentity
                        {
                                get
                                {
                                        // TODO
                                        return null;
                                }
                        }

        // Get the maximum amount of space that can be used.
        [TODO]
        [CLSCompliant(false)]
        public virtual ulong MaximumSize
                        {
                                get
                                {
                                        // TODO
                                        return 0;
                                }
                        }

        // Get the internal path separator.
        protected virtual char SeparatorInternal
                        {
                                get
                                {
                                        return '.';
                                }
                        }

        // Get the external path separator.
        protected virtual char SeparatorExternal
                        {
                                get
                                {
                                        return Path.DirectorySeparatorChar;
                                }
                        }

        // Get the scope of this storage object.
        public IsolatedStorageScope Scope
                        {
                                get
                                {
                                        return scope;
                                }
                        }

        // Get isolated storage permission information from a permission set.
        protected abstract IsolatedStoragePermission
                        GetPermission(PermissionSet ps);

        // Initialise this storage object.
        [TODO]
        protected void InitStore(IsolatedStorageScope scope,
                                                         Type 
domainEvidenceType,
                                                         Type 
assemblyEvidenceType)
                        {
                                // TODO
                                this.scope = scope;
                        }

        // Remove this isolated storage object.
        public abstract void Remove();

}; // class IsolatedStorage

#endif // !ECMA_COMPAT

}; // namespace System.IO.IsolatedStorage

--- NEW FILE ---
/*
 * IsolatedStorageException.cs - Implementation of the
 *                      "System.Reflection.IsolatedStorageException" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.IO.IsolatedStorage
{

#if !ECMA_COMPAT

using System;
using System.Runtime.Serialization;

public class IsolatedStorageException : Exception
{

        // Constructors.
        public IsolatedStorageException()
                : base(_("Exception_IsolatedStorage")) {}
        public IsolatedStorageException(String msg)
                : base(msg) {}
        public IsolatedStorageException(String msg, Exception inner)
                : base(msg, inner) {}
        protected IsolatedStorageException(SerializationInfo info,
                                                                           
StreamingContext context)
                : base(info, context) {}

        // Get the default message to use for this exception type.
        internal override String MessageDefault
                        {
                                get
                                {
                                        return _("Exception_IsolatedStorage");
                                }
                        }

        // Get the default HResult value for this type of exception.
        internal override uint HResultDefault
                        {
                                get
                                {
                                        return 0x80131450;
                                }
                        }

}; // class IsolatedStorageException

#endif // !ECMA_COMPAT

}; // namespace System.IO.IsolatedStorage

--- NEW FILE ---
/*
 * IsolatedStorageFile.cs - Implementation of the
 *              "System.IO.IsolatedStorage.IsolatedStorageFile" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.IO.IsolatedStorage
{

#if !ECMA_COMPAT

using System.Collections;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;

public sealed class IsolatedStorageFile : IsolatedStorage, IDisposable
{
        // Constructor.
        internal IsolatedStorageFile() {}

        // Destructor.
        ~IsolatedStorageFile()
                        {
                                Close();
                        }

        // Get the current amount of space that has be used.
        [TODO]
        [CLSCompliant(false)]
        public override ulong CurrentSize
                        {
                                get
                                {
                                        // TODO
                                        return 0;
                                }
                        }

        // Get the maximum amount of space that can be used.
        [TODO]
        [CLSCompliant(false)]
        public override ulong MaximumSize
                        {
                                get
                                {
                                        // TODO
                                        return base.MaximumSize;
                                }
                        }

        // Close this storage area.
        [TODO]
        public void Close()
                        {
                                // TODO
                        }

        // Create a directory within this storage area.
        [TODO]
        public void CreateDirectory(String dir)
                        {
                                // TODO
                        }

        // Delete a file from this storage area.
        [TODO]
        public void Delete(String file)
                        {
                                // TODO
                        }

        // Delete a directory from this storage area.
        [TODO]
        public void DeleteDirectory(String dir)
                        {
                                // TODO
                        }

        // Dispose this storage area.
        public void Dispose()
                        {
                                Close();
                        }

        // Get a list of directories from a storage area directory.
        [TODO]
        public String[] GetDirectoryNames(String searchPattern)
                        {
                                // TODO
                                return null;
                        }

        // Get a list of files from a storage area directory.
        [TODO]
        public String[] GetFileNames(String searchPattern)
                        {
                                // TODO
                                return null;
                        }

        // Get isolated storage permission information from a permission set.
        protected override IsolatedStoragePermission
                                GetPermission(PermissionSet ps)
                        {
                                if(ps == null)
                                {
                                        return null;
                                }
                                else if(ps.IsUnrestricted())
                                {
                                        return new IsolatedStorageFilePermission
                                                (PermissionState.Unrestricted);
                                }
                                else
                                {
                                        return (IsolatedStoragePermission)
                                          
(ps.GetPermission(typeof(IsolatedStorageFilePermission)));
                                }
                        }

        // Get an isolated storage area.
        [TODO]
        public static IsolatedStorageFile GetStore
                                (IsolatedStorage scope, Object domainIdentity,
                                 Object assemblyIdentity)
                        {
                                // TODO
                                return null;
                        }
        [TODO]
        public static IsolatedStorageFile GetStore
                                (IsolatedStorage scope, Type domainEvidenceType,
                                 Type assemblyEvidenceType)
                        {
                                // TODO
                                return null;
                        }
        [TODO]
        public static IsolatedStorageFile GetStore
                                (IsolatedStorage scope, Evidence domainEvidence,
                                 Type domainEvidenceType, Evidence 
assemblyEvidence,
                                 Type assemblyEvidenceType)
                        {
                                // TODO
                                return null;
                        }

        // Get the user storage area for the current assembly.
        [TODO]
        public static IsolatedStorageFile GetUserStoreForAssembly()
                        {
                                // TODO
                                return null;
                        }

        // Get the user storage area for the current domain.
        [TODO]
        public static IsolatedStorageFile GetUserStoreForDomain()
                        {
                                // TODO
                                return null;
                        }

        // Remove this isolated storage object.
        [TODO]
        public override void Remove()
                        {
                                // TODO
                        }

        // Remove all stores of a particular type.
        [TODO]
        public static void Remove(IsolatedStorageScope scope)
                        {
                                // TODO
                        }

        // Enumerate all storage areas of a particular type.
        [TODO]
        public static IEnumerator GetEnumerator(IsolatedStorageScope scope)
                        {
                                // TODO
                                return null;
                        }

        // Get the base directory for this isolated storage area.
        internal String BaseDirectory
                        {
                                get
                                {
                                        // TODO
                                        return null;
                                }
                        }

}; // class IsolatedStorageFile

#endif // !ECMA_COMPAT

}; // namespace System.IO.IsolatedStorage

--- NEW FILE ---
/*
 * IsolatedStorageFileStream.cs - Implementation of the
 *              "System.IO.IsolatedStorage.IsolatedStorageFileStream" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.IO.IsolatedStorage
{

#if !ECMA_COMPAT

using System.IO;
using System.Security.Permissions;

public class IsolatedStorageFileStream : FileStream
{
        // Internal state.
        private FileStream realStream;
        private IsolatedStorageFile storeToClose;

        // Constructors.
        public IsolatedStorageFileStream(String path, FileMode mode)
                        : this(path, mode, (mode == FileMode.Append
                                                                        ? 
FileAccess.Write
                                                                        : 
FileAccess.ReadWrite),
                                   FileShare.None, BUFSIZ, null)
                        {
                                // Nothing to do here.
                        }
        public IsolatedStorageFileStream(String path, FileMode mode,
                                                                         
IsolatedStorageFile sf)
                        : this(path, mode, (mode == FileMode.Append
                                                                        ? 
FileAccess.Write
                                                                        : 
FileAccess.ReadWrite),
                                   FileShare.None, BUFSIZ, sf)
                        {
                                // Nothing to do here.
                        }
        public IsolatedStorageFileStream(String path, FileMode mode,
                                                                         
FileAccess access)
                        : this(path, mode, access, FileShare.None, BUFSIZ, null)
                        {
                                // Nothing to do here.
                        }
        public IsolatedStorageFileStream(String path, FileMode mode,
                                                                         
FileAccess access,
                                                                         
IsolatedStorageFile sf)
                        : this(path, mode, access, FileShare.None, BUFSIZ, sf)
                        {
                                // Nothing to do here.
                        }
        public IsolatedStorageFileStream(String path, FileMode mode,
                                                                         
FileAccess access, FileShare share)
                        : this(path, mode, access, share, BUFSIZ, null)
                        {
                                // Nothing to do here.
                        }
        public IsolatedStorageFileStream(String path, FileMode mode,
                                                                         
FileAccess access, FileShare share,
                                                                         
IsolatedStorageFile sf)
                        : this(path, mode, access, share, BUFSIZ, sf)
                        {
                                // Nothing to do here.
                        }
        public IsolatedStorageFileStream(String path, FileMode mode,
                                                                         
FileAccess access, FileShare share,
                                                                         int 
bufferSize)
                        : this(path, mode, access, share, bufferSize, null)
                        {
                                // Nothing to do here.
                        }
        public IsolatedStorageFileStream(String path, FileMode mode,
                                                                         
FileAccess access, FileShare share,
                                                                         int 
bufferSize,
                                                                         
IsolatedStorageFile sf)
                        {
                                // Validate the parameters.
                                if(path == null)
                                {
                                        throw new ArgumentNullException("path");
                                }
                                if(sf == null)
                                {
                                        sf = 
IsolatedStorageFile.GetUserStoreForDomain();
                                        storeToClose = sf;
                                }

                                // Get the base directory for the isolated 
storage area.
                                String baseDir = sf.BaseDirectory;

                                // Assert that we have permission to do this.
                                (new FileIOPermission
                                        (FileIOPermissionAccess.AllAccess, 
baseDir)).Assert();

                                // Open the real stream.
                                realStream = new FileStream
                                        (baseDir + Path.DirectorySeparatorChar 
+ path,
                                         mode, access, share, bufferSize, 
false);
                        }

        // Properties.
        public override bool CanRead
                        {
                                get
                                {
                                        return realStream.CanRead;
                                }
                        }
        public override bool CanSeek
                        {
                                get
                                {
                                        return realStream.CanSeek;
                                }
                        }
        public override bool CanWrite
                        {
                                get
                                {
                                        return realStream.CanWrite;
                                }
                        }
        public override IntPtr Handle
                        {
                                get
                                {
                                        // Cannot get isolated storage file 
handles.
                                        throw new IsolatedStorageException
                                                
(_("Exception_IsolatedStorage"));
                                }
                        }
        public override bool IsAsync
                        {
                                get
                                {
                                        return realStream.IsAsync;
                                }
                        }
        public override long Length
                        {
                                get
                                {
                                        return realStream.Length;
                                }
                        }
        public override long Position
                        {
                                get
                                {
                                        return realStream.Position;
                                }
                                set
                                {
                                        realStream.Position = value;
                                }
                        }

        // Begin an asynchronous read operation.
        public override IAsyncResult BeginRead
                                (byte[] buffer, int offset, int numBytes,
                                 AsyncCallback userCallback, Object stateObject)
                        {
                                return realStream.BeginRead
                                        (buffer, offset, numBytes, 
userCallback, stateObject);
                        }

        // Begin an asynchronous write operation.
        public override IAsyncResult BeginWrite
                                (byte[] buffer, int offset, int numBytes,
                                 AsyncCallback userCallback, Object stateObject)
                        {
                                return realStream.BeginWrite
                                        (buffer, offset, numBytes, 
userCallback, stateObject);
                        }

        // Close this stream.
        public override void Close()
                        {
                                Dispose(true);
                                GC.SuppressFinalize(this);
                        }

        // Dispose of this stream.
        protected override void Dispose(bool disposing)
                        {
                                realStream.Close();
                                if(storeToClose != null)
                                {
                                        storeToClose.Close();
                                }
                                base.Dispose(disposing);
                        }

        // End an asynchronous read operation.
        public override int EndRead(IAsyncResult asyncResult)
                        {
                                return realStream.EndRead(asyncResult);
                        }

        // End an asynchronous write operation
        public override void EndWrite(IAsyncResult asyncResult)
                        {
                                realStream.EndWrite(asyncResult);
                        }

        // Flush this stream.
        public override void Flush()
                        {
                                realStream.Flush();
                        }

        // Read from this stream.
        public override int Read(byte[] buffer, int offset, int count)
                        {
                                return realStream.Read(buffer, offset, count);
                        }

        // Read a byte from this stream.
        public override int ReadByte()
                        {
                                return realStream.ReadByte();
                        }

        // Seek within this stream.
        public override long Seek(long offset, SeekOrigin origin)
                        {
                                return realStream.Seek(offset, origin);
                        }

        // Set the length of this stream.
        public override void SetLength(long value)
                        {
                                realStream.SetLength(value);
                        }

        // Write to this stream.
        public override void Write(byte[] buffer, int offset, int count)
                        {
                                realStream.Write(buffer, offset, count);
                        }

        // Write a byte to this stream.
        public override void WriteByte(byte value)
                        {
                                realStream.WriteByte(value);
                        }

}; // class IsolatedStorageFileStream

#endif // !ECMA_COMPAT

}; // namespace System.IO.IsolatedStorage

--- NEW FILE ---
/*
 * IsolatedStorageScope.cs - Implementation of the
 *              "System.IO.IsolatedStorage.IsolatedStorageScope" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.IO.IsolatedStorage
{

#if !ECMA_COMPAT

[Flags]
[Serializable]
public enum IsolatedStorageScope
{
        None            = 0x0000,
        User            = 0x0001,
        Domain          = 0x0002,
        Assembly        = 0x0004,
        Roaming         = 0x0008

}; // enum IsolatedStorageScope

#endif // !ECMA_COMPAT

}; // namespace System.IO.IsolatedStorage

--- NEW FILE ---

# The build is done in "runtime/System", so cd up and use that Makefile.

all:
        (cd ../..;make)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]