Skip to content

Commit e7ff062

Browse files
committed
Remove redundant this qualifier, and fixes general warnings.
1 parent 0986ba8 commit e7ff062

File tree

132 files changed

+1171
-1171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1171
-1171
lines changed

Renci.SshClient/Renci.SshNet/AuthenticationMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected AuthenticationMethod(string username)
3737
if (username.IsNullOrWhiteSpace())
3838
throw new ArgumentException("username");
3939

40-
this.Username = username;
40+
Username = username;
4141
}
4242

4343
/// <summary>

Renci.SshClient/Renci.SshNet/Channels/ChannelDirectTcpip.NET40.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ internal partial class ChannelDirectTcpip
99
{
1010
partial void InternalSocketReceive(byte[] buffer, ref int read)
1111
{
12-
read = this._socket.Receive(buffer);
12+
read = _socket.Receive(buffer);
1313
}
1414

1515
partial void InternalSocketSend(byte[] data)

Renci.SshClient/Renci.SshNet/Channels/ChannelForwardedTcpip.NET40.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ internal partial class ChannelForwardedTcpip
1010
{
1111
partial void OpenSocket(IPEndPoint remoteEndpoint)
1212
{
13-
this._socket = new Socket(remoteEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
14-
this._socket.Connect(remoteEndpoint);
15-
this._socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1);
13+
_socket = new Socket(remoteEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
14+
_socket.Connect(remoteEndpoint);
15+
_socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1);
1616
}
1717

1818
partial void InternalSocketReceive(byte[] buffer, ref int read)
1919
{
20-
read = this._socket.Receive(buffer);
20+
read = _socket.Receive(buffer);
2121
}
2222

2323
partial void InternalSocketSend(byte[] data)
2424
{
25-
this._socket.Send(data);
25+
_socket.Send(data);
2626
}
2727
}
2828
}

Renci.SshClient/Renci.SshNet/CipherInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public class CipherInfo
2929
/// <param name="cipher">The cipher.</param>
3030
public CipherInfo(int keySize, Func<byte[], byte[], Cipher> cipher)
3131
{
32-
this.KeySize = keySize;
33-
this.Cipher = (key, iv) => (cipher(key.Take(this.KeySize / 8).ToArray(), iv));
32+
KeySize = keySize;
33+
Cipher = (key, iv) => (cipher(key.Take(KeySize / 8).ToArray(), iv));
3434
}
3535
}
3636
}

Renci.SshClient/Renci.SshNet/Common/ASCIIEncoding.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ public class ASCIIEncoding : Encoding
99
{
1010
private readonly char _fallbackChar;
1111

12-
private static readonly char[] _byteToChar;
12+
private static readonly char[] ByteToChar;
1313

1414
static ASCIIEncoding()
1515
{
16-
if (_byteToChar == null)
16+
if (ByteToChar == null)
1717
{
18-
_byteToChar = new char[128];
18+
ByteToChar = new char[128];
1919
var ch = '\0';
2020
for (byte i = 0; i < 128; i++)
2121
{
22-
_byteToChar[i] = ch++;
22+
ByteToChar[i] = ch++;
2323
}
2424
}
2525
}
@@ -29,7 +29,7 @@ static ASCIIEncoding()
2929
/// </summary>
3030
public ASCIIEncoding()
3131
{
32-
this._fallbackChar = '?';
32+
_fallbackChar = '?';
3333
}
3434

3535
/// <summary>
@@ -76,12 +76,12 @@ public override int GetByteCount(char[] chars, int index, int count)
7676
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback"/> is set to <see cref="T:System.Text.EncoderExceptionFallback"/>.</exception>
7777
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
7878
{
79-
for (int i = 0; i < charCount && i < chars.Length; i++)
79+
for (var i = 0; i < charCount && i < chars.Length; i++)
8080
{
8181
var b = (byte)chars[i + charIndex];
8282

8383
if (b > 127)
84-
b = (byte)this._fallbackChar;
84+
b = (byte) _fallbackChar;
8585

8686
bytes[i + byteIndex] = b;
8787
}
@@ -132,18 +132,18 @@ public override int GetCharCount(byte[] bytes, int index, int count)
132132
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback"/> is set to <see cref="T:System.Text.DecoderExceptionFallback"/>.</exception>
133133
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
134134
{
135-
for (int i = 0; i < byteCount; i++)
135+
for (var i = 0; i < byteCount; i++)
136136
{
137137
var b = bytes[i + byteIndex];
138138
char ch;
139139

140140
if (b > 127)
141141
{
142-
ch = this._fallbackChar;
142+
ch = _fallbackChar;
143143
}
144144
else
145145
{
146-
ch = _byteToChar[b];
146+
ch = ByteToChar[b];
147147
}
148148

149149
chars[i + charIndex] = ch;

Renci.SshClient/Renci.SshNet/Common/AsyncResult.cs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ public abstract class AsyncResult : IAsyncResult
1414
private readonly Object _asyncState;
1515

1616
// Field set at construction which do change after operation completes
17-
private const Int32 _statePending = 0;
17+
private const Int32 StatePending = 0;
1818

19-
private const Int32 _stateCompletedSynchronously = 1;
19+
private const Int32 StateCompletedSynchronously = 1;
2020

21-
private const Int32 _stateCompletedAsynchronously = 2;
21+
private const Int32 StateCompletedAsynchronously = 2;
2222

23-
private Int32 _completedState = _statePending;
23+
private Int32 _completedState = StatePending;
2424

2525
// Field that may or may not get set depending on usage
2626
private ManualResetEvent _asyncWaitHandle;
@@ -41,10 +41,10 @@ public abstract class AsyncResult : IAsyncResult
4141
/// </summary>
4242
/// <param name="asyncCallback">The async callback.</param>
4343
/// <param name="state">The state.</param>
44-
public AsyncResult(AsyncCallback asyncCallback, Object state)
44+
protected AsyncResult(AsyncCallback asyncCallback, Object state)
4545
{
46-
this._asyncCallback = asyncCallback;
47-
this._asyncState = state;
46+
_asyncCallback = asyncCallback;
47+
_asyncState = state;
4848
}
4949

5050
/// <summary>
@@ -55,21 +55,21 @@ public AsyncResult(AsyncCallback asyncCallback, Object state)
5555
public void SetAsCompleted(Exception exception, Boolean completedSynchronously)
5656
{
5757
// Passing null for exception means no error occurred; this is the common case
58-
this._exception = exception;
58+
_exception = exception;
5959

6060
// The m_CompletedState field MUST be set prior calling the callback
61-
Int32 prevState = Interlocked.Exchange(ref this._completedState,
62-
completedSynchronously ? _stateCompletedSynchronously : _stateCompletedAsynchronously);
63-
if (prevState != _statePending)
61+
var prevState = Interlocked.Exchange(ref _completedState,
62+
completedSynchronously ? StateCompletedSynchronously : StateCompletedAsynchronously);
63+
if (prevState != StatePending)
6464
throw new InvalidOperationException("You can set a result only once");
6565

6666
// If the event exists, set it
67-
if (this._asyncWaitHandle != null)
68-
this._asyncWaitHandle.Set();
67+
if (_asyncWaitHandle != null)
68+
_asyncWaitHandle.Set();
6969

7070
// If a callback method was set, call it
71-
if (this._asyncCallback != null)
72-
this._asyncCallback(this);
71+
if (_asyncCallback != null)
72+
_asyncCallback(this);
7373
}
7474

7575
/// <summary>
@@ -78,19 +78,19 @@ public void SetAsCompleted(Exception exception, Boolean completedSynchronously)
7878
public void EndInvoke()
7979
{
8080
// This method assumes that only 1 thread calls EndInvoke for this object
81-
if (!this.IsCompleted)
81+
if (!IsCompleted)
8282
{
8383
// If the operation isn't done, wait for it
8484
AsyncWaitHandle.WaitOne();
8585
AsyncWaitHandle.Close();
86-
this._asyncWaitHandle = null; // Allow early GC
86+
_asyncWaitHandle = null; // Allow early GC
8787
}
8888

89-
this.EndInvokeCalled = true;
89+
EndInvokeCalled = true;
9090

9191
// Operation is done: if an exception occurred, throw it
92-
if (this._exception != null)
93-
throw new SshException(this._exception.Message, this._exception);
92+
if (_exception != null)
93+
throw new SshException(_exception.Message, _exception);
9494
}
9595

9696
#region Implementation of IAsyncResult
@@ -99,15 +99,15 @@ public void EndInvoke()
9999
/// Gets a user-defined object that qualifies or contains information about an asynchronous operation.
100100
/// </summary>
101101
/// <returns>A user-defined object that qualifies or contains information about an asynchronous operation.</returns>
102-
public Object AsyncState { get { return this._asyncState; } }
102+
public Object AsyncState { get { return _asyncState; } }
103103

104104
/// <summary>
105105
/// Gets a value that indicates whether the asynchronous operation completed synchronously.
106106
/// </summary>
107107
/// <returns>true if the asynchronous operation completed synchronously; otherwise, false.</returns>
108108
public Boolean CompletedSynchronously
109109
{
110-
get { return this._completedState == _stateCompletedSynchronously; }
110+
get { return _completedState == StateCompletedSynchronously; }
111111
}
112112

113113
/// <summary>
@@ -118,26 +118,26 @@ public WaitHandle AsyncWaitHandle
118118
{
119119
get
120120
{
121-
if (this._asyncWaitHandle == null)
121+
if (_asyncWaitHandle == null)
122122
{
123-
var done = this.IsCompleted;
123+
var done = IsCompleted;
124124
var mre = new ManualResetEvent(done);
125-
if (Interlocked.CompareExchange(ref this._asyncWaitHandle, mre, null) != null)
125+
if (Interlocked.CompareExchange(ref _asyncWaitHandle, mre, null) != null)
126126
{
127127
// Another thread created this object's event; dispose the event we just created
128128
mre.Close();
129129
}
130130
else
131131
{
132-
if (!done && this.IsCompleted)
132+
if (!done && IsCompleted)
133133
{
134134
// If the operation wasn't done when we created
135135
// the event but now it is done, set the event
136-
this._asyncWaitHandle.Set();
136+
_asyncWaitHandle.Set();
137137
}
138138
}
139139
}
140-
return this._asyncWaitHandle;
140+
return _asyncWaitHandle;
141141
}
142142
}
143143

@@ -147,7 +147,7 @@ public WaitHandle AsyncWaitHandle
147147
/// <returns>true if the operation is complete; otherwise, false.</returns>
148148
public Boolean IsCompleted
149149
{
150-
get { return this._completedState != _statePending; }
150+
get { return _completedState != StatePending; }
151151
}
152152
#endregion
153153
}
@@ -159,7 +159,7 @@ public Boolean IsCompleted
159159
public abstract class AsyncResult<TResult> : AsyncResult
160160
{
161161
// Field set when operation completes
162-
private TResult _result = default(TResult);
162+
private TResult _result;
163163

164164
/// <summary>
165165
/// Initializes a new instance of the <see cref="AsyncResult&lt;TResult&gt;"/> class.
@@ -179,7 +179,7 @@ public AsyncResult(AsyncCallback asyncCallback, Object state)
179179
public void SetAsCompleted(TResult result, Boolean completedSynchronously)
180180
{
181181
// Save the asynchronous operation's result
182-
this._result = result;
182+
_result = result;
183183

184184
// Tell the base class that the operation completed successfully (no exception)
185185
base.SetAsCompleted(null, completedSynchronously);

Renci.SshClient/Renci.SshNet/Common/AuthenticationBannerEventArgs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public class AuthenticationBannerEventArgs : AuthenticationEventArgs
2424
public AuthenticationBannerEventArgs(string username, string message, string language)
2525
: base(username)
2626
{
27-
this.BannerMessage = message;
28-
this.Language = language;
27+
BannerMessage = message;
28+
Language = language;
2929
}
3030
}
3131
}

Renci.SshClient/Renci.SshNet/Common/AuthenticationEventArgs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public abstract class AuthenticationEventArgs : EventArgs
1616
/// Initializes a new instance of the <see cref="AuthenticationEventArgs"/> class.
1717
/// </summary>
1818
/// <param name="username">The username.</param>
19-
public AuthenticationEventArgs(string username)
19+
protected AuthenticationEventArgs(string username)
2020
{
21-
this.Username = username;
21+
Username = username;
2222
}
2323
}
2424
}

Renci.SshClient/Renci.SshNet/Common/AuthenticationPrompt.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ public class AuthenticationPrompt
3939
/// <param name="request">The request.</param>
4040
public AuthenticationPrompt(int id, bool isEchoed, string request)
4141
{
42-
this.Id = id;
43-
this.IsEchoed = isEchoed;
44-
this.Request = request;
42+
Id = id;
43+
IsEchoed = isEchoed;
44+
Request = request;
4545
}
4646
}
4747
}

Renci.SshClient/Renci.SshNet/Common/AuthenticationPromptEventArgs.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public class AuthenticationPromptEventArgs : AuthenticationEventArgs
3232
public AuthenticationPromptEventArgs(string username, string instruction, string language, IEnumerable<AuthenticationPrompt> prompts)
3333
: base(username)
3434
{
35-
this.Instruction = instruction;
36-
this.Language = language;
37-
this.Prompts = prompts;
35+
Instruction = instruction;
36+
Language = language;
37+
Prompts = prompts;
3838
}
3939
}
4040
}

0 commit comments

Comments
 (0)