Exemple #1
0
        public virtual void Lock(long position, long length)
        {
            if (handle == MonoIO.InvalidHandle)
            {
                throw new ObjectDisposedException("Stream has been closed");
            }
            if (position < 0)
            {
                throw new ArgumentOutOfRangeException("position must not be negative");
            }
            if (length < 0)
            {
                throw new ArgumentOutOfRangeException("length must not be negative");
            }
            if (handle == MonoIO.InvalidHandle)
            {
                throw new ObjectDisposedException("Stream has been closed");
            }

            MonoIOError error;

            MonoIO.Lock(handle, position, length, out error);
            if (error != MonoIOError.ERROR_SUCCESS)
            {
                // don't leak the path information for isolated storage
                throw MonoIO.GetException(GetSecureFileName(name), error);
            }
        }