Pchp.Library.Streams.FileStreamWrapper.Rename C# (CSharp) Method

Rename() public method

public Rename ( string fromPath, string toPath, StreamRenameOptions options, StreamContext context ) : bool
fromPath string
toPath string
options StreamRenameOptions
context StreamContext
return bool
        public override bool Rename(string fromPath, string toPath, StreamRenameOptions options, StreamContext context)
        {
            try
            {
                File.Move(fromPath, toPath);
                return true;
            }
            catch (UnauthorizedAccessException)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_file_access_denied, FileSystemUtils.StripPassword(fromPath));
            }
            catch (IOException)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_rename_file_exists, FileSystemUtils.StripPassword(fromPath), FileSystemUtils.StripPassword(toPath));
            }
            catch (System.Exception e)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_error, FileSystemUtils.StripPassword(fromPath), e.Message);
            }
            return false;
        }