Remove redundant this qualifier, and fixes general warnings.

This commit is contained in:
Gert Driesen
2014-11-22 17:11:41 +00:00
parent 0986ba8196
commit e7ff062145
132 changed files with 1170 additions and 1170 deletions
@@ -37,7 +37,7 @@ namespace Renci.SshNet
if (username.IsNullOrWhiteSpace())
throw new ArgumentException("username");
this.Username = username;
Username = username;
}
/// <summary>
@@ -9,7 +9,7 @@ namespace Renci.SshNet.Channels
{
partial void InternalSocketReceive(byte[] buffer, ref int read)
{
read = this._socket.Receive(buffer);
read = _socket.Receive(buffer);
}
partial void InternalSocketSend(byte[] data)
@@ -10,19 +10,19 @@ namespace Renci.SshNet.Channels
{
partial void OpenSocket(IPEndPoint remoteEndpoint)
{
this._socket = new Socket(remoteEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
this._socket.Connect(remoteEndpoint);
this._socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1);
_socket = new Socket(remoteEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
_socket.Connect(remoteEndpoint);
_socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1);
}
partial void InternalSocketReceive(byte[] buffer, ref int read)
{
read = this._socket.Receive(buffer);
read = _socket.Receive(buffer);
}
partial void InternalSocketSend(byte[] data)
{
this._socket.Send(data);
_socket.Send(data);
}
}
}
+2 -2
View File
@@ -29,8 +29,8 @@ namespace Renci.SshNet
/// <param name="cipher">The cipher.</param>
public CipherInfo(int keySize, Func<byte[], byte[], Cipher> cipher)
{
this.KeySize = keySize;
this.Cipher = (key, iv) => (cipher(key.Take(this.KeySize / 8).ToArray(), iv));
KeySize = keySize;
Cipher = (key, iv) => (cipher(key.Take(KeySize / 8).ToArray(), iv));
}
}
}
@@ -9,17 +9,17 @@ namespace Renci.SshNet.Common
{
private readonly char _fallbackChar;
private static readonly char[] _byteToChar;
private static readonly char[] ByteToChar;
static ASCIIEncoding()
{
if (_byteToChar == null)
if (ByteToChar == null)
{
_byteToChar = new char[128];
ByteToChar = new char[128];
var ch = '\0';
for (byte i = 0; i < 128; i++)
{
_byteToChar[i] = ch++;
ByteToChar[i] = ch++;
}
}
}
@@ -29,7 +29,7 @@ namespace Renci.SshNet.Common
/// </summary>
public ASCIIEncoding()
{
this._fallbackChar = '?';
_fallbackChar = '?';
}
/// <summary>
@@ -76,12 +76,12 @@ namespace Renci.SshNet.Common
/// <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>
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
{
for (int i = 0; i < charCount && i < chars.Length; i++)
for (var i = 0; i < charCount && i < chars.Length; i++)
{
var b = (byte)chars[i + charIndex];
if (b > 127)
b = (byte)this._fallbackChar;
b = (byte) _fallbackChar;
bytes[i + byteIndex] = b;
}
@@ -132,18 +132,18 @@ namespace Renci.SshNet.Common
/// <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>
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
{
for (int i = 0; i < byteCount; i++)
for (var i = 0; i < byteCount; i++)
{
var b = bytes[i + byteIndex];
char ch;
if (b > 127)
{
ch = this._fallbackChar;
ch = _fallbackChar;
}
else
{
ch = _byteToChar[b];
ch = ByteToChar[b];
}
chars[i + charIndex] = ch;
@@ -14,13 +14,13 @@ namespace Renci.SshNet.Common
private readonly Object _asyncState;
// Field set at construction which do change after operation completes
private const Int32 _statePending = 0;
private const Int32 StatePending = 0;
private const Int32 _stateCompletedSynchronously = 1;
private const Int32 StateCompletedSynchronously = 1;
private const Int32 _stateCompletedAsynchronously = 2;
private const Int32 StateCompletedAsynchronously = 2;
private Int32 _completedState = _statePending;
private Int32 _completedState = StatePending;
// Field that may or may not get set depending on usage
private ManualResetEvent _asyncWaitHandle;
@@ -41,10 +41,10 @@ namespace Renci.SshNet.Common
/// </summary>
/// <param name="asyncCallback">The async callback.</param>
/// <param name="state">The state.</param>
public AsyncResult(AsyncCallback asyncCallback, Object state)
protected AsyncResult(AsyncCallback asyncCallback, Object state)
{
this._asyncCallback = asyncCallback;
this._asyncState = state;
_asyncCallback = asyncCallback;
_asyncState = state;
}
/// <summary>
@@ -55,21 +55,21 @@ namespace Renci.SshNet.Common
public void SetAsCompleted(Exception exception, Boolean completedSynchronously)
{
// Passing null for exception means no error occurred; this is the common case
this._exception = exception;
_exception = exception;
// The m_CompletedState field MUST be set prior calling the callback
Int32 prevState = Interlocked.Exchange(ref this._completedState,
completedSynchronously ? _stateCompletedSynchronously : _stateCompletedAsynchronously);
if (prevState != _statePending)
var prevState = Interlocked.Exchange(ref _completedState,
completedSynchronously ? StateCompletedSynchronously : StateCompletedAsynchronously);
if (prevState != StatePending)
throw new InvalidOperationException("You can set a result only once");
// If the event exists, set it
if (this._asyncWaitHandle != null)
this._asyncWaitHandle.Set();
if (_asyncWaitHandle != null)
_asyncWaitHandle.Set();
// If a callback method was set, call it
if (this._asyncCallback != null)
this._asyncCallback(this);
if (_asyncCallback != null)
_asyncCallback(this);
}
/// <summary>
@@ -78,19 +78,19 @@ namespace Renci.SshNet.Common
public void EndInvoke()
{
// This method assumes that only 1 thread calls EndInvoke for this object
if (!this.IsCompleted)
if (!IsCompleted)
{
// If the operation isn't done, wait for it
AsyncWaitHandle.WaitOne();
AsyncWaitHandle.Close();
this._asyncWaitHandle = null; // Allow early GC
_asyncWaitHandle = null; // Allow early GC
}
this.EndInvokeCalled = true;
EndInvokeCalled = true;
// Operation is done: if an exception occurred, throw it
if (this._exception != null)
throw new SshException(this._exception.Message, this._exception);
if (_exception != null)
throw new SshException(_exception.Message, _exception);
}
#region Implementation of IAsyncResult
@@ -99,7 +99,7 @@ namespace Renci.SshNet.Common
/// Gets a user-defined object that qualifies or contains information about an asynchronous operation.
/// </summary>
/// <returns>A user-defined object that qualifies or contains information about an asynchronous operation.</returns>
public Object AsyncState { get { return this._asyncState; } }
public Object AsyncState { get { return _asyncState; } }
/// <summary>
/// Gets a value that indicates whether the asynchronous operation completed synchronously.
@@ -107,7 +107,7 @@ namespace Renci.SshNet.Common
/// <returns>true if the asynchronous operation completed synchronously; otherwise, false.</returns>
public Boolean CompletedSynchronously
{
get { return this._completedState == _stateCompletedSynchronously; }
get { return _completedState == StateCompletedSynchronously; }
}
/// <summary>
@@ -118,26 +118,26 @@ namespace Renci.SshNet.Common
{
get
{
if (this._asyncWaitHandle == null)
if (_asyncWaitHandle == null)
{
var done = this.IsCompleted;
var done = IsCompleted;
var mre = new ManualResetEvent(done);
if (Interlocked.CompareExchange(ref this._asyncWaitHandle, mre, null) != null)
if (Interlocked.CompareExchange(ref _asyncWaitHandle, mre, null) != null)
{
// Another thread created this object's event; dispose the event we just created
mre.Close();
}
else
{
if (!done && this.IsCompleted)
if (!done && IsCompleted)
{
// If the operation wasn't done when we created
// the event but now it is done, set the event
this._asyncWaitHandle.Set();
_asyncWaitHandle.Set();
}
}
}
return this._asyncWaitHandle;
return _asyncWaitHandle;
}
}
@@ -147,7 +147,7 @@ namespace Renci.SshNet.Common
/// <returns>true if the operation is complete; otherwise, false.</returns>
public Boolean IsCompleted
{
get { return this._completedState != _statePending; }
get { return _completedState != StatePending; }
}
#endregion
}
@@ -159,7 +159,7 @@ namespace Renci.SshNet.Common
public abstract class AsyncResult<TResult> : AsyncResult
{
// Field set when operation completes
private TResult _result = default(TResult);
private TResult _result;
/// <summary>
/// Initializes a new instance of the <see cref="AsyncResult&lt;TResult&gt;"/> class.
@@ -179,7 +179,7 @@ namespace Renci.SshNet.Common
public void SetAsCompleted(TResult result, Boolean completedSynchronously)
{
// Save the asynchronous operation's result
this._result = result;
_result = result;
// Tell the base class that the operation completed successfully (no exception)
base.SetAsCompleted(null, completedSynchronously);
@@ -24,8 +24,8 @@
public AuthenticationBannerEventArgs(string username, string message, string language)
: base(username)
{
this.BannerMessage = message;
this.Language = language;
BannerMessage = message;
Language = language;
}
}
}
@@ -16,9 +16,9 @@ namespace Renci.SshNet.Common
/// Initializes a new instance of the <see cref="AuthenticationEventArgs"/> class.
/// </summary>
/// <param name="username">The username.</param>
public AuthenticationEventArgs(string username)
protected AuthenticationEventArgs(string username)
{
this.Username = username;
Username = username;
}
}
}
@@ -39,9 +39,9 @@
/// <param name="request">The request.</param>
public AuthenticationPrompt(int id, bool isEchoed, string request)
{
this.Id = id;
this.IsEchoed = isEchoed;
this.Request = request;
Id = id;
IsEchoed = isEchoed;
Request = request;
}
}
}
@@ -32,9 +32,9 @@ namespace Renci.SshNet.Common
public AuthenticationPromptEventArgs(string username, string instruction, string language, IEnumerable<AuthenticationPrompt> prompts)
: base(username)
{
this.Instruction = instruction;
this.Language = language;
this.Prompts = prompts;
Instruction = instruction;
Language = language;
Prompts = prompts;
}
}
}
@@ -23,7 +23,7 @@
public ChannelDataEventArgs(uint channelNumber, byte[] data)
: base(channelNumber)
{
this.Data = data;
Data = data;
}
/// <summary>
@@ -35,7 +35,7 @@
public ChannelDataEventArgs(uint channelNumber, byte[] data, uint dataTypeCode)
: this(channelNumber, data)
{
this.DataTypeCode = dataTypeCode;
DataTypeCode = dataTypeCode;
}
}
}
@@ -18,7 +18,7 @@ namespace Renci.SshNet.Common
/// <param name="channelNumber">The channel number.</param>
public ChannelEventArgs(uint channelNumber)
{
this.ChannelNumber = channelNumber;
ChannelNumber = channelNumber;
}
}
}
@@ -30,9 +30,9 @@
public ChannelOpenFailedEventArgs(uint channelNumber, uint reasonCode, string description, string language)
: base(channelNumber)
{
this.ReasonCode = reasonCode;
this.Description = description;
this.Language = language;
ReasonCode = reasonCode;
Description = description;
Language = language;
}
}
}
@@ -19,7 +19,7 @@ namespace Renci.SshNet.Common
/// <param name="info">Request information.</param>
public ChannelRequestEventArgs(RequestInfo info)
{
this.Info = info;
Info = info;
}
}
}
+65 -65
View File
@@ -9,17 +9,17 @@ namespace Renci.SshNet.Common
/// </summary>
public class DerData
{
private const byte CONSTRUCTED = 0x20;
private const byte Constructed = 0x20;
private const byte BOOLEAN = 0x01;
private const byte INTEGER = 0x02;
private const byte Boolean = 0x01;
private const byte Integer = 0x02;
//private const byte BITSTRING = 0x03;
private const byte OCTETSTRING = 0x04;
private const byte NULL = 0x05;
private const byte OBJECTIDENTIFIER = 0x06;
private const byte Octetstring = 0x04;
private const byte Null = 0x05;
private const byte Objectidentifier = 0x06;
//private const byte EXTERNAL = 0x08;
//private const byte ENUMERATED = 0x0a;
private const byte SEQUENCE = 0x10;
private const byte Sequence = 0x10;
//private const byte SEQUENCEOF = 0x10; // for completeness
//private const byte SET = 0x11;
//private const byte SETOF = 0x11; // for completeness
@@ -55,7 +55,7 @@ namespace Renci.SshNet.Common
{
get
{
return this._readerIndex >= this._lastIndex;
return _readerIndex >= _lastIndex;
}
}
@@ -64,7 +64,7 @@ namespace Renci.SshNet.Common
/// </summary>
public DerData()
{
this._data = new List<byte>();
_data = new List<byte>();
}
/// <summary>
@@ -73,10 +73,10 @@ namespace Renci.SshNet.Common
/// <param name="data">DER encoded data.</param>
public DerData(byte[] data)
{
this._data = new List<byte>(data);
var dataType = this.ReadByte();
var length = this.ReadLength();
this._lastIndex = this._readerIndex + length;
_data = new List<byte>(data);
var dataType = ReadByte();
var length = ReadLength();
_lastIndex = _readerIndex + length;
}
/// <summary>
@@ -85,13 +85,13 @@ namespace Renci.SshNet.Common
/// <returns>DER Encoded array.</returns>
public byte[] Encode()
{
var length = this._data.Count();
var lengthBytes = this.GetLength(length);
var length = _data.Count();
var lengthBytes = GetLength(length);
this._data.InsertRange(0, lengthBytes);
this._data.Insert(0, CONSTRUCTED | SEQUENCE);
_data.InsertRange(0, lengthBytes);
_data.Insert(0, Constructed | Sequence);
return this._data.ToArray();
return _data.ToArray();
}
/// <summary>
@@ -100,13 +100,13 @@ namespace Renci.SshNet.Common
/// <returns>mpint read.</returns>
public BigInteger ReadBigInteger()
{
var type = this.ReadByte();
if (type != INTEGER)
var type = ReadByte();
if (type != Integer)
throw new InvalidOperationException("Invalid data type, INTEGER(02) is expected.");
var length = this.ReadLength();
var length = ReadLength();
var data = this.ReadBytes(length);
var data = ReadBytes(length);
return new BigInteger(data.Reverse().ToArray());
}
@@ -117,20 +117,20 @@ namespace Renci.SshNet.Common
/// <returns>int read.</returns>
public int ReadInteger()
{
var type = this.ReadByte();
if (type != INTEGER)
var type = ReadByte();
if (type != Integer)
throw new InvalidOperationException("Invalid data type, INTEGER(02) is expected.");
var length = this.ReadLength();
var length = ReadLength();
var data = this.ReadBytes(length);
var data = ReadBytes(length);
if (length > 4)
throw new InvalidOperationException("Integer type cannot occupy more then 4 bytes");
var result = 0;
var shift = (length - 1) * 8;
for (int i = 0; i < length; i++)
for (var i = 0; i < length; i++)
{
result |= data[i] << shift;
shift -= 8;
@@ -147,9 +147,9 @@ namespace Renci.SshNet.Common
/// <param name="data">UInt32 data to write.</param>
public void Write(bool data)
{
this._data.Add(BOOLEAN);
this._data.Add(1);
this._data.Add((byte)(data ? 1 : 0));
_data.Add(Boolean);
_data.Add(1);
_data.Add((byte)(data ? 1 : 0));
}
/// <summary>
@@ -159,10 +159,10 @@ namespace Renci.SshNet.Common
public void Write(UInt32 data)
{
var bytes = data.GetBytes();
this._data.Add(INTEGER);
var length = this.GetLength(bytes.Length);
this.WriteBytes(length);
this.WriteBytes(bytes);
_data.Add(Integer);
var length = GetLength(bytes.Length);
WriteBytes(length);
WriteBytes(bytes);
}
/// <summary>
@@ -172,10 +172,10 @@ namespace Renci.SshNet.Common
public void Write(BigInteger data)
{
var bytes = data.ToByteArray().Reverse().ToList();
this._data.Add(INTEGER);
var length = this.GetLength(bytes.Count);
this.WriteBytes(length);
this.WriteBytes(bytes);
_data.Add(Integer);
var length = GetLength(bytes.Count);
WriteBytes(length);
WriteBytes(bytes);
}
/// <summary>
@@ -184,10 +184,10 @@ namespace Renci.SshNet.Common
/// <param name="data">The data.</param>
public void Write(byte[] data)
{
this._data.Add(OCTETSTRING);
var length = this.GetLength(data.Length);
this.WriteBytes(length);
this.WriteBytes(data);
_data.Add(Octetstring);
var length = GetLength(data.Length);
WriteBytes(length);
WriteBytes(data);
}
/// <summary>
@@ -212,23 +212,23 @@ namespace Renci.SshNet.Common
{
buffer[bufferIndex] = current;
if (bufferIndex < buffer.Length - 1)
buffer[bufferIndex] |= (byte)0x80;
buffer[bufferIndex] |= 0x80;
item >>= 7;
current = (byte)(item & 0x7F);
bufferIndex--;
}
while (current > 0);
for (int i = bufferIndex + 1; i < buffer.Length; i++)
for (var i = bufferIndex + 1; i < buffer.Length; i++)
{
bytes.Add(buffer[i]);
}
}
this._data.Add(OBJECTIDENTIFIER);
var length = this.GetLength(bytes.Count);
this.WriteBytes(length);
this.WriteBytes(bytes);
_data.Add(Objectidentifier);
var length = GetLength(bytes.Count);
WriteBytes(length);
WriteBytes(bytes);
}
/// <summary>
@@ -236,8 +236,8 @@ namespace Renci.SshNet.Common
/// </summary>
public void WriteNull()
{
this._data.Add(NULL);
this._data.Add(0);
_data.Add(Null);
_data.Add(0);
}
/// <summary>
@@ -247,15 +247,15 @@ namespace Renci.SshNet.Common
public void Write(DerData data)
{
var bytes = data.Encode();
this._data.AddRange(bytes);
_data.AddRange(bytes);
}
private byte[] GetLength(int length)
private static IEnumerable<byte> GetLength(int length)
{
if (length > 127)
{
int size = 1;
int val = length;
var size = 1;
var val = length;
while ((val >>= 8) != 0)
size++;
@@ -270,12 +270,12 @@ namespace Renci.SshNet.Common
return data;
}
return new byte[] { (byte)length };
return new[] {(byte) length};
}
private int ReadLength()
{
int length = this.ReadByte();
int length = ReadByte();
if (length == 0x80)
{
@@ -284,16 +284,16 @@ namespace Renci.SshNet.Common
if (length > 127)
{
int size = length & 0x7f;
var size = length & 0x7f;
// Note: The invalid long form "0xff" (see X.690 8.1.3.5c) will be caught here
if (size > 4)
throw new InvalidOperationException(string.Format("DER length is '{0}' and cannot be more than 4 bytes.", size));
length = 0;
for (int i = 0; i < size; i++)
for (var i = 0; i < size; i++)
{
int next = this.ReadByte();
int next = ReadByte();
length = (length << 8) + next;
}
@@ -310,25 +310,25 @@ namespace Renci.SshNet.Common
private void WriteBytes(IEnumerable<byte> data)
{
this._data.AddRange(data);
_data.AddRange(data);
}
private byte ReadByte()
{
if (this._readerIndex > this._data.Count)
if (_readerIndex > _data.Count)
throw new InvalidOperationException("Read out of boundaries.");
return this._data[this._readerIndex++];
return _data[_readerIndex++];
}
private byte[] ReadBytes(int length)
{
if (this._readerIndex + length > this._data.Count)
if (_readerIndex + length > _data.Count)
throw new InvalidOperationException("Read out of boundaries.");
var result = new byte[length];
this._data.CopyTo(this._readerIndex, result, 0, length);
this._readerIndex += length;
_data.CopyTo(_readerIndex, result, 0, length);
_readerIndex += length;
return result;
}
}
@@ -18,7 +18,7 @@ namespace Renci.SshNet.Common
/// <param name="exception">An System.Exception that represents the error that occurred.</param>
public ExceptionEventArgs(Exception exception)
{
this.Exception = exception;
Exception = exception;
}
}
}
@@ -2,12 +2,12 @@ using System.Linq;
using System.Net;
using System.Net.Sockets;
namespace Renci.SshNet
namespace Renci.SshNet.Common
{
/// <summary>
/// Collection of different extension method specific for .NET 4.0
/// </summary>
public static partial class Extensions
internal static partial class Extensions
{
/// <summary>
/// Determines whether [is null or white space] [the specified value].
@@ -1,16 +1,15 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Net;
namespace Renci.SshNet
namespace Renci.SshNet.Common
{
/// <summary>
/// Collection of different extension method
/// </summary>
public static partial class Extensions
internal static partial class Extensions
{
/// <summary>
/// Checks whether a collection is the same as another collection
@@ -34,8 +33,8 @@ namespace Renci.SshNet
var enumerator1 = value.GetEnumerator();
var enumerator2 = compareList.GetEnumerator();
bool enum1HasValue = enumerator1.MoveNext();
bool enum2HasValue = enumerator2.MoveNext();
var enum1HasValue = enumerator1.MoveNext();
var enum2HasValue = enumerator2.MoveNext();
try
{
@@ -94,7 +93,7 @@ namespace Renci.SshNet
/// <returns>Data without leading zeros.</returns>
internal static IEnumerable<byte> TrimLeadingZero(this IEnumerable<byte> data)
{
bool leadingZero = true;
var leadingZero = true;
foreach (var item in data)
{
if (item == 0 & leadingZero)
@@ -127,7 +126,7 @@ namespace Renci.SshNet
/// <returns>An array of bytes with length 2.</returns>
internal static byte[] GetBytes(this UInt16 value)
{
return new byte[] { (byte)(value >> 8), (byte)(value & 0xFF) };
return new[] {(byte) (value >> 8), (byte) (value & 0xFF)};
}
/// <summary>
@@ -137,7 +136,7 @@ namespace Renci.SshNet
/// <returns>An array of bytes with length 4.</returns>
internal static byte[] GetBytes(this UInt32 value)
{
return new byte[] { (byte)(value >> 24), (byte)(value >> 16), (byte)(value >> 8), (byte)(value & 0xFF) };
return new[] {(byte) (value >> 24), (byte) (value >> 16), (byte) (value >> 8), (byte) (value & 0xFF)};
}
/// <summary>
@@ -147,7 +146,11 @@ namespace Renci.SshNet
/// <returns>An array of bytes with length 8.</returns>
internal static byte[] GetBytes(this UInt64 value)
{
return new byte[] { (byte)(value >> 56), (byte)(value >> 48), (byte)(value >> 40), (byte)(value >> 32), (byte)(value >> 24), (byte)(value >> 16), (byte)(value >> 8), (byte)(value & 0xFF) };
return new[]
{
(byte) (value >> 56), (byte) (value >> 48), (byte) (value >> 40), (byte) (value >> 32),
(byte) (value >> 24), (byte) (value >> 16), (byte) (value >> 8), (byte) (value & 0xFF)
};
}
/// <summary>
@@ -157,7 +160,11 @@ namespace Renci.SshNet
/// <returns>An array of bytes with length 8.</returns>
internal static byte[] GetBytes(this Int64 value)
{
return new byte[] { (byte)(value >> 56), (byte)(value >> 48), (byte)(value >> 40), (byte)(value >> 32), (byte)(value >> 24), (byte)(value >> 16), (byte)(value >> 8), (byte)(value & 0xFF) };
return new[]
{
(byte) (value >> 56), (byte) (value >> 48), (byte) (value >> 40), (byte) (value >> 32),
(byte) (value >> 24), (byte) (value >> 16), (byte) (value >> 8), (byte) (value & 0xFF)
};
}
internal static void ValidatePort(this uint value, string argument)
@@ -46,17 +46,17 @@ namespace Renci.SshNet.Common
/// <param name="host">The host.</param>
public HostKeyEventArgs(KeyHostAlgorithm host)
{
this.CanTrust = true; // Set default value
CanTrust = true; // Set default value
this.HostKey = host.Data;
HostKey = host.Data;
this.HostKeyName = host.Name;
HostKeyName = host.Name;
this.KeyLength = host.Key.KeyLength;
KeyLength = host.Key.KeyLength;
using (var md5 = new MD5Hash())
{
this.FingerPrint = md5.ComputeHash(host.Data);
FingerPrint = md5.ComputeHash(host.Data);
}
}
}
@@ -7,7 +7,7 @@ namespace Renci.SshNet.Common
/// The exception that is thrown when there is something wrong with the server capabilities.
/// </summary>
[Serializable]
public partial class NetConfServerException : SshException
public partial class NetConfServerException
{
/// <summary>
/// Initializes a new instance of the <see cref="SshAuthenticationException"/> class.
@@ -22,7 +22,7 @@ namespace Renci.SshNet.Common
if (identifiers.Length < 2)
throw new ArgumentException("identifiers");
this.Identifiers = identifiers;
Identifiers = identifiers;
}
}
}
@@ -4,7 +4,7 @@ using System.Runtime.Serialization;
namespace Renci.SshNet.Common
{
[Serializable]
public partial class ProxyException : SshException
public partial class ProxyException
{
/// <summary>
/// Initializes a new instance of the <see cref="ProxyException"/> class.
@@ -30,9 +30,9 @@ namespace Renci.SshNet.Common
/// <param name="downloaded">The number of downloaded bytes so far.</param>
public ScpDownloadEventArgs(string filename, long size, long downloaded)
{
this.Filename = filename;
this.Size = size;
this.Downloaded = downloaded;
Filename = filename;
Size = size;
Downloaded = downloaded;
}
}
}
@@ -4,7 +4,7 @@ using System.Runtime.Serialization;
namespace Renci.SshNet.Common
{
[Serializable]
public partial class ScpException : SshException
public partial class ScpException
{
/// <summary>
/// Initializes a new instance of the <see cref="ScpException"/> class.
@@ -30,9 +30,9 @@ namespace Renci.SshNet.Common
/// <param name="uploaded">The number of uploaded bytes so far.</param>
public ScpUploadEventArgs(string filename, long size, long uploaded)
{
this.Filename = filename;
this.Size = size;
this.Uploaded = uploaded;
Filename = filename;
Size = size;
Uploaded = uploaded;
}
}
}
@@ -23,13 +23,13 @@ namespace Renci.SshNet.Common
if (initialCount < 0 )
throw new ArgumentOutOfRangeException("initialCount", "The value cannot be negative.");
this._currentCount = initialCount;
_currentCount = initialCount;
}
/// <summary>
/// Gets the current count of the <see cref="SemaphoreLight"/>.
/// </summary>
public int CurrentCount { get { return this._currentCount; } }
public int CurrentCount { get { return _currentCount; } }
/// <summary>
/// Exits the <see cref="SemaphoreLight"/> once.
@@ -37,7 +37,7 @@ namespace Renci.SshNet.Common
/// <returns>The previous count of the <see cref="SemaphoreLight"/>.</returns>
public int Release()
{
return this.Release(1);
return Release(1);
}
/// <summary>
@@ -47,13 +47,13 @@ namespace Renci.SshNet.Common
/// <returns>The previous count of the <see cref="SemaphoreLight"/>.</returns>
public int Release(int releaseCount)
{
var oldCount = this._currentCount;
var oldCount = _currentCount;
lock (this._lock)
lock (_lock)
{
this._currentCount += releaseCount;
_currentCount += releaseCount;
Monitor.Pulse(this._lock);
Monitor.Pulse(_lock);
}
return oldCount;
@@ -65,16 +65,16 @@ namespace Renci.SshNet.Common
public void Wait()
{
lock (this._lock)
lock (_lock)
{
while (this._currentCount < 1)
while (_currentCount < 1)
{
Monitor.Wait(this._lock);
Monitor.Wait(_lock);
}
this._currentCount--;
_currentCount--;
Monitor.Pulse(this._lock);
Monitor.Pulse(_lock);
}
}
}
@@ -7,7 +7,7 @@ namespace Renci.SshNet.Common
/// The exception that is thrown when file or directory is not found.
/// </summary>
[Serializable]
public partial class SftpPathNotFoundException : SshException
public partial class SftpPathNotFoundException
{
/// <summary>
/// Initializes a new instance of the <see cref="SftpPathNotFoundException"/> class.
@@ -7,7 +7,7 @@ namespace Renci.SshNet.Common
/// The exception that is thrown when operation permission is denied.
/// </summary>
[Serializable]
public partial class SftpPermissionDeniedException : SshException
public partial class SftpPermissionDeniedException
{
/// <summary>
/// Initializes a new instance of the <see cref="SftpPermissionDeniedException"/> class.
@@ -23,7 +23,7 @@ namespace Renci.SshNet.Common
/// <param name="data">The data.</param>
public ShellDataEventArgs(byte[] data)
{
this.Data = data;
Data = data;
}
/// <summary>
@@ -32,7 +32,7 @@ namespace Renci.SshNet.Common
/// <param name="line">The line.</param>
public ShellDataEventArgs(string line)
{
this.Line = line;
Line = line;
}
}
}
@@ -7,7 +7,7 @@ namespace Renci.SshNet.Common
/// The exception that is thrown when authentication failed.
/// </summary>
[Serializable]
public partial class SshAuthenticationException : SshException
public partial class SshAuthenticationException
{
/// <summary>
/// Initializes a new instance of the <see cref="SshAuthenticationException"/> class.
@@ -7,7 +7,7 @@ namespace Renci.SshNet.Common
/// The exception that is thrown when connection was terminated.
/// </summary>
[Serializable]
public partial class SshConnectionException : SshException
public partial class SshConnectionException
{
/// <summary>
/// Initializes a new instance of the <see cref="SshConnectionException"/> class.
@@ -27,7 +27,7 @@ namespace Renci.SshNet.Common
public SshConnectionException(string message)
: base(message)
{
this.DisconnectReason = DisconnectReason.None;
DisconnectReason = DisconnectReason.None;
}
/// <summary>
@@ -38,7 +38,7 @@ namespace Renci.SshNet.Common
public SshConnectionException(string message, DisconnectReason disconnectReasonCode)
: base(message)
{
this.DisconnectReason = disconnectReasonCode;
DisconnectReason = disconnectReasonCode;
}
/// <summary>
@@ -50,7 +50,7 @@ namespace Renci.SshNet.Common
public SshConnectionException(string message, DisconnectReason disconnectReasonCode, Exception inner)
: base(message, inner)
{
this.DisconnectReason = disconnectReasonCode;
DisconnectReason = disconnectReasonCode;
}
/// <summary>
+68 -73
View File
@@ -11,12 +11,12 @@ namespace Renci.SshNet.Common
/// </summary>
public abstract class SshData
{
private static readonly Encoding _ascii = new ASCIIEncoding();
private static readonly Encoding Ascii = new ASCIIEncoding();
#if SILVERLIGHT
private static readonly Encoding _utf8 = Encoding.UTF8;
private static readonly Encoding Utf8 = Encoding.UTF8;
#else
private static readonly Encoding _utf8 = Encoding.Default;
private static readonly Encoding Utf8 = Encoding.Default;
#endif
/// <summary>
@@ -36,7 +36,7 @@ namespace Renci.SshNet.Common
{
get
{
return this._readerIndex >= this._data.Count();
return _readerIndex >= _data.Count();
}
}
@@ -62,17 +62,17 @@ namespace Renci.SshNet.Common
/// <returns>Byte array representation of data structure.</returns>
public virtual byte[] GetBytes()
{
this._data = new List<byte>();
_data = new List<byte>();
this.SaveData();
SaveData();
return this._data.ToArray();
return _data.ToArray();
}
internal T OfType<T>() where T : SshData, new()
{
var result = new T();
result.LoadBytes(this._loadedData);
result.LoadBytes(_loadedData);
result.LoadData();
return result;
}
@@ -87,8 +87,8 @@ namespace Renci.SshNet.Common
if (value == null)
throw new ArgumentNullException("value");
this.LoadBytes(value);
this.LoadData();
LoadBytes(value);
LoadData();
}
/// <summary>
@@ -113,9 +113,9 @@ namespace Renci.SshNet.Common
if (bytes == null)
throw new ArgumentNullException("bytes");
this.ResetReader();
this._loadedData = bytes;
this._data = new List<byte>(bytes);
ResetReader();
_loadedData = bytes;
_data = new List<byte>(bytes);
}
/// <summary>
@@ -123,7 +123,7 @@ namespace Renci.SshNet.Common
/// </summary>
protected void ResetReader()
{
this._readerIndex = this.ZeroReaderIndex; // Set to 1 to skip first byte which specifies message type
_readerIndex = ZeroReaderIndex; // Set to 1 to skip first byte which specifies message type
}
/// <summary>
@@ -132,8 +132,8 @@ namespace Renci.SshNet.Common
/// <returns>An array of bytes containing the remaining data in the internal buffer.</returns>
protected byte[] ReadBytes()
{
var data = new byte[this._data.Count - this._readerIndex];
this._data.CopyTo(this._readerIndex, data, 0, data.Length);
var data = new byte[_data.Count - _readerIndex];
_data.CopyTo(_readerIndex, data, 0, data.Length);
return data;
}
@@ -148,12 +148,12 @@ namespace Renci.SshNet.Common
// Note that this also prevents allocating non-relevant lengths, such as if length is greater than _data.Count but less than int.MaxValue.
// For the nerds, the condition translates to: if (length > data.Count && length < int.MaxValue)
// Which probably would cause all sorts of exception, most notably OutOfMemoryException.
if (length > this._data.Count)
if (length > _data.Count)
throw new ArgumentOutOfRangeException("length");
var result = new byte[length];
this._data.CopyTo(this._readerIndex, result, 0, length);
this._readerIndex += length;
_data.CopyTo(_readerIndex, result, 0, length);
_readerIndex += length;
return result;
}
@@ -163,7 +163,7 @@ namespace Renci.SshNet.Common
/// <returns>Byte read.</returns>
protected byte ReadByte()
{
return this.ReadBytes(1).FirstOrDefault();
return ReadBytes(1).FirstOrDefault();
}
/// <summary>
@@ -172,16 +172,16 @@ namespace Renci.SshNet.Common
/// <returns>Boolean read.</returns>
protected bool ReadBoolean()
{
return this.ReadByte() == 0 ? false : true;
return ReadByte() != 0;
}
/// <summary>
/// Reads next uint16 data type from internal buffer.
/// </summary>
/// <returns>uint16 read</returns>
protected UInt16 ReadUInt16()
protected ushort ReadUInt16()
{
var data = this.ReadBytes(2);
var data = ReadBytes(2);
return (ushort)(data[0] << 8 | data[1]);
}
@@ -189,9 +189,9 @@ namespace Renci.SshNet.Common
/// Reads next uint32 data type from internal buffer.
/// </summary>
/// <returns>uint32 read</returns>
protected UInt32 ReadUInt32()
protected uint ReadUInt32()
{
var data = this.ReadBytes(4);
var data = ReadBytes(4);
return (uint)(data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]);
}
@@ -199,20 +199,22 @@ namespace Renci.SshNet.Common
/// Reads next uint64 data type from internal buffer.
/// </summary>
/// <returns>uint64 read</returns>
protected UInt64 ReadUInt64()
protected ulong ReadUInt64()
{
var data = this.ReadBytes(8);
return ((ulong)data[0] << 56 | (ulong)data[1] << 48 | (ulong)data[2] << 40 | (ulong)data[3] << 32 | (ulong)data[4] << 24 | (ulong)data[5] << 16 | (ulong)data[6] << 8 | data[7]);
var data = ReadBytes(8);
return ((ulong) data[0] << 56 | (ulong) data[1] << 48 | (ulong) data[2] << 40 | (ulong) data[3] << 32 |
(ulong) data[4] << 24 | (ulong) data[5] << 16 | (ulong) data[6] << 8 | data[7]);
}
/// <summary>
/// Reads next int64 data type from internal buffer.
/// </summary>
/// <returns>int64 read</returns>
protected Int64 ReadInt64()
protected long ReadInt64()
{
var data = this.ReadBytes(8);
return (int)(data[0] << 56 | data[1] << 48 | data[2] << 40 | data[3] << 32 | data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]);
var data = ReadBytes(8);
return data[0] << 56 | data[1] << 48 | data[2] << 40 | data[3] << 32 | data[4] << 24 | data[5] << 16 |
data[6] << 8 | data[7];
}
/// <summary>
@@ -221,13 +223,13 @@ namespace Renci.SshNet.Common
/// <returns>string read</returns>
protected string ReadAsciiString()
{
var length = this.ReadUInt32();
var length = ReadUInt32();
if (length > (uint)int.MaxValue)
if (length > int.MaxValue)
{
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Strings longer than {0} is not supported.", int.MaxValue));
}
return _ascii.GetString(this.ReadBytes((int)length), 0, (int)length);
return Ascii.GetString(ReadBytes((int)length), 0, (int)length);
}
/// <summary>
@@ -236,7 +238,7 @@ namespace Renci.SshNet.Common
/// <returns>string read</returns>
protected string ReadString()
{
return this.ReadString(SshData._utf8);
return ReadString(Utf8);
}
/// <summary>
@@ -245,13 +247,13 @@ namespace Renci.SshNet.Common
/// <returns>string read</returns>
protected string ReadString(Encoding encoding)
{
var length = this.ReadUInt32();
var length = ReadUInt32();
if (length > (uint)int.MaxValue)
if (length > int.MaxValue)
{
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Strings longer than {0} is not supported.", int.MaxValue));
}
return encoding.GetString(this.ReadBytes((int)length), 0, (int)length);
return encoding.GetString(ReadBytes((int)length), 0, (int)length);
}
@@ -261,14 +263,14 @@ namespace Renci.SshNet.Common
/// <returns>string read</returns>
protected byte[] ReadBinaryString()
{
var length = this.ReadUInt32();
var length = ReadUInt32();
if (length > (uint)int.MaxValue)
if (length > int.MaxValue)
{
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Strings longer than {0} is not supported.", int.MaxValue));
}
return this.ReadBytes((int)length);
return ReadBytes((int)length);
}
/// <summary>
@@ -277,9 +279,9 @@ namespace Renci.SshNet.Common
/// <returns>mpint read.</returns>
protected BigInteger ReadBigInt()
{
var length = this.ReadUInt32();
var length = ReadUInt32();
var data = this.ReadBytes((int)length);
var data = ReadBytes((int)length);
return new BigInteger(data.Reverse().ToArray());
}
@@ -290,7 +292,7 @@ namespace Renci.SshNet.Common
/// <returns>String array or read data..</returns>
protected string[] ReadNamesList()
{
var namesList = this.ReadString();
var namesList = ReadString();
return namesList.Split(',');
}
@@ -300,11 +302,11 @@ namespace Renci.SshNet.Common
/// <returns>Extensions pair dictionary.</returns>
protected IDictionary<string, string> ReadExtensionPair()
{
Dictionary<string, string> result = new Dictionary<string, string>();
while (this._readerIndex < this._data.Count)
var result = new Dictionary<string, string>();
while (_readerIndex < _data.Count)
{
var extensionName = this.ReadString();
var extensionData = this.ReadString();
var extensionName = ReadString();
var extensionData = ReadString();
result.Add(extensionName, extensionData);
}
return result;
@@ -317,7 +319,7 @@ namespace Renci.SshNet.Common
/// <exception cref="ArgumentNullException"><paramref name="data"/> is null.</exception>
protected void Write(IEnumerable<byte> data)
{
this._data.AddRange(data);
_data.AddRange(data);
}
/// <summary>
@@ -326,7 +328,7 @@ namespace Renci.SshNet.Common
/// <param name="data">Byte data to write.</param>
protected void Write(byte data)
{
this._data.Add(data);
_data.Add(data);
}
/// <summary>
@@ -335,14 +337,7 @@ namespace Renci.SshNet.Common
/// <param name="data">Boolean data to write.</param>
protected void Write(bool data)
{
if (data)
{
this.Write(1);
}
else
{
this.Write(0);
}
Write(data ? 1 : 0);
}
/// <summary>
@@ -351,7 +346,7 @@ namespace Renci.SshNet.Common
/// <param name="data">uint16 data to write.</param>
protected void Write(UInt16 data)
{
this.Write(data.GetBytes());
Write(data.GetBytes());
}
/// <summary>
@@ -360,7 +355,7 @@ namespace Renci.SshNet.Common
/// <param name="data">uint32 data to write.</param>
protected void Write(UInt32 data)
{
this.Write(data.GetBytes());
Write(data.GetBytes());
}
/// <summary>
@@ -369,7 +364,7 @@ namespace Renci.SshNet.Common
/// <param name="data">uint64 data to write.</param>
protected void Write(UInt64 data)
{
this.Write(data.GetBytes());
Write(data.GetBytes());
}
/// <summary>
@@ -378,7 +373,7 @@ namespace Renci.SshNet.Common
/// <param name="data">int64 data to write.</param>
protected void Write(Int64 data)
{
this.Write(data.GetBytes());
Write(data.GetBytes());
}
@@ -388,7 +383,7 @@ namespace Renci.SshNet.Common
/// <param name="data">string data to write.</param>
protected void WriteAscii(string data)
{
this.Write(data, SshData._ascii);
Write(data, Ascii);
}
/// <summary>
@@ -398,7 +393,7 @@ namespace Renci.SshNet.Common
/// <exception cref="ArgumentNullException"><paramref name="data"/> is null.</exception>
protected void Write(string data)
{
this.Write(data, SshData._utf8);
Write(data, Utf8);
}
/// <summary>
@@ -416,8 +411,8 @@ namespace Renci.SshNet.Common
throw new ArgumentNullException("encoding");
var bytes = encoding.GetBytes(data);
this.Write((uint)bytes.Length);
this.Write(bytes);
Write((uint)bytes.Length);
Write(bytes);
}
/// <summary>
@@ -430,8 +425,8 @@ namespace Renci.SshNet.Common
if (data == null)
throw new ArgumentNullException("data");
this.Write((uint)data.Length);
this._data.AddRange(data);
Write((uint)data.Length);
_data.AddRange(data);
}
/// <summary>
@@ -441,8 +436,8 @@ namespace Renci.SshNet.Common
protected void Write(BigInteger data)
{
var bytes = data.ToByteArray().Reverse().ToList();
this.Write((uint)bytes.Count);
this.Write(bytes);
Write((uint)bytes.Count);
Write(bytes);
}
/// <summary>
@@ -451,7 +446,7 @@ namespace Renci.SshNet.Common
/// <param name="data">name-list data to write.</param>
protected void Write(string[] data)
{
this.WriteAscii(string.Join(",", data));
WriteAscii(string.Join(",", data));
}
/// <summary>
@@ -462,8 +457,8 @@ namespace Renci.SshNet.Common
{
foreach (var item in data)
{
this.WriteAscii(item.Key);
this.WriteAscii(item.Value);
WriteAscii(item.Key);
WriteAscii(item.Value);
}
}
}
@@ -7,7 +7,7 @@ namespace Renci.SshNet.Common
/// The exception that is thrown when SSH exception occurs.
/// </summary>
[Serializable]
public partial class SshException : Exception
public partial class SshException
{
/// <summary>
/// Initializes a new instance of the <see cref="SshException"/> class.
@@ -4,7 +4,7 @@ using System.Runtime.Serialization;
namespace Renci.SshNet.Common
{
[Serializable]
public partial class SshOperationTimeoutException : SshException
public partial class SshOperationTimeoutException
{
/// <summary>
/// Initializes a new instance of the <see cref="SshOperationTimeoutException"/> class.
@@ -7,7 +7,7 @@ namespace Renci.SshNet.Common
/// The exception that is thrown when pass phrase for key file is empty or null
/// </summary>
[Serializable]
public partial class SshPassPhraseNullOrEmptyException : SshException
public partial class SshPassPhraseNullOrEmptyException
{
/// <summary>
/// Initializes a new instance of the <see cref="SshPassPhraseNullOrEmptyException"/> class.
@@ -31,13 +31,13 @@ namespace Renci.SshNet.Compression
/// <summary>
/// Initializes a new instance of the <see cref="Compressor"/> class.
/// </summary>
public Compressor()
protected Compressor()
{
this._compressorStream = new MemoryStream();
this._decompressorStream = new MemoryStream();
_compressorStream = new MemoryStream();
_decompressorStream = new MemoryStream();
this._compressor = new ZlibStream(this._compressorStream, CompressionMode.Compress);
this._decompressor = new ZlibStream(this._decompressorStream, CompressionMode.Decompress);
_compressor = new ZlibStream(_compressorStream, CompressionMode.Compress);
_decompressor = new ZlibStream(_decompressorStream, CompressionMode.Decompress);
}
/// <summary>
@@ -46,7 +46,7 @@ namespace Renci.SshNet.Compression
/// <param name="session">The session.</param>
public virtual void Init(Session session)
{
this.Session = session;
Session = session;
}
/// <summary>
@@ -56,16 +56,16 @@ namespace Renci.SshNet.Compression
/// <returns>Compressed data</returns>
public virtual byte[] Compress(byte[] data)
{
if (!this.IsActive)
if (!IsActive)
{
return data;
}
this._compressorStream.SetLength(0);
_compressorStream.SetLength(0);
this._compressor.Write(data, 0, data.Length);
_compressor.Write(data, 0, data.Length);
return this._compressorStream.ToArray();
return _compressorStream.ToArray();
}
/// <summary>
@@ -75,16 +75,16 @@ namespace Renci.SshNet.Compression
/// <returns>Decompressed data.</returns>
public virtual byte[] Decompress(byte[] data)
{
if (!this.IsActive)
if (!IsActive)
{
return data;
}
this._decompressorStream.SetLength(0);
_decompressorStream.SetLength(0);
this._decompressor.Write(data, 0, data.Length);
_decompressor.Write(data, 0, data.Length);
return this._decompressorStream.ToArray();
return _decompressorStream.ToArray();
}
#region IDisposable Members
@@ -108,28 +108,28 @@ namespace Renci.SshNet.Compression
protected virtual void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if (!this._isDisposed)
if (!_isDisposed)
{
// If disposing equals true, dispose all managed
// and unmanaged ResourceMessages.
if (disposing)
{
// Dispose managed ResourceMessages.
if (this._compressorStream != null)
if (_compressorStream != null)
{
this._compressorStream.Dispose();
this._compressorStream = null;
_compressorStream.Dispose();
_compressorStream = null;
}
if (this._decompressorStream != null)
if (_decompressorStream != null)
{
this._decompressorStream.Dispose();
this._decompressorStream = null;
_decompressorStream.Dispose();
_decompressorStream = null;
}
}
// Note disposing has been done.
this._isDisposed = true;
_isDisposed = true;
}
}
@@ -20,7 +20,7 @@
public override void Init(Session session)
{
base.Init(session);
this.IsActive = true;
IsActive = true;
}
}
}
@@ -1,4 +1,6 @@
namespace Renci.SshNet.Compression
using Renci.SshNet.Messages.Authentication;
namespace Renci.SshNet.Compression
{
/// <summary>
/// Represents "zlib@openssh.org" compression implementation
@@ -24,10 +26,10 @@
session.UserAuthenticationSuccessReceived += Session_UserAuthenticationSuccessReceived;
}
private void Session_UserAuthenticationSuccessReceived(object sender, MessageEventArgs<Messages.Authentication.SuccessMessage> e)
private void Session_UserAuthenticationSuccessReceived(object sender, MessageEventArgs<SuccessMessage> e)
{
this.IsActive = true;
this.Session.UserAuthenticationSuccessReceived -= Session_UserAuthenticationSuccessReceived;
IsActive = true;
Session.UserAuthenticationSuccessReceived -= Session_UserAuthenticationSuccessReceived;
}
}
}
+21 -21
View File
@@ -21,7 +21,7 @@ namespace Renci.SshNet
/// </remarks>
public class ConnectionInfo : IConnectionInfoInternal
{
internal static int DEFAULT_PORT = 22;
internal static int DefaultPort = 22;
/// <summary>
/// Gets supported key exchange algorithms for this connection.
@@ -222,7 +222,7 @@ namespace Renci.SshNet
/// <exception cref="ArgumentNullException"><paramref name="authenticationMethods"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException">No <paramref name="authenticationMethods"/> specified.</exception>
public ConnectionInfo(string host, string username, params AuthenticationMethod[] authenticationMethods)
: this(host, DEFAULT_PORT, username, ProxyTypes.None, null, 0, null, null, authenticationMethods)
: this(host, DefaultPort, username, ProxyTypes.None, null, 0, null, null, authenticationMethods)
{
}
@@ -288,12 +288,12 @@ namespace Renci.SshNet
throw new ArgumentException("At least one authentication method should be specified.", "authenticationMethods");
// Set default connection values
this.Timeout = TimeSpan.FromSeconds(30);
this.RetryAttempts = 10;
this.MaxSessions = 10;
this.Encoding = Encoding.UTF8;
Timeout = TimeSpan.FromSeconds(30);
RetryAttempts = 10;
MaxSessions = 10;
Encoding = Encoding.UTF8;
this.KeyExchangeAlgorithms = new Dictionary<string, Type>
KeyExchangeAlgorithms = new Dictionary<string, Type>
{
{"diffie-hellman-group-exchange-sha256", typeof (KeyExchangeDiffieHellmanGroupExchangeSha256)},
{"diffie-hellman-group-exchange-sha1", typeof (KeyExchangeDiffieHellmanGroupExchangeSha1)},
@@ -307,7 +307,7 @@ namespace Renci.SshNet
//"gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==" - WinSSHD
};
this.Encryptions = new Dictionary<string, CipherInfo>
Encryptions = new Dictionary<string, CipherInfo>
{
{"aes256-ctr", new CipherInfo(256, (key, iv) => new AesCipher(key, new CtrCipherMode(iv), null))},
{"3des-cbc", new CipherInfo(192, (key, iv) => new TripleDesCipher(key, new CbcCipherMode(iv), null))},
@@ -332,7 +332,7 @@ namespace Renci.SshNet
{"aes192-ctr", new CipherInfo(192, (key, iv) => new AesCipher(key, new CtrCipherMode(iv), null))},
};
this.HmacAlgorithms = new Dictionary<string, HashInfo>
HmacAlgorithms = new Dictionary<string, HashInfo>
{
{"hmac-md5", new HashInfo(16*8, key => new HMac<MD5Hash>(key))},
{"hmac-sha1", new HashInfo(20*8, key => new HMac<SHA1Hash>(key))},
@@ -348,7 +348,7 @@ namespace Renci.SshNet
//{"none", typeof(...)},
};
this.HostKeyAlgorithms = new Dictionary<string, Func<byte[], KeyHostAlgorithm>>
HostKeyAlgorithms = new Dictionary<string, Func<byte[], KeyHostAlgorithm>>
{
{"ssh-rsa", data => new KeyHostAlgorithm("ssh-rsa", new RsaKey(), data)},
{"ssh-dss", data => new KeyHostAlgorithm("ssh-dss", new DsaKey(), data)},
@@ -361,14 +361,14 @@ namespace Renci.SshNet
//{"pgp-sign-dss", () => { ... },
};
this.CompressionAlgorithms = new Dictionary<string, Type>
CompressionAlgorithms = new Dictionary<string, Type>
{
//{"zlib@openssh.com", typeof(ZlibOpenSsh)},
//{"zlib", typeof(Zlib)},
{"none", null},
};
this.ChannelRequests = new Dictionary<string, RequestInfo>
ChannelRequests = new Dictionary<string, RequestInfo>
{
{EnvironmentVariableRequestInfo.NAME, new EnvironmentVariableRequestInfo()},
{ExecRequestInfo.NAME, new ExecRequestInfo()},
@@ -385,17 +385,17 @@ namespace Renci.SshNet
{KeepAliveRequestInfo.NAME, new KeepAliveRequestInfo()},
};
this.Host = host;
this.Port = port;
this.Username = username;
Host = host;
Port = port;
Username = username;
this.ProxyType = proxyType;
this.ProxyHost = proxyHost;
this.ProxyPort = proxyPort;
this.ProxyUsername = proxyUsername;
this.ProxyPassword = proxyPassword;
ProxyType = proxyType;
ProxyHost = proxyHost;
ProxyPort = proxyPort;
ProxyUsername = proxyUsername;
ProxyPassword = proxyPassword;
this.AuthenticationMethods = authenticationMethods;
AuthenticationMethods = authenticationMethods;
}
/// <summary>
+4 -4
View File
@@ -32,8 +32,8 @@ namespace Renci.SshNet
if (action == null)
throw new ArgumentNullException("action");
this.Expect = expect;
this.Action = action;
Expect = expect;
Action = action;
}
/// <summary>
@@ -50,8 +50,8 @@ namespace Renci.SshNet
if (action == null)
throw new ArgumentNullException("action");
this.Expect = new Regex(Regex.Escape(expect));
this.Action = action;
Expect = new Regex(Regex.Escape(expect));
Action = action;
}
}
}
@@ -8,6 +8,7 @@ using System.Net.Sockets;
using System.Threading;
using Renci.SshNet.Channels;
using Renci.SshNet.Common;
using ASCIIEncoding = Renci.SshNet.Common.ASCIIEncoding;
namespace Renci.SshNet
{
@@ -130,11 +131,11 @@ namespace Renci.SshNet
if (version[0] == 4)
{
this.HandleSocks4(clientSocket, channel);
HandleSocks4(clientSocket, channel);
}
else if (version[0] == 5)
{
this.HandleSocks5(clientSocket, channel);
HandleSocks5(clientSocket, channel);
}
else
{
@@ -259,7 +260,7 @@ namespace Renci.SshNet
var host = ipAddress.ToString();
this.RaiseRequestReceived(host, port);
RaiseRequestReceived(host, port);
channel.Open(host, port, this, socket);
@@ -337,7 +338,7 @@ namespace Renci.SshNet
addressBuffer = new byte[length];
stream.Read(addressBuffer, 0, addressBuffer.Length);
ipAddress = IPAddress.Parse(new Common.ASCIIEncoding().GetString(addressBuffer));
ipAddress = IPAddress.Parse(new ASCIIEncoding().GetString(addressBuffer));
//var hostName = new Common.ASCIIEncoding().GetString(addressBuffer);
@@ -361,7 +362,7 @@ namespace Renci.SshNet
var port = (uint)(portBuffer[0] * 256 + portBuffer[1]);
var host = ipAddress.ToString();
this.RaiseRequestReceived(host, port);
RaiseRequestReceived(host, port);
channel.Open(host, port, this, socket);
@@ -165,7 +165,7 @@ namespace Renci.SshNet
_listenerTaskCompleted.WaitOne();
}
private void Session_ErrorOccured(object sender, Common.ExceptionEventArgs e)
private void Session_ErrorOccured(object sender, ExceptionEventArgs e)
{
StopListener();
}
@@ -1,5 +1,6 @@
using System;
using System.Threading;
using Renci.SshNet.Common;
namespace Renci.SshNet
{
@@ -94,10 +95,10 @@ namespace Renci.SshNet
boundPort.ValidatePort("boundPort");
port.ValidatePort("port");
this.BoundHost = boundHost;
this.BoundPort = boundPort;
this.Host = host;
this.Port = port;
BoundHost = boundHost;
BoundPort = boundPort;
Host = host;
Port = port;
}
/// <summary>
@@ -105,7 +106,7 @@ namespace Renci.SshNet
/// </summary>
protected override void StartPort()
{
this.InternalStart();
InternalStart();
}
/// <summary>
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.Threading;
using Renci.SshNet.Messages.Connection;
using Renci.SshNet.Common;
+2 -2
View File
@@ -29,8 +29,8 @@ namespace Renci.SshNet
/// <param name="hash">The hash algorithm to use for a given key.</param>
public HashInfo(int keySize, Func<byte[], HashAlgorithm> hash)
{
this.KeySize = keySize;
this.HashAlgorithm = key => (hash(key.Take(this.KeySize / 8).ToArray()));
KeySize = keySize;
HashAlgorithm = key => (hash(key.Take(KeySize / 8).ToArray()));
}
}
}
@@ -28,7 +28,7 @@ namespace Renci.SshNet
/// <param name="host">The host.</param>
/// <param name="username">The username.</param>
public KeyboardInteractiveConnectionInfo(string host, string username)
: this(host, ConnectionInfo.DEFAULT_PORT, username, ProxyTypes.None, string.Empty, 0, string.Empty, string.Empty)
: this(host, ConnectionInfo.DefaultPort, username, ProxyTypes.None, string.Empty, 0, string.Empty, string.Empty)
{
}
@@ -83,7 +83,7 @@ namespace Renci.SshNet
/// <param name="proxyHost">The proxy host.</param>
/// <param name="proxyPort">The proxy port.</param>
public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort)
: this(host, ConnectionInfo.DEFAULT_PORT, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
: this(host, ConnectionInfo.DefaultPort, username, proxyType, proxyHost, proxyPort, string.Empty, string.Empty)
{
}
@@ -97,7 +97,7 @@ namespace Renci.SshNet
/// <param name="proxyPort">The proxy port.</param>
/// <param name="proxyUsername">The proxy username.</param>
public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername)
: this(host, ConnectionInfo.DEFAULT_PORT, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
: this(host, ConnectionInfo.DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, string.Empty)
{
}
@@ -112,7 +112,7 @@ namespace Renci.SshNet
/// <param name="proxyUsername">The proxy username.</param>
/// <param name="proxyPassword">The proxy password.</param>
public KeyboardInteractiveConnectionInfo(string host, string username, ProxyTypes proxyType, string proxyHost, int proxyPort, string proxyUsername, string proxyPassword)
: this(host, ConnectionInfo.DEFAULT_PORT, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
: this(host, ConnectionInfo.DefaultPort, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword)
{
}
@@ -21,8 +21,8 @@
/// </summary>
protected override void LoadData()
{
this.Message = this.ReadString();
this.Language = this.ReadString();
Message = ReadString();
Language = ReadString();
}
/// <summary>
@@ -30,8 +30,8 @@
/// </summary>
protected override void SaveData()
{
this.Write(this.Message);
this.Write(this.Language);
Write(Message);
Write(Language);
}
}
}
@@ -34,11 +34,11 @@ namespace Renci.SshNet.Messages.Authentication
/// </summary>
protected override void LoadData()
{
this.AllowedAuthentications = this.ReadNamesList();
this.PartialSuccess = this.ReadBoolean();
if (this.PartialSuccess)
AllowedAuthentications = ReadNamesList();
PartialSuccess = ReadBoolean();
if (PartialSuccess)
{
this.Message = string.Join(",", this.AllowedAuthentications);
Message = string.Join(",", AllowedAuthentications);
}
}
@@ -35,21 +35,21 @@ namespace Renci.SshNet.Messages.Authentication
/// </summary>
protected override void LoadData()
{
this.Name = this.ReadString();
this.Instruction = this.ReadString();
this.Language = this.ReadString();
Name = ReadString();
Instruction = ReadString();
Language = ReadString();
var numOfPrompts = this.ReadUInt32();
var numOfPrompts = ReadUInt32();
var prompts = new List<AuthenticationPrompt>();
for (int i = 0; i < numOfPrompts; i++)
for (var i = 0; i < numOfPrompts; i++)
{
var prompt = this.ReadString();
var echo = this.ReadBoolean();
var prompt = ReadString();
var echo = ReadBoolean();
prompts.Add(new AuthenticationPrompt(i, echo, prompt));
}
this.Prompts = prompts;
Prompts = prompts;
}
/// <summary>
@@ -19,7 +19,7 @@ namespace Renci.SshNet.Messages.Authentication
/// </summary>
public InformationResponseMessage()
{
this.Responses = new List<string>();
Responses = new List<string>();
}
/// <summary>
@@ -35,10 +35,10 @@ namespace Renci.SshNet.Messages.Authentication
/// </summary>
protected override void SaveData()
{
this.Write((UInt32)this.Responses.Count);
foreach (var response in this.Responses)
Write((UInt32)Responses.Count);
foreach (var response in Responses)
{
this.Write(response);
Write(response);
}
}
}
@@ -21,8 +21,8 @@
/// </summary>
protected override void LoadData()
{
this.Message = this.ReadString();
this.Language = this.ReadString();
Message = ReadString();
Language = ReadString();
}
/// <summary>
@@ -30,8 +30,8 @@
/// </summary>
protected override void SaveData()
{
this.Write(this.Message);
this.Write(this.Language);
Write(Message);
Write(Language);
}
}
}
@@ -24,8 +24,8 @@
/// </summary>
protected override void LoadData()
{
this.PublicKeyAlgorithmName = this.ReadAsciiString();
this.PublicKeyData = this.ReadBinaryString();
PublicKeyAlgorithmName = ReadAsciiString();
PublicKeyData = ReadBinaryString();
}
/// <summary>
@@ -33,8 +33,8 @@
/// </summary>
protected override void SaveData()
{
this.WriteAscii(this.PublicKeyAlgorithmName);
this.WriteBinaryString(this.PublicKeyData);
WriteAscii(PublicKeyAlgorithmName);
WriteBinaryString(PublicKeyData);
}
}
}
@@ -36,8 +36,8 @@ namespace Renci.SshNet.Messages.Authentication
/// <param name="username">Authentication username.</param>
public RequestMessage(ServiceName serviceName, string username)
{
this.ServiceName = serviceName;
this.Username = username;
ServiceName = serviceName;
Username = username;
}
/// <summary>
@@ -53,19 +53,19 @@ namespace Renci.SshNet.Messages.Authentication
/// </summary>
protected override void SaveData()
{
this.Write(this.Username);
switch (this.ServiceName)
Write(Username);
switch (ServiceName)
{
case ServiceName.UserAuthentication:
this.WriteAscii("ssh-userauth");
WriteAscii("ssh-userauth");
break;
case ServiceName.Connection:
this.WriteAscii("ssh-connection");
WriteAscii("ssh-connection");
break;
default:
throw new NotSupportedException("Not supported service name");
}
this.WriteAscii(this.MethodName);
WriteAscii(MethodName);
}
}
}
@@ -68,10 +68,10 @@
public RequestMessageHost(ServiceName serviceName, string username, string publicKeyAlgorithm, byte[] publicHostKey, string clientHostName, string clientUsername)
: base(serviceName, username)
{
this.PublicKeyAlgorithm = publicKeyAlgorithm;
this.PublicHostKey = publicHostKey;
this.ClientHostName = clientHostName;
this.ClientUsername = clientUsername;
PublicKeyAlgorithm = publicKeyAlgorithm;
PublicHostKey = publicHostKey;
ClientHostName = clientHostName;
ClientUsername = clientUsername;
}
/// <summary>
@@ -81,13 +81,13 @@
{
base.SaveData();
this.WriteAscii(this.PublicKeyAlgorithm);
this.WriteBinaryString(this.PublicHostKey);
this.Write(this.ClientHostName);
this.Write(this.ClientUsername);
WriteAscii(PublicKeyAlgorithm);
WriteBinaryString(PublicHostKey);
Write(ClientHostName);
Write(ClientUsername);
if (this.Signature != null)
this.WriteBinaryString(this.Signature);
if (Signature != null)
WriteBinaryString(Signature);
}
}
}
@@ -37,8 +37,8 @@
public RequestMessageKeyboardInteractive(ServiceName serviceName, string username)
: base(serviceName, username)
{
this.Language = string.Empty;
this.SubMethods = string.Empty;
Language = string.Empty;
SubMethods = string.Empty;
}
/// <summary>
@@ -48,9 +48,9 @@
{
base.SaveData();
this.Write(this.Language);
Write(Language);
this.Write(this.SubMethods);
Write(SubMethods);
}
}
}
@@ -38,7 +38,7 @@
public RequestMessagePassword(ServiceName serviceName, string username, byte[] password)
: base(serviceName, username)
{
this.Password = password;
Password = password;
}
/// <summary>
@@ -51,7 +51,7 @@
public RequestMessagePassword(ServiceName serviceName, string username, byte[] password, byte[] newPassword)
: this(serviceName, username, password)
{
this.NewPassword = newPassword;
NewPassword = newPassword;
}
/// <summary>
@@ -61,15 +61,15 @@
{
base.SaveData();
this.Write(this.NewPassword != null);
Write(NewPassword != null);
this.Write((uint)this.Password.Length);
this.Write(this.Password);
Write((uint)Password.Length);
Write(Password);
if (this.NewPassword != null)
if (NewPassword != null)
{
this.Write((uint)this.NewPassword.Length);
this.Write(this.NewPassword);
Write((uint)NewPassword.Length);
Write(NewPassword);
}
}
}
@@ -50,8 +50,8 @@
public RequestMessagePublicKey(ServiceName serviceName, string username, string keyAlgorithmName, byte[] keyData)
: base(serviceName, username)
{
this.PublicKeyAlgorithmName = keyAlgorithmName;
this.PublicKeyData = keyData;
PublicKeyAlgorithmName = keyAlgorithmName;
PublicKeyData = keyData;
}
/// <summary>
@@ -65,7 +65,7 @@
public RequestMessagePublicKey(ServiceName serviceName, string username, string keyAlgorithmName, byte[] keyData, byte[] signature)
: this(serviceName, username, keyAlgorithmName, keyData)
{
this.Signature = signature;
Signature = signature;
}
/// <summary>
@@ -75,18 +75,18 @@
{
base.SaveData();
if (this.Signature == null)
if (Signature == null)
{
this.Write(false);
Write(false);
}
else
{
this.Write(true);
Write(true);
}
this.WriteAscii(this.PublicKeyAlgorithmName);
this.WriteBinaryString(this.PublicKeyData);
if (this.Signature != null)
this.WriteBinaryString(this.Signature);
WriteAscii(PublicKeyAlgorithmName);
WriteBinaryString(PublicKeyData);
if (Signature != null)
WriteBinaryString(Signature);
}
}
}
@@ -28,8 +28,8 @@
/// <param name="data">Message data.</param>
public ChannelDataMessage(uint localChannelNumber, byte[] data)
{
this.LocalChannelNumber = localChannelNumber;
this.Data = data;
LocalChannelNumber = localChannelNumber;
Data = data;
}
/// <summary>
@@ -38,7 +38,7 @@
protected override void LoadData()
{
base.LoadData();
this.Data = this.ReadBinaryString();
Data = ReadBinaryString();
}
/// <summary>
@@ -47,7 +47,7 @@
protected override void SaveData()
{
base.SaveData();
this.WriteBinaryString(this.Data);
WriteBinaryString(Data);
}
}
}
@@ -20,7 +20,7 @@
/// <param name="localChannelNumber">The local channel number.</param>
public ChannelEofMessage(uint localChannelNumber)
{
this.LocalChannelNumber = localChannelNumber;
LocalChannelNumber = localChannelNumber;
}
}
}
@@ -32,9 +32,9 @@
/// <param name="data">The message data.</param>
public ChannelExtendedDataMessage(uint localChannelNumber, uint dataTypeCode, byte[] data)
{
this.LocalChannelNumber = localChannelNumber;
this.DataTypeCode = dataTypeCode;
this.Data = data;
LocalChannelNumber = localChannelNumber;
DataTypeCode = dataTypeCode;
Data = data;
}
/// <summary>
@@ -43,8 +43,8 @@
protected override void LoadData()
{
base.LoadData();
this.DataTypeCode = this.ReadUInt32();
this.Data = this.ReadBinaryString();
DataTypeCode = ReadUInt32();
Data = ReadBinaryString();
}
/// <summary>
@@ -53,8 +53,8 @@
protected override void SaveData()
{
base.SaveData();
this.Write(this.DataTypeCode);
this.WriteBinaryString(this.Data);
Write(DataTypeCode);
WriteBinaryString(Data);
}
}
}
@@ -20,7 +20,7 @@
/// <param name="localChannelNumber">The local channel number.</param>
public ChannelFailureMessage(uint localChannelNumber)
{
this.LocalChannelNumber = localChannelNumber;
LocalChannelNumber = localChannelNumber;
}
}
}
@@ -19,7 +19,7 @@ namespace Renci.SshNet.Messages.Connection
/// </summary>
protected override void LoadData()
{
this.LocalChannelNumber = this.ReadUInt32();
LocalChannelNumber = ReadUInt32();
}
/// <summary>
@@ -27,7 +27,7 @@ namespace Renci.SshNet.Messages.Connection
/// </summary>
protected override void SaveData()
{
this.Write(this.LocalChannelNumber);
Write(LocalChannelNumber);
}
/// <summary>
@@ -38,7 +38,7 @@ namespace Renci.SshNet.Messages.Connection
/// </returns>
public override string ToString()
{
return string.Format(CultureInfo.CurrentCulture, "{0} : #{1}", base.ToString(), this.LocalChannelNumber);
return string.Format(CultureInfo.CurrentCulture, "{0} : #{1}", base.ToString(), LocalChannelNumber);
}
}
}
@@ -19,7 +19,7 @@ namespace Renci.SshNet.Messages.Connection
{
get
{
return this.Info.ChannelType;
return Info.ChannelType;
}
}
@@ -61,10 +61,10 @@ namespace Renci.SshNet.Messages.Connection
/// <param name="info">The info.</param>
public ChannelOpenMessage(uint channelNumber, uint initialWindowSize, uint maximumPacketSize, ChannelOpenInfo info)
{
this.LocalChannelNumber = channelNumber;
this.InitialWindowSize = initialWindowSize;
this.MaximumPacketSize = maximumPacketSize;
this.Info = info;
LocalChannelNumber = channelNumber;
InitialWindowSize = initialWindowSize;
MaximumPacketSize = maximumPacketSize;
Info = info;
}
/// <summary>
@@ -72,34 +72,34 @@ namespace Renci.SshNet.Messages.Connection
/// </summary>
protected override void LoadData()
{
var channelName = this.ReadAsciiString();
this.LocalChannelNumber = this.ReadUInt32();
this.InitialWindowSize = this.ReadUInt32();
this.MaximumPacketSize = this.ReadUInt32();
var bytes = this.ReadBytes();
var channelName = ReadAsciiString();
LocalChannelNumber = ReadUInt32();
InitialWindowSize = ReadUInt32();
MaximumPacketSize = ReadUInt32();
var bytes = ReadBytes();
if (channelName == SessionChannelOpenInfo.NAME)
{
this.Info = new SessionChannelOpenInfo();
Info = new SessionChannelOpenInfo();
}
else if (channelName == X11ChannelOpenInfo.NAME)
{
this.Info = new X11ChannelOpenInfo();
Info = new X11ChannelOpenInfo();
}
else if (channelName == DirectTcpipChannelInfo.NAME)
{
this.Info = new DirectTcpipChannelInfo();
Info = new DirectTcpipChannelInfo();
}
else if (channelName == ForwardedTcpipChannelInfo.NAME)
{
this.Info = new ForwardedTcpipChannelInfo();
Info = new ForwardedTcpipChannelInfo();
}
else
{
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Channel type '{0}' is not supported.", channelName));
}
this.Info.Load(bytes);
Info.Load(bytes);
}
@@ -108,11 +108,11 @@ namespace Renci.SshNet.Messages.Connection
/// </summary>
protected override void SaveData()
{
this.WriteAscii(this.ChannelType);
this.Write(this.LocalChannelNumber);
this.Write(this.InitialWindowSize);
this.Write(this.MaximumPacketSize);
this.Write(this.Info.GetBytes());
WriteAscii(ChannelType);
Write(LocalChannelNumber);
Write(InitialWindowSize);
Write(MaximumPacketSize);
Write(Info.GetBytes());
}
}
}
@@ -58,10 +58,10 @@
/// <param name="originatorPort">The originator port.</param>
public DirectTcpipChannelInfo(string hostToConnect, uint portToConnect, string originatorAddress, uint originatorPort)
{
this.HostToConnect = hostToConnect;
this.PortToConnect = portToConnect;
this.OriginatorAddress = originatorAddress;
this.OriginatorPort = originatorPort;
HostToConnect = hostToConnect;
PortToConnect = portToConnect;
OriginatorAddress = originatorAddress;
OriginatorPort = originatorPort;
}
/// <summary>
@@ -71,10 +71,10 @@
{
base.LoadData();
this.HostToConnect = this.ReadString();
this.PortToConnect = this.ReadUInt32();
this.OriginatorAddress = this.ReadString();
this.OriginatorPort = this.ReadUInt32();
HostToConnect = ReadString();
PortToConnect = ReadUInt32();
OriginatorAddress = ReadString();
OriginatorPort = ReadUInt32();
}
/// <summary>
@@ -84,10 +84,10 @@
{
base.SaveData();
this.Write(this.HostToConnect);
this.Write(this.PortToConnect);
this.Write(this.OriginatorAddress);
this.Write(this.OriginatorPort);
Write(HostToConnect);
Write(PortToConnect);
Write(OriginatorAddress);
Write(OriginatorPort);
}
}
}
@@ -67,10 +67,10 @@
{
base.LoadData();
this.ConnectedAddress = this.ReadString();
this.ConnectedPort = this.ReadUInt32();
this.OriginatorAddress = this.ReadString();
this.OriginatorPort = this.ReadUInt32();
ConnectedAddress = ReadString();
ConnectedPort = ReadUInt32();
OriginatorAddress = ReadString();
OriginatorPort = ReadUInt32();
}
/// <summary>
@@ -80,10 +80,10 @@
{
base.SaveData();
this.Write(this.ConnectedAddress);
this.Write(this.ConnectedPort);
this.Write(this.OriginatorAddress);
this.Write(this.OriginatorPort);
Write(ConnectedAddress);
Write(ConnectedPort);
Write(OriginatorAddress);
Write(OriginatorPort);
}
}
}
@@ -38,8 +38,8 @@
{
base.LoadData();
this.OriginatorAddress = this.ReadString();
this.OriginatorPort = this.ReadUInt32();
OriginatorAddress = ReadString();
OriginatorPort = ReadUInt32();
}
/// <summary>
@@ -49,8 +49,8 @@
{
base.SaveData();
this.Write(this.OriginatorAddress);
this.Write(this.OriginatorPort);
Write(OriginatorAddress);
Write(OriginatorPort);
}
}
}
@@ -44,10 +44,10 @@
/// <param name="remoteChannelNumber">The remote channel number.</param>
public ChannelOpenConfirmationMessage(uint localChannelNumber, uint initialWindowSize, uint maximumPacketSize, uint remoteChannelNumber)
{
this.LocalChannelNumber = localChannelNumber;
this.InitialWindowSize = initialWindowSize;
this.MaximumPacketSize = maximumPacketSize;
this.RemoteChannelNumber = remoteChannelNumber;
LocalChannelNumber = localChannelNumber;
InitialWindowSize = initialWindowSize;
MaximumPacketSize = maximumPacketSize;
RemoteChannelNumber = remoteChannelNumber;
}
/// <summary>
@@ -56,9 +56,9 @@
protected override void LoadData()
{
base.LoadData();
this.RemoteChannelNumber = this.ReadUInt32();
this.InitialWindowSize = this.ReadUInt32();
this.MaximumPacketSize = this.ReadUInt32();
RemoteChannelNumber = ReadUInt32();
InitialWindowSize = ReadUInt32();
MaximumPacketSize = ReadUInt32();
}
/// <summary>
@@ -67,9 +67,9 @@
protected override void SaveData()
{
base.SaveData();
this.Write(this.RemoteChannelNumber);
this.Write(this.InitialWindowSize);
this.Write(this.MaximumPacketSize);
Write(RemoteChannelNumber);
Write(InitialWindowSize);
Write(MaximumPacketSize);
}
}
}
@@ -42,9 +42,9 @@
/// <param name="reasonCode">The reason code.</param>
public ChannelOpenFailureMessage(uint localChannelNumber, string description, uint reasonCode)
{
this.LocalChannelNumber = localChannelNumber;
this.Description = description;
this.ReasonCode = reasonCode;
LocalChannelNumber = localChannelNumber;
Description = description;
ReasonCode = reasonCode;
}
/// <summary>
@@ -68,9 +68,9 @@
protected override void LoadData()
{
base.LoadData();
this.ReasonCode = this.ReadUInt32();
this.Description = this.ReadString();
this.Language = this.ReadString();
ReasonCode = ReadUInt32();
Description = ReadString();
Language = ReadString();
}
/// <summary>
@@ -79,9 +79,9 @@
protected override void SaveData()
{
base.SaveData();
this.Write(this.ReasonCode);
this.Write(this.Description ?? string.Empty);
this.Write(this.Language ?? "en");
Write(ReasonCode);
Write(Description ?? string.Empty);
Write(Language ?? "en");
}
}
}
@@ -33,7 +33,7 @@ namespace Renci.SshNet.Messages.Connection
/// </summary>
public BreakRequestInfo()
{
this.WantReply = true;
WantReply = true;
}
/// <summary>
@@ -43,7 +43,7 @@ namespace Renci.SshNet.Messages.Connection
public BreakRequestInfo(UInt32 breakLength)
: this()
{
this.BreakLength = breakLength;
BreakLength = breakLength;
}
/// <summary>
@@ -53,7 +53,7 @@ namespace Renci.SshNet.Messages.Connection
{
base.LoadData();
this.BreakLength = this.ReadUInt32();
BreakLength = ReadUInt32();
}
/// <summary>
@@ -63,7 +63,7 @@ namespace Renci.SshNet.Messages.Connection
{
base.SaveData();
this.Write(this.BreakLength);
Write(BreakLength);
}
}
}
@@ -34,9 +34,9 @@
/// <param name="info">The info.</param>
public ChannelRequestMessage(uint localChannelName, RequestInfo info)
{
this.LocalChannelNumber = localChannelName;
this.RequestName = info.RequestName;
this.RequestData = info.GetBytes();
LocalChannelNumber = localChannelName;
RequestName = info.RequestName;
RequestData = info.GetBytes();
}
/// <summary>
@@ -46,8 +46,8 @@
{
base.LoadData();
this.RequestName = this.ReadAsciiString();
this.RequestData = this.ReadBytes();
RequestName = ReadAsciiString();
RequestData = ReadBytes();
}
/// <summary>
@@ -57,8 +57,8 @@
{
base.SaveData();
this.WriteAscii(this.RequestName);
this.Write(this.RequestData);
WriteAscii(RequestName);
Write(RequestData);
}
}
}
@@ -26,7 +26,7 @@
/// </summary>
public EndOfWriteRequestInfo()
{
this.WantReply = false;
WantReply = false;
}
}
}
@@ -42,7 +42,7 @@
/// </summary>
public EnvironmentVariableRequestInfo()
{
this.WantReply = true;
WantReply = true;
}
/// <summary>
@@ -53,8 +53,8 @@
public EnvironmentVariableRequestInfo(string variableName, string variableValue)
: this()
{
this.VariableName = variableName;
this.VariableValue = variableValue;
VariableName = variableName;
VariableValue = variableValue;
}
/// <summary>
@@ -64,8 +64,8 @@
{
base.LoadData();
this.VariableName = this.ReadString();
this.VariableValue = this.ReadString();
VariableName = ReadString();
VariableValue = ReadString();
}
/// <summary>
@@ -75,8 +75,8 @@
{
base.SaveData();
this.Write(this.VariableName);
this.Write(this.VariableValue);
Write(VariableName);
Write(VariableValue);
}
}
}
@@ -1,4 +1,5 @@
using System.Text;
using System;
using System.Text;
namespace Renci.SshNet.Messages.Connection
{
@@ -44,7 +45,7 @@ namespace Renci.SshNet.Messages.Connection
/// </summary>
public ExecRequestInfo()
{
this.WantReply = true;
WantReply = true;
}
/// <summary>
@@ -57,12 +58,12 @@ namespace Renci.SshNet.Messages.Connection
: this()
{
if (command == null)
throw new System.ArgumentNullException("command");
throw new ArgumentNullException("command");
if (encoding == null)
throw new System.ArgumentNullException("encoding");
throw new ArgumentNullException("encoding");
this.Command = command;
this.Encoding = encoding;
Command = command;
Encoding = encoding;
}
/// <summary>
@@ -72,7 +73,7 @@ namespace Renci.SshNet.Messages.Connection
{
base.LoadData();
this.Command = this.ReadString();
Command = ReadString();
}
/// <summary>
@@ -82,7 +83,7 @@ namespace Renci.SshNet.Messages.Connection
{
base.SaveData();
this.Write(this.Command, this.Encoding);
Write(Command, Encoding);
}
}
}
@@ -52,7 +52,7 @@
/// </summary>
public ExitSignalRequestInfo()
{
this.WantReply = false;
WantReply = false;
}
/// <summary>
@@ -65,10 +65,10 @@
public ExitSignalRequestInfo(string signalName, bool coreDumped, string errorMessage, string language)
: this()
{
this.SignalName = signalName;
this.CoreDumped = coreDumped;
this.ErrorMessage = errorMessage;
this.Language = language;
SignalName = signalName;
CoreDumped = coreDumped;
ErrorMessage = errorMessage;
Language = language;
}
/// <summary>
@@ -78,10 +78,10 @@
{
base.LoadData();
this.SignalName = this.ReadAsciiString();
this.CoreDumped = this.ReadBoolean();
this.ErrorMessage = this.ReadString();
this.Language = this.ReadString();
SignalName = ReadAsciiString();
CoreDumped = ReadBoolean();
ErrorMessage = ReadString();
Language = ReadString();
}
/// <summary>
@@ -91,10 +91,10 @@
{
base.SaveData();
this.WriteAscii(this.SignalName);
this.Write(this.CoreDumped);
this.Write(this.ErrorMessage);
this.Write(this.Language);
WriteAscii(SignalName);
Write(CoreDumped);
Write(ErrorMessage);
Write(Language);
}
}
@@ -31,7 +31,7 @@
/// </summary>
public ExitStatusRequestInfo()
{
this.WantReply = false;
WantReply = false;
}
/// <summary>
@@ -41,7 +41,7 @@
public ExitStatusRequestInfo(uint exitStatus)
: this()
{
this.ExitStatus = exitStatus;
ExitStatus = exitStatus;
}
/// <summary>
@@ -51,7 +51,7 @@
{
base.LoadData();
this.ExitStatus = this.ReadUInt32();
ExitStatus = ReadUInt32();
}
/// <summary>
@@ -61,7 +61,7 @@
{
base.SaveData();
this.Write(this.ExitStatus);
Write(ExitStatus);
}
}
}
@@ -26,7 +26,7 @@
/// </summary>
public KeepAliveRequestInfo()
{
this.WantReply = false;
WantReply = false;
}
}
}
@@ -77,7 +77,7 @@ namespace Renci.SshNet.Messages.Connection
/// </summary>
public PseudoTerminalRequestInfo()
{
this.WantReply = true;
WantReply = true;
}
/// <summary>
@@ -92,12 +92,12 @@ namespace Renci.SshNet.Messages.Connection
public PseudoTerminalRequestInfo(string environmentVariable, uint columns, uint rows, uint width, uint height, IDictionary<TerminalModes, uint> terminalModeValues)
: this()
{
this.EnvironmentVariable = environmentVariable;
this.Columns = columns;
this.Rows = rows;
this.PixelWidth = width;
this.PixelHeight = height;
this.TerminalModeValues = terminalModeValues;
EnvironmentVariable = environmentVariable;
Columns = columns;
Rows = rows;
PixelWidth = width;
PixelHeight = height;
TerminalModeValues = terminalModeValues;
}
/// <summary>
@@ -107,26 +107,26 @@ namespace Renci.SshNet.Messages.Connection
{
base.SaveData();
this.Write(this.EnvironmentVariable);
this.Write(this.Columns);
this.Write(this.Rows);
this.Write(this.Rows);
this.Write(this.PixelHeight);
Write(EnvironmentVariable);
Write(Columns);
Write(Rows);
Write(Rows);
Write(PixelHeight);
if (this.TerminalModeValues != null)
if (TerminalModeValues != null)
{
this.Write((uint)this.TerminalModeValues.Count * (1 + 4) + 1);
Write((uint)TerminalModeValues.Count * (1 + 4) + 1);
foreach (var item in this.TerminalModeValues)
foreach (var item in TerminalModeValues)
{
this.Write((byte)item.Key);
this.Write(item.Value);
Write((byte)item.Key);
Write(item.Value);
}
this.Write((byte)0);
Write((byte)0);
}
else
{
this.Write((uint)0);
Write((uint)0);
}
}
}
@@ -28,7 +28,7 @@ namespace Renci.SshNet.Messages.Connection
/// </summary>
protected override void LoadData()
{
this.WantReply = this.ReadBoolean();
WantReply = ReadBoolean();
}
/// <summary>
@@ -36,7 +36,7 @@ namespace Renci.SshNet.Messages.Connection
/// </summary>
protected override void SaveData()
{
this.Write(this.WantReply);
Write(WantReply);
}
}
}
@@ -26,7 +26,7 @@
/// </summary>
public ShellRequestInfo()
{
this.WantReply = true;
WantReply = true;
}
}
}
@@ -34,7 +34,7 @@
/// </summary>
public SignalRequestInfo()
{
this.WantReply = false;
WantReply = false;
}
/// <summary>
@@ -44,7 +44,7 @@
public SignalRequestInfo(string signalName)
: this()
{
this.SignalName = signalName;
SignalName = signalName;
}
/// <summary>
@@ -54,7 +54,7 @@
{
base.LoadData();
this.SignalName = this.ReadAsciiString();
SignalName = ReadAsciiString();
}
/// <summary>
@@ -64,7 +64,7 @@
{
base.SaveData();
this.WriteAscii(this.SignalName);
WriteAscii(SignalName);
}
}
}
@@ -34,7 +34,7 @@
/// </summary>
public SubsystemRequestInfo()
{
this.WantReply = true;
WantReply = true;
}
/// <summary>
@@ -44,7 +44,7 @@
public SubsystemRequestInfo(string subsystem)
: this()
{
this.SubsystemName = subsystem;
SubsystemName = subsystem;
}
/// <summary>
@@ -54,7 +54,7 @@
{
base.LoadData();
this.SubsystemName = this.ReadAsciiString();
SubsystemName = ReadAsciiString();
}
/// <summary>
@@ -64,7 +64,7 @@
{
base.SaveData();
this.WriteAscii(this.SubsystemName);
WriteAscii(SubsystemName);
}
}
}
@@ -46,7 +46,7 @@
/// </summary>
public WindowChangeRequestInfo()
{
this.WantReply = false;
WantReply = false;
}
/// <summary>
@@ -59,10 +59,10 @@
public WindowChangeRequestInfo(uint columns, uint rows, uint width, uint height)
: this()
{
this.Columns = columns;
this.Rows = rows;
this.Width = width;
this.Height = height;
Columns = columns;
Rows = rows;
Width = width;
Height = height;
}
/// <summary>
@@ -72,10 +72,10 @@
{
base.LoadData();
this.Columns = this.ReadUInt32();
this.Rows = this.ReadUInt32();
this.Width = this.ReadUInt32();
this.Height = this.ReadUInt32();
Columns = ReadUInt32();
Rows = ReadUInt32();
Width = ReadUInt32();
Height = ReadUInt32();
}
/// <summary>
@@ -85,10 +85,10 @@
{
base.SaveData();
this.Write(this.Columns);
this.Write(this.Rows);
this.Write(this.Width);
this.Write(this.Height);
Write(Columns);
Write(Rows);
Write(Width);
Write(Height);
}
}
}
@@ -58,7 +58,7 @@
/// </summary>
public X11ForwardingRequestInfo()
{
this.WantReply = true;
WantReply = true;
}
/// <summary>
@@ -71,10 +71,10 @@
public X11ForwardingRequestInfo(bool isSingleConnection, string protocol, byte[] cookie, uint screenNumber)
: this()
{
this.IsSingleConnection = isSingleConnection;
this.AuthenticationProtocol = protocol;
this.AuthenticationCookie = cookie;
this.ScreenNumber = screenNumber;
IsSingleConnection = isSingleConnection;
AuthenticationProtocol = protocol;
AuthenticationCookie = cookie;
ScreenNumber = screenNumber;
}
/// <summary>
@@ -84,10 +84,10 @@
{
base.LoadData();
this.IsSingleConnection = this.ReadBoolean();
this.AuthenticationProtocol = this.ReadAsciiString();
this.AuthenticationCookie = this.ReadBinaryString();
this.ScreenNumber = this.ReadUInt32();
IsSingleConnection = ReadBoolean();
AuthenticationProtocol = ReadAsciiString();
AuthenticationCookie = ReadBinaryString();
ScreenNumber = ReadUInt32();
}
/// <summary>
@@ -97,10 +97,10 @@
{
base.SaveData();
this.Write(this.IsSingleConnection);
this.WriteAscii(this.AuthenticationProtocol);
this.WriteBinaryString(this.AuthenticationCookie);
this.Write(this.ScreenNumber);
Write(IsSingleConnection);
WriteAscii(AuthenticationProtocol);
WriteBinaryString(AuthenticationCookie);
Write(ScreenNumber);
}
}
}
@@ -34,7 +34,7 @@
/// </summary>
public XonXoffRequestInfo()
{
this.WantReply = false;
WantReply = false;
}
/// <summary>
@@ -44,7 +44,7 @@
public XonXoffRequestInfo(bool clientCanDo)
: this()
{
this.ClientCanDo = clientCanDo;
ClientCanDo = clientCanDo;
}
/// <summary>
@@ -54,7 +54,7 @@
{
base.LoadData();
this.ClientCanDo = this.ReadBoolean();
ClientCanDo = ReadBoolean();
}
/// <summary>
@@ -64,7 +64,7 @@
{
base.SaveData();
this.Write(this.ClientCanDo);
Write(ClientCanDo);
}
}
}
@@ -20,7 +20,7 @@
/// <param name="localChannelNumber">The local channel number.</param>
public ChannelSuccessMessage(uint localChannelNumber)
{
this.LocalChannelNumber = localChannelNumber;
LocalChannelNumber = localChannelNumber;
}
}
}
@@ -26,8 +26,8 @@
/// <param name="bytesToAdd">The bytes to add.</param>
public ChannelWindowAdjustMessage(uint localChannelNumber, uint bytesToAdd)
{
this.LocalChannelNumber = localChannelNumber;
this.BytesToAdd = bytesToAdd;
LocalChannelNumber = localChannelNumber;
BytesToAdd = bytesToAdd;
}
/// <summary>
@@ -36,7 +36,7 @@
protected override void LoadData()
{
base.LoadData();
this.BytesToAdd = this.ReadUInt32();
BytesToAdd = ReadUInt32();
}
/// <summary>
@@ -45,7 +45,7 @@
protected override void SaveData()
{
base.SaveData();
this.Write(this.BytesToAdd);
Write(BytesToAdd);
}
}
}
@@ -50,8 +50,8 @@ namespace Renci.SshNet.Messages.Connection
/// <param name="wantReply">if set to <c>true</c> [want reply].</param>
public GlobalRequestMessage(GlobalRequestName requestName, bool wantReply)
{
this.RequestName = requestName;
this.WantReply = wantReply;
RequestName = requestName;
WantReply = wantReply;
}
/// <summary>
@@ -64,8 +64,8 @@ namespace Renci.SshNet.Messages.Connection
public GlobalRequestMessage(GlobalRequestName requestName, bool wantReply, string addressToBind, uint portToBind)
: this(requestName, wantReply)
{
this.AddressToBind = addressToBind;
this.PortToBind = portToBind;
AddressToBind = addressToBind;
PortToBind = portToBind;
}
/// <summary>
@@ -73,21 +73,21 @@ namespace Renci.SshNet.Messages.Connection
/// </summary>
protected override void LoadData()
{
var requestName = this.ReadAsciiString();
var requestName = ReadAsciiString();
this.WantReply = this.ReadBoolean();
WantReply = ReadBoolean();
switch (requestName)
{
case "tcpip-forward":
this.RequestName = GlobalRequestName.TcpIpForward;
this.AddressToBind = this.ReadString();
this.PortToBind = this.ReadUInt32();
RequestName = GlobalRequestName.TcpIpForward;
AddressToBind = ReadString();
PortToBind = ReadUInt32();
break;
case "cancel-tcpip-forward":
this.RequestName = GlobalRequestName.CancelTcpIpForward;
this.AddressToBind = this.ReadString();
this.PortToBind = this.ReadUInt32();
RequestName = GlobalRequestName.CancelTcpIpForward;
AddressToBind = ReadString();
PortToBind = ReadUInt32();
break;
}
}
@@ -97,24 +97,24 @@ namespace Renci.SshNet.Messages.Connection
/// </summary>
protected override void SaveData()
{
switch (this.RequestName)
switch (RequestName)
{
case GlobalRequestName.TcpIpForward:
this.WriteAscii("tcpip-forward");
WriteAscii("tcpip-forward");
break;
case GlobalRequestName.CancelTcpIpForward:
this.WriteAscii("cancel-tcpip-forward");
WriteAscii("cancel-tcpip-forward");
break;
}
this.Write(this.WantReply);
Write(WantReply);
switch (this.RequestName)
switch (RequestName)
{
case GlobalRequestName.TcpIpForward:
case GlobalRequestName.CancelTcpIpForward:
this.Write(this.AddressToBind);
this.Write(this.PortToBind);
Write(AddressToBind);
Write(PortToBind);
break;
}
}
@@ -25,7 +25,7 @@
/// <param name="boundPort">The bound port.</param>
public RequestSuccessMessage(uint boundPort)
{
this.BoundPort = boundPort;
BoundPort = boundPort;
}
/// <summary>
@@ -33,8 +33,8 @@
/// </summary>
protected override void LoadData()
{
if (!this.IsEndOfData)
this.BoundPort = this.ReadUInt32();
if (!IsEndOfData)
BoundPort = ReadUInt32();
}
/// <summary>
@@ -42,8 +42,8 @@
/// </summary>
protected override void SaveData()
{
if (this.BoundPort != null)
this.Write(this.BoundPort.Value);
if (BoundPort != null)
Write(BoundPort.Value);
}
}
}
@@ -30,10 +30,10 @@ namespace Renci.SshNet.Messages
/// <returns>Byte array representation of the message</returns>
public override byte[] GetBytes()
{
var messageAttribute = this.GetType().GetCustomAttributes(typeof(MessageAttribute), true).SingleOrDefault() as MessageAttribute;
var messageAttribute = GetType().GetCustomAttributes(typeof(MessageAttribute), true).SingleOrDefault() as MessageAttribute;
if (messageAttribute == null)
throw new SshException(string.Format(CultureInfo.CurrentCulture, "Type '{0}' is not a valid message type.", this.GetType().AssemblyQualifiedName));
throw new SshException(string.Format(CultureInfo.CurrentCulture, "Type '{0}' is not a valid message type.", GetType().AssemblyQualifiedName));
var data = new List<byte>(base.GetBytes());
@@ -50,10 +50,10 @@ namespace Renci.SshNet.Messages
/// </returns>
public override string ToString()
{
var messageAttribute = this.GetType().GetCustomAttributes(typeof(MessageAttribute), true).SingleOrDefault() as MessageAttribute;
var messageAttribute = GetType().GetCustomAttributes(typeof(MessageAttribute), true).SingleOrDefault() as MessageAttribute;
if (messageAttribute == null)
return string.Format(CultureInfo.CurrentCulture, "'{0}' without Message attribute.", this.GetType().FullName);
return string.Format(CultureInfo.CurrentCulture, "'{0}' without Message attribute.", GetType().FullName);
return messageAttribute.Name;
}
@@ -32,8 +32,8 @@ namespace Renci.SshNet.Messages
/// <param name="number">The number.</param>
public MessageAttribute(string name, byte number)
{
this.Name = name;
this.Number = number;
Name = name;
Number = number;
}
}
}
@@ -30,9 +30,9 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void LoadData()
{
this.IsAlwaysDisplay = this.ReadBoolean();
this.Message = this.ReadString();
this.Language = this.ReadString();
IsAlwaysDisplay = ReadBoolean();
Message = ReadString();
Language = ReadString();
}
/// <summary>
@@ -40,9 +40,9 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void SaveData()
{
this.Write(this.IsAlwaysDisplay);
this.Write(this.Message);
this.Write(this.Language);
Write(IsAlwaysDisplay);
Write(Message);
Write(Language);
}
}
}
@@ -26,7 +26,6 @@
/// </summary>
public DisconnectMessage()
{
}
/// <summary>
@@ -36,8 +35,8 @@
/// <param name="message">The message.</param>
public DisconnectMessage(DisconnectReason reasonCode, string message)
{
this.ReasonCode = reasonCode;
this.Description = message;
ReasonCode = reasonCode;
Description = message;
}
/// <summary>
@@ -45,9 +44,9 @@
/// </summary>
protected override void LoadData()
{
this.ReasonCode = (DisconnectReason)this.ReadUInt32();
this.Description = this.ReadString();
this.Language = this.ReadString();
ReasonCode = (DisconnectReason)ReadUInt32();
Description = ReadString();
Language = ReadString();
}
/// <summary>
@@ -55,9 +54,9 @@
/// </summary>
protected override void SaveData()
{
this.Write((uint)this.ReasonCode);
this.Write(this.Description);
this.Write(this.Language ?? "en");
Write((uint)ReasonCode);
Write(Description);
Write(Language ?? "en");
}
}
}
@@ -16,7 +16,7 @@
/// </summary>
public IgnoreMessage()
{
this.Data = new byte[] { };
Data = new byte[] { };
}
/// <summary>
@@ -25,7 +25,7 @@
/// <param name="data">The data.</param>
public IgnoreMessage(byte[] data)
{
this.Data = data;
Data = data;
}
/// <summary>
@@ -33,7 +33,7 @@
/// </summary>
protected override void LoadData()
{
this.Data = this.ReadBinaryString();
Data = ReadBinaryString();
}
/// <summary>
@@ -41,7 +41,7 @@
/// </summary>
protected override void SaveData()
{
this.WriteBinaryString(this.Data);
WriteBinaryString(Data);
}
}
}
@@ -29,8 +29,8 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void LoadData()
{
this.SafePrime = this.ReadBigInt();
this.SubGroup = this.ReadBigInt();
SafePrime = ReadBigInt();
SubGroup = ReadBigInt();
}
/// <summary>
@@ -38,8 +38,8 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void SaveData()
{
this.Write(this.SafePrime);
this.Write(this.SubGroup);
Write(SafePrime);
Write(SubGroup);
}
}
}
@@ -19,7 +19,7 @@ namespace Renci.SshNet.Messages.Transport
/// <param name="clientExchangeValue">The client exchange value.</param>
public KeyExchangeDhGroupExchangeInit(BigInteger clientExchangeValue)
{
this.E = clientExchangeValue;
E = clientExchangeValue;
}
/// <summary>
@@ -27,7 +27,7 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void LoadData()
{
this.E = this.ReadBigInt();
E = ReadBigInt();
}
/// <summary>
@@ -35,7 +35,7 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void SaveData()
{
this.Write(this.E);
Write(E);
}
}
}
@@ -30,9 +30,9 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void LoadData()
{
this.HostKey = this.ReadBinaryString();
this.F = this.ReadBigInt();
this.Signature = this.ReadBinaryString();
HostKey = ReadBinaryString();
F = ReadBigInt();
Signature = ReadBinaryString();
}
/// <summary>
@@ -40,9 +40,9 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void SaveData()
{
this.WriteBinaryString(this.HostKey);
this.Write(this.F);
this.WriteBinaryString(this.Signature);
WriteBinaryString(HostKey);
Write(F);
WriteBinaryString(Signature);
}
}
}
@@ -40,9 +40,9 @@ namespace Renci.SshNet.Messages.Transport
/// <param name="maximum">The maximum.</param>
public KeyExchangeDhGroupExchangeRequest(uint minimum, uint preferred, uint maximum)
{
this.Minimum = minimum;
this.Preferred = preferred;
this.Maximum = maximum;
Minimum = minimum;
Preferred = preferred;
Maximum = maximum;
}
/// <summary>
@@ -50,9 +50,9 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void LoadData()
{
this.Minimum = this.ReadUInt32();
this.Preferred = this.ReadUInt32();
this.Maximum = this.ReadUInt32();
Minimum = ReadUInt32();
Preferred = ReadUInt32();
Maximum = ReadUInt32();
}
/// <summary>
@@ -60,9 +60,9 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void SaveData()
{
this.Write(this.Minimum);
this.Write(this.Preferred);
this.Write(this.Maximum);
Write(Minimum);
Write(Preferred);
Write(Maximum);
}
}
}
@@ -19,7 +19,7 @@ namespace Renci.SshNet.Messages.Transport
/// <param name="clientExchangeValue">The client exchange value.</param>
public KeyExchangeDhInitMessage(BigInteger clientExchangeValue)
{
this.E = clientExchangeValue;
E = clientExchangeValue;
}
/// <summary>
@@ -27,8 +27,8 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void LoadData()
{
this.ResetReader();
this.E = this.ReadBigInt();
ResetReader();
E = ReadBigInt();
}
/// <summary>
@@ -36,7 +36,7 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void SaveData()
{
this.Write(this.E);
Write(E);
}
}
}
@@ -30,10 +30,10 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void LoadData()
{
this.ResetReader();
this.HostKey = this.ReadBinaryString();
this.F = this.ReadBigInt();
this.Signature = this.ReadBinaryString();
ResetReader();
HostKey = ReadBinaryString();
F = ReadBigInt();
Signature = ReadBinaryString();
}
/// <summary>
@@ -41,9 +41,9 @@ namespace Renci.SshNet.Messages.Transport
/// </summary>
protected override void SaveData()
{
this.WriteBinaryString(this.HostKey);
this.Write(this.F);
this.WriteBinaryString(this.Signature);
WriteBinaryString(HostKey);
Write(F);
WriteBinaryString(Signature);
}
}
}

Some files were not shown because too many files have changed in this diff Show More