Browse Source

Remove redundant this qualifier.

Gert Driesen 11 years ago
parent
commit
e1abcd2a08
1 changed files with 114 additions and 114 deletions
  1. 114 114
      Renci.SshClient/Renci.SshNet/SftpClient.cs

+ 114 - 114
Renci.SshClient/Renci.SshNet/SftpClient.cs

@@ -14,10 +14,10 @@ namespace Renci.SshNet
     /// <summary>
     /// Implementation of the SSH File Transfer Protocol (SFTP) over SSH.
     /// </summary>
-    public partial class SftpClient : BaseClient
+    public partial class SftpClient
     {
         /// <summary>
-        /// Holds the <see cref="SftpSession"/> instance that used to communicate to the
+        /// Holds the <see cref="SftpSession"/> instance that is used to communicate to the
         /// SFTP server.
         /// </summary>
         private SftpSession _sftpSession;
@@ -211,8 +211,8 @@ namespace Renci.SshNet
         private SftpClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo)
             : base(connectionInfo, ownsConnectionInfo)
         {
-            this.OperationTimeout = new TimeSpan(0, 0, 0, 0, -1);
-            this.BufferSize = 1024 * 64;
+            OperationTimeout = new TimeSpan(0, 0, 0, 0, -1);
+            BufferSize = 1024 * 64;
         }
 
         #endregion
@@ -234,10 +234,10 @@ namespace Renci.SshNet
             if (path == null)
                 throw new ArgumentNullException("path");
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            this._sftpSession.ChangeDirectory(path);
+            _sftpSession.ChangeDirectory(path);
         }
 
         /// <summary>
@@ -253,7 +253,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void ChangePermissions(string path, short mode)
         {
-            var file = this.Get(path);
+            var file = Get(path);
             file.SetPermissions(mode);
         }
 
@@ -273,12 +273,12 @@ namespace Renci.SshNet
             if (path.IsNullOrWhiteSpace())
                 throw new ArgumentException(path);
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
-            this._sftpSession.RequestMkDir(fullPath);
+            _sftpSession.RequestMkDir(fullPath);
         }
 
         /// <summary>
@@ -298,12 +298,12 @@ namespace Renci.SshNet
             if (path.IsNullOrWhiteSpace())
                 throw new ArgumentException("path");
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
-            this._sftpSession.RequestRmDir(fullPath);
+            _sftpSession.RequestRmDir(fullPath);
         }
 
         /// <summary>
@@ -323,12 +323,12 @@ namespace Renci.SshNet
             if (path.IsNullOrWhiteSpace())
                 throw new ArgumentException("path");
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
-            this._sftpSession.RequestRemove(fullPath);
+            _sftpSession.RequestRemove(fullPath);
         }
 
         /// <summary>
@@ -343,7 +343,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void RenameFile(string oldPath, string newPath)
         {
-            this.RenameFile(oldPath, newPath, false);
+            RenameFile(oldPath, newPath, false);
         }
 
         /// <summary>
@@ -367,20 +367,20 @@ namespace Renci.SshNet
             if (newPath == null)
                 throw new ArgumentNullException("newPath");
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var oldFullPath = this._sftpSession.GetCanonicalPath(oldPath);
+            var oldFullPath = _sftpSession.GetCanonicalPath(oldPath);
 
-            var newFullPath = this._sftpSession.GetCanonicalPath(newPath);
+            var newFullPath = _sftpSession.GetCanonicalPath(newPath);
 
             if (isPosix)
             {
-                this._sftpSession.RequestPosixRename(oldFullPath, newFullPath);
+                _sftpSession.RequestPosixRename(oldFullPath, newFullPath);
             }
             else
             {
-                this._sftpSession.RequestRename(oldFullPath, newFullPath);
+                _sftpSession.RequestRename(oldFullPath, newFullPath);
             }
         }
 
@@ -404,14 +404,14 @@ namespace Renci.SshNet
             if (linkPath.IsNullOrWhiteSpace())
                 throw new ArgumentException("linkPath");
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
-            var linkFullPath = this._sftpSession.GetCanonicalPath(linkPath);
+            var linkFullPath = _sftpSession.GetCanonicalPath(linkPath);
 
-            this._sftpSession.RequestSymLink(fullPath, linkFullPath);
+            _sftpSession.RequestSymLink(fullPath, linkFullPath);
         }
 
         /// <summary>
@@ -451,11 +451,11 @@ namespace Renci.SshNet
 
             var asyncResult = new SftpListDirectoryAsyncResult(asyncCallback, state);
 
-            this.ExecuteThread(() =>
+            ExecuteThread(() =>
             {
                 try
                 {
-                    var result = this.InternalListDirectory(path, count =>
+                    var result = InternalListDirectory(path, count =>
                     {
                         asyncResult.Update(count);
 
@@ -511,14 +511,14 @@ namespace Renci.SshNet
             if (path == null)
                 throw new ArgumentNullException("path");
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
-            var attributes = this._sftpSession.RequestLStat(fullPath);
+            var attributes = _sftpSession.RequestLStat(fullPath);
 
-            return new SftpFile(this._sftpSession, fullPath, attributes);
+            return new SftpFile(_sftpSession, fullPath, attributes);
         }
 
         /// <summary>
@@ -538,10 +538,10 @@ namespace Renci.SshNet
             if (path.IsNullOrWhiteSpace())
                 throw new ArgumentException("path");
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
             // using SSH_FXP_REALPATH is not an alternative the SFTP specification has not always
             // been clear on how the server should respond when the specified path is not present
@@ -590,7 +590,7 @@ namespace Renci.SshNet
         {
             CheckDisposed();
 
-            this.InternalDownloadFile(path, output, null, downloadCallback);
+            InternalDownloadFile(path, output, null, downloadCallback);
         }
 
         /// <summary>
@@ -612,7 +612,7 @@ namespace Renci.SshNet
         /// </remarks>
         public IAsyncResult BeginDownloadFile(string path, Stream output)
         {
-            return this.BeginDownloadFile(path, output, null, null, null);
+            return BeginDownloadFile(path, output, null, null);
         }
 
         /// <summary>
@@ -635,7 +635,7 @@ namespace Renci.SshNet
         /// </remarks>
         public IAsyncResult BeginDownloadFile(string path, Stream output, AsyncCallback asyncCallback)
         {
-            return this.BeginDownloadFile(path, output, asyncCallback, null, null);
+            return BeginDownloadFile(path, output, asyncCallback, null);
         }
 
         /// <summary>
@@ -670,11 +670,11 @@ namespace Renci.SshNet
 
             var asyncResult = new SftpDownloadAsyncResult(asyncCallback, state);
 
-            this.ExecuteThread(() =>
+            ExecuteThread(() =>
             {
                 try
                 {
-                    this.InternalDownloadFile(path, output, asyncResult, offset =>
+                    InternalDownloadFile(path, output, asyncResult, offset =>
                     {
                         asyncResult.Update(offset);
 
@@ -728,7 +728,7 @@ namespace Renci.SshNet
         /// </remarks>
         public void UploadFile(Stream input, string path, Action<ulong> uploadCallback = null)
         {
-            this.UploadFile(input, path, true, uploadCallback);
+            UploadFile(input, path, true, uploadCallback);
         }
 
         /// <summary>
@@ -758,7 +758,7 @@ namespace Renci.SshNet
             else
                 flags |= Flags.CreateNew;
 
-            this.InternalUploadFile(input, path, flags, null, uploadCallback);
+            InternalUploadFile(input, path, flags, null, uploadCallback);
         }
 
         /// <summary>
@@ -780,7 +780,7 @@ namespace Renci.SshNet
         /// </remarks>
         public IAsyncResult BeginUploadFile(Stream input, string path)
         {
-            return this.BeginUploadFile(input, path, true, null, null, null);
+            return BeginUploadFile(input, path, true, null, null);
         }
 
         /// <summary>
@@ -803,7 +803,7 @@ namespace Renci.SshNet
         /// </remarks>
         public IAsyncResult BeginUploadFile(Stream input, string path, AsyncCallback asyncCallback)
         {
-            return this.BeginUploadFile(input, path, true, asyncCallback, null, null);
+            return BeginUploadFile(input, path, true, asyncCallback, null);
         }
 
         /// <summary>
@@ -828,7 +828,7 @@ namespace Renci.SshNet
         /// </remarks>
         public IAsyncResult BeginUploadFile(Stream input, string path, AsyncCallback asyncCallback, object state, Action<ulong> uploadCallback = null)
         {
-            return this.BeginUploadFile(input, path, true, asyncCallback, state, uploadCallback);
+            return BeginUploadFile(input, path, true, asyncCallback, state, uploadCallback);
         }
 
         /// <summary>
@@ -871,11 +871,11 @@ namespace Renci.SshNet
 
             var asyncResult = new SftpUploadAsyncResult(asyncCallback, state);
 
-            this.ExecuteThread(() =>
+            ExecuteThread(() =>
             {
                 try
                 {
-                    this.InternalUploadFile(input, path, flags, asyncResult, offset =>
+                    InternalUploadFile(input, path, flags, asyncResult, offset =>
                     {
                         asyncResult.Update(offset);
 
@@ -929,12 +929,12 @@ namespace Renci.SshNet
             if (path == null)
                 throw new ArgumentNullException("path");
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
-            return this._sftpSession.RequestStatVfs(fullPath);
+            return _sftpSession.RequestStatVfs(fullPath);
         }
 
         #region File Methods
@@ -953,7 +953,7 @@ namespace Renci.SshNet
             if (contents == null)
                 throw new ArgumentNullException("contents");
 
-            using (var stream = this.AppendText(path))
+            using (var stream = AppendText(path))
             {
                 foreach (var line in contents)
                 {
@@ -977,7 +977,7 @@ namespace Renci.SshNet
             if (contents == null)
                 throw new ArgumentNullException("contents");
 
-            using (var stream = this.AppendText(path, encoding))
+            using (var stream = AppendText(path, encoding))
             {
                 foreach (var line in contents)
                 {
@@ -996,7 +996,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void AppendAllText(string path, string contents)
         {
-            using (var stream = this.AppendText(path))
+            using (var stream = AppendText(path))
             {
                 stream.Write(contents);
             }
@@ -1013,7 +1013,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void AppendAllText(string path, string contents, Encoding encoding)
         {
-            using (var stream = this.AppendText(path, encoding))
+            using (var stream = AppendText(path, encoding))
             {
                 stream.Write(contents);
             }
@@ -1028,7 +1028,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public StreamWriter AppendText(string path)
         {
-            return this.AppendText(path, Encoding.UTF8);
+            return AppendText(path, Encoding.UTF8);
         }
 
         /// <summary>
@@ -1048,7 +1048,7 @@ namespace Renci.SshNet
             if (encoding == null)
                 throw new ArgumentNullException("encoding");
 
-            return new StreamWriter(new SftpFileStream(this._sftpSession, path, FileMode.Append, FileAccess.Write, (int) _bufferSize), encoding);
+            return new StreamWriter(new SftpFileStream(_sftpSession, path, FileMode.Append, FileAccess.Write, (int) _bufferSize), encoding);
         }
 
         /// <summary>
@@ -1062,7 +1062,7 @@ namespace Renci.SshNet
         {
             CheckDisposed();
 
-            return new SftpFileStream(this._sftpSession, path, FileMode.Create, FileAccess.ReadWrite, (int) _bufferSize);
+            return new SftpFileStream(_sftpSession, path, FileMode.Create, FileAccess.ReadWrite, (int) _bufferSize);
         }
 
         /// <summary>
@@ -1077,7 +1077,7 @@ namespace Renci.SshNet
         {
             CheckDisposed();
 
-            return new SftpFileStream(this._sftpSession, path, FileMode.Create, FileAccess.ReadWrite, bufferSize);
+            return new SftpFileStream(_sftpSession, path, FileMode.Create, FileAccess.ReadWrite, bufferSize);
         }
 
         /// <summary>
@@ -1104,7 +1104,7 @@ namespace Renci.SshNet
         {
             CheckDisposed();
 
-            return new StreamWriter(this.OpenWrite(path), encoding);
+            return new StreamWriter(OpenWrite(path), encoding);
         }
 
         /// <summary>
@@ -1117,7 +1117,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void Delete(string path)
         {
-            var file = this.Get(path);
+            var file = Get(path);
             file.Delete();
         }
 
@@ -1131,7 +1131,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public DateTime GetLastAccessTime(string path)
         {
-            var file = this.Get(path);
+            var file = Get(path);
             return file.LastAccessTime;
         }
 
@@ -1159,7 +1159,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public DateTime GetLastWriteTime(string path)
         {
-            var file = this.Get(path);
+            var file = Get(path);
             return file.LastWriteTime;
         }
 
@@ -1203,7 +1203,7 @@ namespace Renci.SshNet
         {
             CheckDisposed();
 
-            return new SftpFileStream(this._sftpSession, path, mode, access, (int) _bufferSize);
+            return new SftpFileStream(_sftpSession, path, mode, access, (int) _bufferSize);
         }
 
         /// <summary>
@@ -1227,7 +1227,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public StreamReader OpenText(string path)
         {
-            return new StreamReader(this.OpenRead(path), Encoding.UTF8);
+            return new StreamReader(OpenRead(path), Encoding.UTF8);
         }
 
         /// <summary>
@@ -1241,7 +1241,7 @@ namespace Renci.SshNet
         {
             CheckDisposed();
 
-            return new SftpFileStream(this._sftpSession, path, FileMode.OpenOrCreate, FileAccess.Write,
+            return new SftpFileStream(_sftpSession, path, FileMode.OpenOrCreate, FileAccess.Write,
                 (int) _bufferSize);
         }
 
@@ -1254,7 +1254,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public byte[] ReadAllBytes(string path)
         {
-            using (var stream = this.OpenRead(path))
+            using (var stream = OpenRead(path))
             {
                 var buffer = new byte[stream.Length];
                 stream.Read(buffer, 0, buffer.Length);
@@ -1271,7 +1271,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public string[] ReadAllLines(string path)
         {
-            return this.ReadAllLines(path, Encoding.UTF8);
+            return ReadAllLines(path, Encoding.UTF8);
         }
 
         /// <summary>
@@ -1285,7 +1285,7 @@ namespace Renci.SshNet
         public string[] ReadAllLines(string path, Encoding encoding)
         {
             var lines = new List<string>();
-            using (var stream = new StreamReader(this.OpenRead(path), encoding))
+            using (var stream = new StreamReader(OpenRead(path), encoding))
             {
                 while (!stream.EndOfStream)
                 {
@@ -1304,7 +1304,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public string ReadAllText(string path)
         {
-            return this.ReadAllText(path, Encoding.UTF8);
+            return ReadAllText(path, Encoding.UTF8);
         }
 
         /// <summary>
@@ -1317,7 +1317,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public string ReadAllText(string path, Encoding encoding)
         {
-            using (var stream = new StreamReader(this.OpenRead(path), encoding))
+            using (var stream = new StreamReader(OpenRead(path), encoding))
             {
                 return stream.ReadToEnd();
             }
@@ -1332,7 +1332,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public IEnumerable<string> ReadLines(string path)
         {
-            return this.ReadAllLines(path);
+            return ReadAllLines(path);
         }
 
         /// <summary>
@@ -1345,7 +1345,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public IEnumerable<string> ReadLines(string path, Encoding encoding)
         {
-            return this.ReadAllLines(path, encoding);
+            return ReadAllLines(path, encoding);
         }
 
         /// <summary>
@@ -1401,7 +1401,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void WriteAllBytes(string path, byte[] bytes)
         {
-            using (var stream = this.OpenWrite(path))
+            using (var stream = OpenWrite(path))
             {
                 stream.Write(bytes, 0, bytes.Length);
             }
@@ -1416,7 +1416,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void WriteAllLines(string path, IEnumerable<string> contents)
         {
-            this.WriteAllLines(path, contents, Encoding.UTF8);
+            WriteAllLines(path, contents, Encoding.UTF8);
         }
 
         /// <summary>
@@ -1428,7 +1428,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void WriteAllLines(string path, string[] contents)
         {
-            this.WriteAllLines(path, contents, Encoding.UTF8);
+            WriteAllLines(path, contents, Encoding.UTF8);
         }
 
         /// <summary>
@@ -1441,7 +1441,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void WriteAllLines(string path, IEnumerable<string> contents, Encoding encoding)
         {
-            using (var stream = this.CreateText(path, encoding))
+            using (var stream = CreateText(path, encoding))
             {
                 foreach (var line in contents)
                 {
@@ -1460,7 +1460,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void WriteAllLines(string path, string[] contents, Encoding encoding)
         {
-            using (var stream = this.CreateText(path, encoding))
+            using (var stream = CreateText(path, encoding))
             {
                 foreach (var line in contents)
                 {
@@ -1478,7 +1478,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void WriteAllText(string path, string contents)
         {
-            using (var stream = this.CreateText(path))
+            using (var stream = CreateText(path))
             {
                 stream.Write(contents);
             }
@@ -1494,7 +1494,7 @@ namespace Renci.SshNet
         /// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
         public void WriteAllText(string path, string contents, Encoding encoding)
         {
-            using (var stream = this.CreateText(path, encoding))
+            using (var stream = CreateText(path, encoding))
             {
                 stream.Write(contents);
             }
@@ -1512,12 +1512,12 @@ namespace Renci.SshNet
         {
             CheckDisposed();
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
-            return this._sftpSession.RequestLStat(fullPath);
+            return _sftpSession.RequestLStat(fullPath);
         }
 
         /// <summary>
@@ -1531,12 +1531,12 @@ namespace Renci.SshNet
         {
             CheckDisposed();
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
-            this._sftpSession.RequestSetStat(fullPath, fileAttributes);
+            _sftpSession.RequestSetStat(fullPath, fileAttributes);
         }
 
         // Please don't forget this when you implement these methods: <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
@@ -1564,12 +1564,12 @@ namespace Renci.SshNet
             if (path == null)
                 throw new ArgumentNullException("path");
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
-            var handle = this._sftpSession.RequestOpenDir(fullPath);
+            var handle = _sftpSession.RequestOpenDir(fullPath);
 
             var basePath = fullPath;
 
@@ -1578,24 +1578,24 @@ namespace Renci.SshNet
 
             var result = new List<SftpFile>();
 
-            var files = this._sftpSession.RequestReadDir(handle);
+            var files = _sftpSession.RequestReadDir(handle);
 
             while (files != null)
             {
                 result.AddRange(from f in files
-                                select new SftpFile(this._sftpSession, string.Format(CultureInfo.InvariantCulture, "{0}{1}", basePath, f.Key), f.Value));
+                                select new SftpFile(_sftpSession, string.Format(CultureInfo.InvariantCulture, "{0}{1}", basePath, f.Key), f.Value));
 
                 //  Call callback to report number of files read
                 if (listCallback != null)
                 {
                     //  Execute callback on different thread
-                    this.ExecuteThread(() => listCallback(result.Count));
+                    ExecuteThread(() => listCallback(result.Count));
                 }
 
-                files = this._sftpSession.RequestReadDir(handle);
+                files = _sftpSession.RequestReadDir(handle);
             }
 
-            this._sftpSession.RequestClose(handle);
+            _sftpSession.RequestClose(handle);
 
             return result;
         }
@@ -1618,18 +1618,18 @@ namespace Renci.SshNet
             if (path.IsNullOrWhiteSpace())
                 throw new ArgumentException("path");
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
-            var handle = this._sftpSession.RequestOpen(fullPath, Flags.Read);
+            var handle = _sftpSession.RequestOpen(fullPath, Flags.Read);
 
             ulong offset = 0;
 
             var optimalReadLength = _sftpSession.CalculateOptimalReadLength(_bufferSize);
 
-            var data = this._sftpSession.RequestRead(handle, offset, optimalReadLength);
+            var data = _sftpSession.RequestRead(handle, offset, optimalReadLength);
 
             //  Read data while available
             while (data.Length > 0)
@@ -1648,13 +1648,13 @@ namespace Renci.SshNet
                 if (downloadCallback != null)
                 {
                     //  Execute callback on different thread
-                    this.ExecuteThread(() => { downloadCallback(offset); });
+                    ExecuteThread(() => { downloadCallback(offset); });
                 }
 
-                data = this._sftpSession.RequestRead(handle, offset, optimalReadLength);
+                data = _sftpSession.RequestRead(handle, offset, optimalReadLength);
             }
 
-            this._sftpSession.RequestClose(handle);
+            _sftpSession.RequestClose(handle);
         }
 
         /// <summary>
@@ -1676,12 +1676,12 @@ namespace Renci.SshNet
             if (path.IsNullOrWhiteSpace())
                 throw new ArgumentException("path");
 
-            if (this._sftpSession == null)
+            if (_sftpSession == null)
                 throw new SshConnectionException("Client not connected.");
 
-            var fullPath = this._sftpSession.GetCanonicalPath(path);
+            var fullPath = _sftpSession.GetCanonicalPath(path);
 
-            var handle = this._sftpSession.RequestOpen(fullPath, flags);
+            var handle = _sftpSession.RequestOpen(fullPath, flags);
 
             ulong offset = 0;
 
@@ -1709,7 +1709,7 @@ namespace Renci.SshNet
                     }
 
                     var writtenBytes = offset + (ulong)buffer.Length;
-                    this._sftpSession.RequestWrite(handle, offset, buffer, null, s =>
+                    _sftpSession.RequestWrite(handle, offset, buffer, null, s =>
                     {
                         if (s.StatusCode == StatusCodes.Ok)
                         {
@@ -1720,7 +1720,7 @@ namespace Renci.SshNet
                             if (uploadCallback != null)
                             {
                                 //  Execute callback on different thread
-                                this.ExecuteThread(() => uploadCallback(writtenBytes));
+                                ExecuteThread(() => uploadCallback(writtenBytes));
                             }
                         }
                     });
@@ -1733,11 +1733,11 @@ namespace Renci.SshNet
                 else if (expectedResponses > 0)
                 {
                     //  Wait for expectedResponses to change
-                    this._sftpSession.WaitOnHandle(responseReceivedWaitHandle, this.OperationTimeout);
+                    _sftpSession.WaitOnHandle(responseReceivedWaitHandle, OperationTimeout);
                 }
             } while (expectedResponses > 0 || bytesRead > 0);
 
-            this._sftpSession.RequestClose(handle);
+            _sftpSession.RequestClose(handle);
         }
 
         partial void ExecuteThread(Action action);
@@ -1749,8 +1749,8 @@ namespace Renci.SshNet
         {
             base.OnConnected();
 
-            this._sftpSession = new SftpSession(this.Session, this.OperationTimeout, this.ConnectionInfo.Encoding);
-            this._sftpSession.Connect();
+            _sftpSession = new SftpSession(Session, OperationTimeout, ConnectionInfo.Encoding);
+            _sftpSession.Connect();
         }
 
         /// <summary>
@@ -1765,9 +1765,9 @@ namespace Renci.SshNet
             // on each connect
             if (_sftpSession != null)
             {
-                this._sftpSession.Disconnect();
-                this._sftpSession.Dispose();
-                this._sftpSession = null;
+                _sftpSession.Disconnect();
+                _sftpSession.Dispose();
+                _sftpSession = null;
             }
         }
 
@@ -1777,10 +1777,10 @@ namespace Renci.SshNet
         /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged ResourceMessages.</param>
         protected override void Dispose(bool disposing)
         {
-            if (this._sftpSession != null)
+            if (_sftpSession != null)
             {
-                this._sftpSession.Dispose();
-                this._sftpSession = null;
+                _sftpSession.Dispose();
+                _sftpSession = null;
             }
 
             base.Dispose(disposing);