Exemple #1
0
        public override bool Unlink(string path, StreamUnlinkOptions options, StreamContext context)
        {
            Debug.Assert(path != null);
            Debug.Assert(Path.IsPathRooted(path));

            try
            {
                File.Delete(path);
                return(true);
            }
            catch (DirectoryNotFoundException)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_unlink_file_not_found, FileSystemUtils.StripPassword(path));
            }
            catch (UnauthorizedAccessException)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_file_access_denied, FileSystemUtils.StripPassword(path));
            }
            catch (IOException e)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_unlink_io_error, FileSystemUtils.StripPassword(path), PhpException.ToErrorMessage(e.Message));
            }
            catch (Exception)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_unlink_error, FileSystemUtils.StripPassword(path));
            }

            return(false);
        }
Exemple #2
0
 /// <remarks>
 /// <seealso cref="StreamUnlinkOptions"/> for the list of additional options.
 /// </remarks>
 public virtual bool Unlink(string path, StreamUnlinkOptions options, StreamContext context)
 {
     // int (*unlink)(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC);
     PhpException.Throw(PhpError.Warning, ErrResources.wrapper_op_unsupported, "Unlink");
     return(false);
 }
Exemple #3
0
        public override bool Unlink(string path, StreamUnlinkOptions options, StreamContext context)
        {
            Debug.Assert(path != null);
            Debug.Assert(Path.IsPathRooted(path));

            try
            {
                File.Delete(path);
                return true;
            }
            catch (DirectoryNotFoundException)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_unlink_file_not_found, FileSystemUtils.StripPassword(path));
            }
            catch (UnauthorizedAccessException)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_file_access_denied, FileSystemUtils.StripPassword(path));
            }
            catch (IOException e)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_unlink_io_error, FileSystemUtils.StripPassword(path), PhpException.ToErrorMessage(e.Message));
            }
            catch (System.Exception)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_unlink_error, FileSystemUtils.StripPassword(path));
            }

            return false;
        }
Exemple #4
0
 /// <include file='Doc/Wrappers.xml' path='docs/method[@name="Unlink"]/*'/>
 public override bool Unlink(string path, StreamUnlinkOptions options, StreamContext context)
 {
     return(proxy.Unlink(path, (int)options, null));
 }
Exemple #5
0
 /// <remarks>
 /// <seealso cref="StreamUnlinkOptions"/> for the list of additional options.
 /// </remarks>
 public virtual bool Unlink(string path, StreamUnlinkOptions options, StreamContext context)
 {
     // int (*unlink)(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); 
     PhpException.Throw(PhpError.Warning, ErrResources.wrapper_op_unsupported, "Unlink");
     return false;
 }