Fix compiler and (correct) resharper warnings across the solution.

This commit is contained in:
Gert Driesen
2014-03-04 18:30:43 +00:00
parent 7834d4ab59
commit cd640aa1cd
242 changed files with 661 additions and 1532 deletions
@@ -34,6 +34,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\Renci.SshNet.XML</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
@@ -876,7 +877,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -50,6 +50,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>Bin\Release\Renci.SshNet.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
@@ -834,7 +835,7 @@
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -6,16 +6,15 @@ using System.Threading;
using Renci.SshNet.Common;
using Renci.SshNet.Messages.Transport;
using System.Text;
using Renci.SshNet.Messages;
using System.Collections.Generic;
namespace Renci.SshNet
{
public partial class Session
{
private AutoResetEvent _autoEvent = new AutoResetEvent(false);
private AutoResetEvent _sendEvent = new AutoResetEvent(false);
private AutoResetEvent _receiveEvent = new AutoResetEvent(false);
private readonly AutoResetEvent _autoEvent = new AutoResetEvent(false);
private readonly AutoResetEvent _sendEvent = new AutoResetEvent(false);
private readonly AutoResetEvent _receiveEvent = new AutoResetEvent(false);
private bool _isConnected = false;
@@ -29,7 +28,7 @@ namespace Renci.SshNet
var ep = new DnsEndPoint(host, port);
this._socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
SocketAsyncEventArgs args = new SocketAsyncEventArgs();
var args = new SocketAsyncEventArgs();
args.UserToken = this._socket;
args.RemoteEndPoint = ep;
@@ -53,6 +53,7 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>Bin\Release\Renci.SshNet.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
@@ -846,7 +847,7 @@
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -12,9 +12,9 @@ namespace Renci.SshNet
{
public partial class Session
{
private AutoResetEvent _autoEvent = new AutoResetEvent(false);
private AutoResetEvent _sendEvent = new AutoResetEvent(false);
private AutoResetEvent _receiveEvent = new AutoResetEvent(false);
private readonly AutoResetEvent _autoEvent = new AutoResetEvent(false);
private readonly AutoResetEvent _sendEvent = new AutoResetEvent(false);
private readonly AutoResetEvent _receiveEvent = new AutoResetEvent(false);
private bool _isConnected = false;
@@ -28,7 +28,7 @@ namespace Renci.SshNet
var ep = new DnsEndPoint(host, port);
this._socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
SocketAsyncEventArgs args = new SocketAsyncEventArgs();
var args = new SocketAsyncEventArgs();
args.UserToken = this._socket;
args.RemoteEndPoint = ep;
@@ -35,7 +35,7 @@
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<WarningLevel>0</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
@@ -775,7 +775,7 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="c45379b9-17b1-4e89-bc2e-6d41726413e8" />
<UserProperties ProjectLinkReference="c45379b9-17b1-4e89-bc2e-6d41726413e8" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -34,7 +34,7 @@
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<WarningLevel>0</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>
@@ -45,6 +45,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>Bin\Release\Renci.SshNet.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="system" />
@@ -50,6 +50,7 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>Bin\Release\Renci.SshNet.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
@@ -870,7 +871,7 @@
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Renci.SshNet.Common;
namespace Renci.SshNet
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet
namespace Renci.SshNet
{
/// <summary>
/// Represents possible authentication methods results
+3 -8
View File
@@ -1,5 +1,4 @@
using System;
using System.IO;
using System.Threading;
using Renci.SshNet.Common;
@@ -36,8 +35,7 @@ namespace Renci.SshNet
{
if (this.Session == null)
return false;
else
return this.Session.IsConnected;
return this.Session.IsConnected;
}
}
@@ -59,10 +57,7 @@ namespace Renci.SshNet
if (this._keepAliveTimer == null)
{
this._keepAliveTimer = new Timer((state) =>
{
this.SendKeepAlive();
});
this._keepAliveTimer = new Timer(state => this.SendKeepAlive());
}
this._keepAliveTimer.Change(this._keepAliveInterval, this._keepAliveInterval);
@@ -200,7 +195,7 @@ namespace Renci.SshNet
#region IDisposable Members
private bool _isDisposed = false;
private bool _isDisposed;
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged ResourceMessages.
@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Threading;
using Renci.SshNet.Common;
using Renci.SshNet.Messages;
@@ -21,9 +20,9 @@ namespace Renci.SshNet.Channels
private EventWaitHandle _disconnectedWaitHandle = new ManualResetEvent(false);
private object _serverWindowSizeLock = new object();
private readonly object _serverWindowSizeLock = new object();
private bool _closeMessageSent = false;
private bool _closeMessageSent;
private uint _initialWindowSize = 0x100000;
@@ -676,7 +675,7 @@ namespace Renci.SshNet.Channels
#region IDisposable Members
private bool _isDisposed = false;
private bool _isDisposed;
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
@@ -1,5 +1,4 @@
using System.Threading.Tasks;
using System;
using System;
using System.Net.Sockets;
using System.Threading;
@@ -12,7 +11,7 @@ namespace Renci.SshNet.Channels
{
partial void ExecuteThread(Action action)
{
ThreadPool.QueueUserWorkItem((o) => { action(); });
ThreadPool.QueueUserWorkItem(o => action());
}
partial void InternalSocketReceive(byte[] buffer, ref int read)
@@ -36,17 +36,14 @@ namespace Renci.SshNet.Channels
/// Initializes a new instance of the <see cref="ChannelDirectTcpip"/> class.
/// </summary>
public ChannelDirectTcpip()
: base()
{
}
public void Open(string remoteHost, uint port, Socket socket)
{
this._socket = socket;
IPEndPoint ep = socket.RemoteEndPoint as IPEndPoint;
var ep = socket.RemoteEndPoint as IPEndPoint;
if (!this.IsConnected)
{
@@ -1,10 +1,5 @@
using System;
using System.Linq;
using System.Net;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Renci.SshNet.Common;
using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Channels
{
@@ -30,9 +30,7 @@ namespace Renci.SshNet.Channels
/// Initializes a new instance of the <see cref="ChannelForwardedTcpip"/> class.
/// </summary>
public ChannelForwardedTcpip()
: base()
{
}
/// <summary>
@@ -42,7 +40,7 @@ namespace Renci.SshNet.Channels
/// <param name="connectedPort">The connected port.</param>
public void Bind(IPAddress connectedHost, uint connectedPort)
{
byte[] buffer = null;
byte[] buffer;
this.ServerWindowSize = this.LocalWindowSize;
@@ -75,7 +73,7 @@ namespace Renci.SshNet.Channels
{
try
{
int read = 0;
var read = 0;
this.InternalSocketReceive(buffer, ref read);
if (read > 0)
@@ -1,10 +1,8 @@
using System.Diagnostics;
using System.Threading;
using System.Threading;
using Renci.SshNet.Common;
using Renci.SshNet.Messages.Connection;
using System.Globalization;
using System.Collections.Generic;
using System.Text;
namespace Renci.SshNet.Channels
{
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Renci.SshNet.Security.Cryptography;
namespace Renci.SshNet
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -12,7 +9,7 @@ namespace Renci.SshNet.Common
{
private readonly char _fallbackChar;
private static char[] _byteToChar;
private static readonly char[] _byteToChar;
static ASCIIEncoding()
{
@@ -120,8 +120,8 @@ namespace Renci.SshNet.Common
{
if (this._asyncWaitHandle == null)
{
Boolean done = this.IsCompleted;
ManualResetEvent mre = new ManualResetEvent(done);
var done = this.IsCompleted;
var mre = new ManualResetEvent(done);
if (Interlocked.CompareExchange(ref this._asyncWaitHandle, mre, null) != null)
{
// Another thread created this object's event; dispose the event we just created
@@ -168,7 +168,8 @@ namespace Renci.SshNet.Common
/// <param name="state">The state.</param>
public AsyncResult(AsyncCallback asyncCallback, Object state)
: base(asyncCallback, state)
{ }
{
}
/// <summary>
/// Marks asynchronous operation as completed.
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
namespace Renci.SshNet.Common
{
/// <summary>
/// Provides data for <see cref="Renci.SshNet.ConnectionInfo.AuthenticationBanner"/> event.
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Renci.SshNet.Messages.Authentication;
namespace Renci.SshNet.Common
{
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
namespace Renci.SshNet.Common
{
/// <summary>
/// Provides data for <see cref="Renci.SshNet.PasswordConnectionInfo.PasswordExpired"/> event.
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
namespace Renci.SshNet.Common
{
/// <summary>
/// Provides prompt information when <see cref="Renci.SshNet.KeyboardInteractiveConnectionInfo.AuthenticationPrompt"/> is raised
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;
namespace Renci.SshNet.Common
{
@@ -46,11 +46,7 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text;
using System.Threading;
using System.Security.Cryptography;
/*
@@ -70,14 +66,14 @@ namespace Renci.SshNet.Common
/// </summary>
public struct BigInteger : IComparable, IFormattable, IComparable<BigInteger>, IEquatable<BigInteger>
{
private static RNGCryptoServiceProvider _randomizer = new System.Security.Cryptography.RNGCryptoServiceProvider();
private static readonly RNGCryptoServiceProvider _randomizer = new RNGCryptoServiceProvider();
private const ulong _BASE = 0x100000000;
private const Int32 _DECIMALSIGNMASK = unchecked((Int32)0x80000000);
private const int _BIAS = 1075;
private static readonly uint[] _zero = new uint[1];
private static readonly uint[] _one = new uint[1] { 1 };
private static readonly uint[] _one = new uint[] { 1 };
//LSB on [0]
private readonly uint[] _data;
@@ -2641,7 +2637,7 @@ namespace Renci.SshNet.Common
/// </returns>
public string ToString(string format, IFormatProvider provider)
{
if (format == null || format == "")
if (string.IsNullOrEmpty(format))
return ToString(10, provider);
switch (format[0])
@@ -2676,7 +2672,7 @@ namespace Renci.SshNet.Common
/// null or is not in a format that is compliant with style. This parameter is
/// passed uninitialized.</param>
/// <returns>true if the value parameter was converted successfully; otherwise, false.</returns>
public static bool TryParse(string value, System.Globalization.NumberStyles style, CultureInfo cultureInfo, out BigInteger result)
public static bool TryParse(string value, NumberStyles style, CultureInfo cultureInfo, out BigInteger result)
{
Exception ex;
return Parse(value, true, style, cultureInfo, out result, out ex);
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -41,10 +40,10 @@ namespace Renci.SshNet.Common
//private const byte APPLICATION = 0x40;
//private const byte TAGGED = 0x80;
private List<byte> _data;
private readonly List<byte> _data;
private int _readerIndex = 0;
private int _lastIndex;
private int _readerIndex;
private readonly int _lastIndex;
/// <summary>
/// Gets a value indicating whether end of data is reached.
@@ -271,10 +270,7 @@ namespace Renci.SshNet.Common
return data;
}
else
{
return new byte[] { (byte)length };
}
return new byte[] { (byte)length };
}
private int ReadLength()
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
namespace Renci.SshNet
{
@@ -1,7 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System;
using System.Globalization;
using System.Text.RegularExpressions;
@@ -24,46 +22,40 @@ namespace Renci.SshNet
internal static bool IsEqualTo<TSource>(this IEnumerable<TSource> value, IEnumerable<TSource> compareList, IEqualityComparer<TSource> comparer)
{
if (value == compareList)
{
return true;
}
else if (value == null || compareList == null)
{
if (value == null || compareList == null)
return false;
}
else
if (comparer == null)
{
if (comparer == null)
comparer = EqualityComparer<TSource>.Default;
}
var enumerator1 = value.GetEnumerator();
var enumerator2 = compareList.GetEnumerator();
bool enum1HasValue = enumerator1.MoveNext();
bool enum2HasValue = enumerator2.MoveNext();
try
{
while (enum1HasValue && enum2HasValue)
{
comparer = EqualityComparer<TSource>.Default;
}
IEnumerator<TSource> enumerator1 = value.GetEnumerator();
IEnumerator<TSource> enumerator2 = compareList.GetEnumerator();
bool enum1HasValue = enumerator1.MoveNext();
bool enum2HasValue = enumerator2.MoveNext();
try
{
while (enum1HasValue && enum2HasValue)
if (!comparer.Equals(enumerator1.Current, enumerator2.Current))
{
if (!comparer.Equals(enumerator1.Current, enumerator2.Current))
{
return false;
}
enum1HasValue = enumerator1.MoveNext();
enum2HasValue = enumerator2.MoveNext();
return false;
}
return !(enum1HasValue || enum2HasValue);
}
finally
{
if (enumerator1 != null) enumerator1.Dispose();
if (enumerator2 != null) enumerator2.Dispose();
enum1HasValue = enumerator1.MoveNext();
enum2HasValue = enumerator2.MoveNext();
}
return !(enum1HasValue || enum2HasValue);
}
finally
{
enumerator1.Dispose();
enumerator2.Dispose();
}
}
@@ -109,10 +101,7 @@ namespace Renci.SshNet
{
continue;
}
else
{
leadingZero = false;
}
leadingZero = false;
yield return item;
}
@@ -176,9 +165,9 @@ namespace Renci.SshNet
private static Regex _reIPv6 = new Regex(@"^(((?=(?>.*?::)(?!.*::)))(::)?([0-9A-F]{1,4}::?){0,5}|([0-9A-F]{1,4}:){6})(\2([0-9A-F]{1,4}(::?|$)){0,2}|((25[0-5]|(2[0-4]|1\d|[1-9])?\d)(\.|$)){4}|[0-9A-F]{1,4}:[0-9A-F]{1,4})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase);
#else
private static Regex _rehost = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex _rehost = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static Regex _reIPv6 = new Regex(@"^(((?=(?>.*?::)(?!.*::)))(::)?([0-9A-F]{1,4}::?){0,5}|([0-9A-F]{1,4}:){6})(\2([0-9A-F]{1,4}(::?|$)){0,2}|((25[0-5]|(2[0-4]|1\d|[1-9])?\d)(\.|$)){4}|[0-9A-F]{1,4}:[0-9A-F]{1,4})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex _reIPv6 = new Regex(@"^(((?=(?>.*?::)(?!.*::)))(::)?([0-9A-F]{1,4}::?){0,5}|([0-9A-F]{1,4}:){6})(\2([0-9A-F]{1,4}(::?|$)){0,2}|((25[0-5]|(2[0-4]|1\d|[1-9])?\d)(\.|$)){4}|[0-9A-F]{1,4}:[0-9A-F]{1,4})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase | RegexOptions.Compiled);
#endif
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Renci.SshNet.Security.Cryptography;
using Renci.SshNet.Security;
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace Renci.SshNet.Common
@@ -18,7 +15,6 @@ namespace Renci.SshNet.Common
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
///
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
protected NetConfServerException(SerializationInfo info, StreamingContext context)
: base(info, context)
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
/// </summary>
public NetConfServerException()
{
}
/// <summary>
@@ -25,7 +21,6 @@ namespace Renci.SshNet.Common
public NetConfServerException(string message)
: base(message)
{
}
/// <summary>
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -162,7 +162,7 @@
if (offset != 0)
throw new NotSupportedException("Offsets with value of non-zero are not supported");
if (buffer == null)
throw new ArgumentNullException("Buffer is null");
throw new ArgumentNullException("buffer");
if (offset + count > buffer.Length)
throw new ArgumentException("The sum of offset and count is greater than the buffer length. ");
if (offset < 0 || count < 0)
@@ -217,7 +217,7 @@
public override void Write(byte[] buffer, int offset, int count)
{
if (buffer == null)
throw new ArgumentNullException("Buffer is null");
throw new ArgumentNullException("buffer");
if (offset + count > buffer.Length)
throw new ArgumentException("The sum of offset and count is greater than the buffer length. ");
if (offset < 0 || count < 0)
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace Renci.SshNet.Common
@@ -14,9 +11,8 @@ namespace Renci.SshNet.Common
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
///
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
/// <exception cref="ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
/// <exception cref="SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
protected ProxyException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
/// </summary>
public ProxyException()
{
}
/// <summary>
@@ -25,7 +21,6 @@ namespace Renci.SshNet.Common
public ProxyException(string message)
: base(message)
{
}
/// <summary>
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace Renci.SshNet.Common
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
///
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
protected ScpException(SerializationInfo info, StreamingContext context)
: base(info, context)
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace Renci.SshNet.Common
@@ -11,7 +8,7 @@ namespace Renci.SshNet.Common
/// </summary>
public class SemaphoreLight
{
private object _lock = new object();
private readonly object _lock = new object();
private int _currentCount;
@@ -24,7 +21,7 @@ namespace Renci.SshNet.Common
public SemaphoreLight(int initialCount)
{
if (initialCount < 0 )
throw new ArgumentOutOfRangeException("The initial argument is negative");
throw new ArgumentOutOfRangeException("initialCount", "The value cannot be negative.");
this._currentCount = initialCount;
}
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace Renci.SshNet.Common
@@ -18,7 +15,6 @@ namespace Renci.SshNet.Common
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
///
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
protected SftpPathNotFoundException(SerializationInfo info, StreamingContext context)
: base(info, context)
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
/// </summary>
public SftpPathNotFoundException()
{
}
/// <summary>
@@ -25,7 +21,6 @@ namespace Renci.SshNet.Common
public SftpPathNotFoundException(string message)
: base(message)
{
}
/// <summary>
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace Renci.SshNet.Common
@@ -18,7 +15,6 @@ namespace Renci.SshNet.Common
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
///
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
protected SftpPermissionDeniedException(SerializationInfo info, StreamingContext context)
: base(info, context)
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
/// </summary>
public SftpPermissionDeniedException()
{
}
/// <summary>
@@ -25,7 +21,6 @@ namespace Renci.SshNet.Common
public SftpPermissionDeniedException(string message)
: base(message)
{
}
/// <summary>
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace Renci.SshNet.Common
@@ -18,7 +15,6 @@ namespace Renci.SshNet.Common
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
///
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
protected SshAuthenticationException(SerializationInfo info, StreamingContext context)
: base(info, context)
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
{
@@ -1,5 +1,4 @@
using System;
using Renci.SshNet.Messages.Transport;
using System.Runtime.Serialization;
namespace Renci.SshNet.Common
@@ -16,21 +15,10 @@ namespace Renci.SshNet.Common
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
///
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
protected SshConnectionException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
/// <summary>
/// Gets the object data.
/// </summary>
/// <param name="info">The info.</param>
/// <param name="context">The context.</param>
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
{
base.GetObjectData(info, context);
}
}
}
+12 -4
View File
@@ -11,12 +11,12 @@ namespace Renci.SshNet.Common
/// </summary>
public abstract class SshData
{
private static Encoding _ascii = new ASCIIEncoding();
private static readonly Encoding _ascii = new ASCIIEncoding();
#if SILVERLIGHT
private static Encoding _utf8 = Encoding.UTF8;
private static readonly Encoding _utf8 = Encoding.UTF8;
#else
private static Encoding _utf8 = Encoding.Default;
private static readonly Encoding _utf8 = Encoding.Default;
#endif
/// <summary>
@@ -401,10 +401,19 @@ namespace Renci.SshNet.Common
this.Write(data, SshData._utf8);
}
/// <summary>
/// Writes string data into internal buffer using the specified encoding.
/// </summary>
/// <param name="data">string data to write.</param>
/// <param name="encoding">The character encoding to use.</param>
/// <exception cref="ArgumentNullException"><paramref name="data"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="encoding"/> is null.</exception>
protected void Write(string data, Encoding encoding)
{
if (data == null)
throw new ArgumentNullException("data");
if (encoding == null)
throw new ArgumentNullException("encoding");
var bytes = encoding.GetBytes(data);
this.Write((uint)bytes.Length);
@@ -445,7 +454,6 @@ namespace Renci.SshNet.Common
this.WriteAscii(string.Join(",", data));
}
/// <summary>
/// Writes extension-pair data into internal buffer.
/// </summary>
@@ -21,22 +21,5 @@ namespace Renci.SshNet.Common
: base(info, context)
{
}
/// <summary>
/// When overridden in a derived class, sets the <see cref="T:System.Runtime.Serialization.SerializationInfo"/> with information about the exception.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is a null reference (Nothing in Visual Basic). </exception>
///
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*"/>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter"/>
/// </PermissionSet>
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
}
}
}
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace Renci.SshNet.Common
@@ -15,7 +12,6 @@ namespace Renci.SshNet.Common
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
///
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
protected SshOperationTimeoutException(SerializationInfo info, StreamingContext context)
: base(info, context)
@@ -12,7 +12,6 @@ namespace Renci.SshNet.Common
/// </summary>
public SshOperationTimeoutException()
{
}
/// <summary>
@@ -22,7 +21,6 @@ namespace Renci.SshNet.Common
public SshOperationTimeoutException(string message)
: base(message)
{
}
/// <summary>
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace Renci.SshNet.Common
@@ -18,7 +15,6 @@ namespace Renci.SshNet.Common
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> parameter is null. </exception>
///
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). </exception>
protected SshPassPhraseNullOrEmptyException(SerializationInfo info, StreamingContext context)
: base(info, context)
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace Renci.SshNet.Common
{
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Common
namespace Renci.SshNet.Common
{
/// <summary>
/// Specifies the initial assignments of the opcode values that are used in the 'encoded terminal modes' valu
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Renci.SshNet.Security;
using Renci.SshNet.Security;
using System.IO;
using System;
@@ -90,7 +89,7 @@ namespace Renci.SshNet.Compression
#region IDisposable Members
private bool _isDisposed = false;
private bool _isDisposed;
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged ResourceMessages.
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace Renci.SshNet.Compression
namespace Renci.SshNet.Compression
{
/// <summary>
/// Represents "zlib" compression implementation
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace Renci.SshNet.Compression
namespace Renci.SshNet.Compression
{
/// <summary>
/// Represents "zlib@openssh.org" compression implementation
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO;
namespace Renci.SshNet.Compression
{
@@ -4,15 +4,11 @@ using System.Linq;
using System.Text;
using Renci.SshNet.Security;
using Renci.SshNet.Messages.Connection;
using System.Security.Cryptography;
using Renci.SshNet.Common;
using Renci.SshNet.Messages.Authentication;
using Renci.SshNet.Security.Cryptography;
using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
using Renci.SshNet.Security.Cryptography.Ciphers;
using System.Collections.ObjectModel;
using System.Net;
using Renci.SshNet.Compression;
namespace Renci.SshNet
{
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Renci.SshNet
@@ -1,6 +1,5 @@
using Renci.SshNet.Common;
using System;
using System.Threading;
namespace Renci.SshNet
{
@@ -12,7 +11,6 @@ namespace Renci.SshNet
/// <summary>
/// Initializes a new instance of the <see cref="ExpectAsyncResult" /> class.
/// </summary>
/// <param name="shellStream">The shell stream.</param>
/// <param name="asyncCallback">The async callback.</param>
/// <param name="state">The state.</param>
internal ExpectAsyncResult(AsyncCallback asyncCallback, Object state)
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
@@ -13,7 +12,7 @@ namespace Renci.SshNet
public partial class ForwardedPortDynamic
{
private TcpListener _listener;
private object _listenerLocker = new object();
private readonly object _listenerLocker = new object();
partial void InternalStart()
{
@@ -192,8 +191,8 @@ namespace Renci.SshNet
var addressType = stream.ReadByte();
IPAddress ipAddress = null;
byte[] addressBuffer = null;
IPAddress ipAddress;
byte[] addressBuffer;
switch (addressType)
{
case 0x01:
@@ -210,7 +209,7 @@ namespace Renci.SshNet
addressBuffer = new byte[length];
stream.Read(addressBuffer, 0, addressBuffer.Length);
ipAddress = IPAddress.Parse(new Renci.SshNet.Common.ASCIIEncoding().GetString(addressBuffer));
ipAddress = IPAddress.Parse(new Common.ASCIIEncoding().GetString(addressBuffer));
}
break;
case 0x04:
@@ -1,6 +1,5 @@
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Renci.SshNet
{
@@ -8,7 +7,7 @@ namespace Renci.SshNet
{
partial void ExecuteThread(Action action)
{
ThreadPool.QueueUserWorkItem((o) => { action(); });
ThreadPool.QueueUserWorkItem(o => action());
}
}
}
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace Renci.SshNet
@@ -69,7 +66,7 @@ namespace Renci.SshNet
#region IDisposable Members
private bool _isDisposed = false;
private bool _isDisposed;
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged ResourceMessages.
@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Net.Sockets;
using System.Net;
using System.Threading;
@@ -1,6 +1,5 @@
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Renci.SshNet
{
@@ -11,7 +10,7 @@ namespace Renci.SshNet
{
partial void ExecuteThread(Action action)
{
ThreadPool.QueueUserWorkItem((o) => { action(); });
ThreadPool.QueueUserWorkItem(o => action());
}
}
}
@@ -1,6 +1,5 @@
using System;
using System.Threading;
using System.Net;
namespace Renci.SshNet
{
@@ -10,12 +9,12 @@ namespace Renci.SshNet
public partial class ForwardedPortLocal : ForwardedPort, IDisposable
{
private EventWaitHandle _listenerTaskCompleted;
/// <summary>
/// Gets the bound host.
/// </summary>
public string BoundHost { get; protected set; }
/// <summary>
/// Gets the bound port.
/// </summary>
@@ -48,12 +47,13 @@ namespace Renci.SshNet
/// <summary>
/// Initializes a new instance of the <see cref="ForwardedPortLocal"/> class.
/// </summary>
/// <param name="boundHost">The bound host.</param>
/// <param name="host">The host.</param>
/// <param name="port">The port.</param>
public ForwardedPortLocal(string boundHost, string host, uint port)
: this(boundHost, 0, host, port)
{
}
public ForwardedPortLocal(string boundHost, string host, uint port)
: this(boundHost, 0, host, port)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ForwardedPortLocal"/> class.
@@ -88,7 +88,6 @@ namespace Renci.SshNet
this.Port = port;
}
/// <summary>
/// Starts local port forwarding.
/// </summary>
@@ -115,7 +114,7 @@ namespace Renci.SshNet
#region IDisposable Members
private bool _isDisposed = false;
private bool _isDisposed;
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged ResourceMessages.
@@ -1,5 +1,4 @@
using System;
using System.Net;
using System.Net;
namespace Renci.SshNet
{
@@ -1,6 +1,5 @@
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Renci.SshNet
{
@@ -11,7 +10,7 @@ namespace Renci.SshNet
{
partial void ExecuteThread(Action action)
{
ThreadPool.QueueUserWorkItem((o) => { action(); });
ThreadPool.QueueUserWorkItem(o => action());
}
}
}
@@ -3,7 +3,6 @@ using System.Threading;
using Renci.SshNet.Channels;
using Renci.SshNet.Messages.Connection;
using Renci.SshNet.Common;
using System.Diagnostics;
using System.Globalization;
using System.Net;
@@ -67,19 +66,18 @@ namespace Renci.SshNet
/// <param name="boundPort">The bound port.</param>
/// <param name="hostAddress">The host address.</param>
/// <param name="port">The port.</param>
/// <exception cref="System.ArgumentNullException">boundHost</exception>
/// <exception cref="System.ArgumentOutOfRangeException">boundPort</exception>
/// <exception cref="ArgumentNullException"><paramref name="boundHostAddress"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentNullException"><paramref name="hostAddress"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="boundPort"/> is not a valid port.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="port"/> is not a valid port.</exception>
public ForwardedPortRemote(IPAddress boundHostAddress, uint boundPort, IPAddress hostAddress, uint port)
{
if (boundHostAddress == null)
throw new ArgumentNullException("boundHost");
throw new ArgumentNullException("boundHostAddress");
if (hostAddress == null)
throw new ArgumentNullException("host");
throw new ArgumentNullException("hostAddress");
if (!boundPort.IsValidPort())
throw new ArgumentOutOfRangeException("boundPort");
if (!port.IsValidPort())
throw new ArgumentOutOfRangeException("port");
@@ -120,10 +118,7 @@ namespace Renci.SshNet
throw new SshException(string.Format(CultureInfo.CurrentCulture, "Port forwarding for '{0}' port '{1}' failed to start.", this.Host, this.Port));
}
else
{
this.IsStarted = true;
}
this.IsStarted = true;
}
/// <summary>
@@ -175,7 +170,7 @@ namespace Renci.SshNet
}
}
private void Session_RequestFailure(object sender, System.EventArgs e)
private void Session_RequestFailure(object sender, EventArgs e)
{
this._requestStatus = false;
this._globalRequestResponse.Set();
@@ -196,7 +191,7 @@ namespace Renci.SshNet
#region IDisposable Members
private bool _isDisposed = false;
private bool _isDisposed;
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+2 -5
View File
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Renci.SshNet.Security.Cryptography;
using System.Security.Cryptography;
namespace Renci.SshNet
@@ -29,11 +26,11 @@ namespace Renci.SshNet
/// Initializes a new instance of the <see cref="CipherInfo"/> class.
/// </summary>
/// <param name="keySize">Size of the key.</param>
/// <param name="cipher">The cipher.</param>
/// <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()));
this.HashAlgorithm = key => (hash(key.Take(this.KeySize / 8).ToArray()));
}
}
}
@@ -1,21 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Renci.SshNet.Messages;
using Renci.SshNet.Messages.Authentication;
using Renci.SshNet.Common;
using System.Threading.Tasks;
namespace Renci.SshNet
{
public partial class KeyboardInteractiveAuthenticationMethod : AuthenticationMethod
{
/// <exception cref="ArgumentNullException"><paramref name="action"/> is null.</exception>
partial void ExecuteThread(Action action)
{
ThreadPool.QueueUserWorkItem((o) => { action(); });
ThreadPool.QueueUserWorkItem(o => action());
}
}
}
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Renci.SshNet.Messages;
using Renci.SshNet.Messages.Authentication;
@@ -22,7 +20,7 @@ namespace Renci.SshNet
private Exception _exception;
private RequestMessage _requestMessage;
private readonly RequestMessage _requestMessage;
/// <summary>
/// Gets authentication method name
@@ -142,7 +140,7 @@ namespace Renci.SshNet
#region IDisposable Members
private bool isDisposed = false;
private bool _isDisposed;
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
@@ -161,7 +159,7 @@ namespace Renci.SshNet
protected virtual void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if (!this.isDisposed)
if (!this._isDisposed)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
@@ -176,7 +174,7 @@ namespace Renci.SshNet
}
// Note disposing has been done.
isDisposed = true;
_isDisposed = true;
}
}
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Renci.SshNet.Common;
namespace Renci.SshNet
@@ -150,7 +148,7 @@ namespace Renci.SshNet
#region IDisposable Members
private bool isDisposed = false;
private bool _isDisposed;
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
@@ -169,7 +167,7 @@ namespace Renci.SshNet
protected virtual void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if (!this.isDisposed)
if (!this._isDisposed)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
@@ -186,7 +184,7 @@ namespace Renci.SshNet
}
// Note disposing has been done.
isDisposed = true;
_isDisposed = true;
}
}
@@ -1,6 +1,4 @@
using System.Text;
namespace Renci.SshNet.Messages.Authentication
namespace Renci.SshNet.Messages.Authentication
{
/// <summary>
/// Represents SSH_MSG_USERAUTH_BANNER message.
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
namespace Renci.SshNet.Messages.Authentication
{
@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Collections.Generic;
using Renci.SshNet.Common;
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
namespace Renci.SshNet.Messages.Authentication
namespace Renci.SshNet.Messages.Authentication
{
/// <summary>
/// Represents SSH_MSG_USERAUTH_PK_OK message.
@@ -1,5 +1,4 @@
using System;
using System.Text;
namespace Renci.SshNet.Messages.Authentication
{
@@ -1,6 +1,4 @@
using System.Text;
namespace Renci.SshNet.Messages.Authentication
namespace Renci.SshNet.Messages.Authentication
{
/// <summary>
/// Represents "hostbased" SSH_MSG_USERAUTH_REQUEST message.
@@ -1,6 +1,4 @@
using System.Text;
namespace Renci.SshNet.Messages.Authentication
namespace Renci.SshNet.Messages.Authentication
{
/// <summary>
/// Represents "keyboard-interactive" SSH_MSG_USERAUTH_REQUEST message.
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Messages.Authentication
namespace Renci.SshNet.Messages.Authentication
{
/// <summary>
/// Represents "none" SSH_MSG_USERAUTH_REQUEST message.
@@ -33,13 +28,5 @@ namespace Renci.SshNet.Messages.Authentication
: base(serviceName, username)
{
}
/// <summary>
/// Called when type specific data need to be saved.
/// </summary>
protected override void SaveData()
{
base.SaveData();
}
}
}
@@ -1,6 +1,4 @@
using System.Text;
namespace Renci.SshNet.Messages.Authentication
namespace Renci.SshNet.Messages.Authentication
{
/// <summary>
/// Represents "password" SSH_MSG_USERAUTH_REQUEST message.
@@ -1,6 +1,4 @@
using System.Collections.Generic;
namespace Renci.SshNet.Messages.Authentication
namespace Renci.SshNet.Messages.Authentication
{
/// <summary>
/// Represents "publickey" SSH_MSG_USERAUTH_REQUEST message.
@@ -18,9 +18,7 @@
/// Initializes a new instance of the <see cref="ChannelDataMessage"/> class.
/// </summary>
public ChannelDataMessage()
: base()
{
}
/// <summary>
@@ -28,6 +28,8 @@
/// Initializes a new instance of the <see cref="ChannelExtendedDataMessage"/> class.
/// </summary>
/// <param name="localChannelNumber">The local channel number.</param>
/// <param name="dataTypeCode">The message data type code.</param>
/// <param name="data">The message data.</param>
public ChannelExtendedDataMessage(uint localChannelNumber, uint dataTypeCode, byte[] data)
{
this.LocalChannelNumber = localChannelNumber;
@@ -18,7 +18,7 @@
/// </value>
public override string ChannelType
{
get { return DirectTcpipChannelInfo.NAME; }
get { return NAME; }
}
/// <summary>
@@ -18,7 +18,7 @@
/// </value>
public override string ChannelType
{
get { return ForwardedTcpipChannelInfo.NAME; }
get { return NAME; }
}
/// <summary>
@@ -18,7 +18,7 @@
/// </value>
public override string ChannelType
{
get { return SessionChannelOpenInfo.NAME; }
get { return NAME; }
}
}
}
@@ -18,7 +18,7 @@
/// </value>
public override string ChannelType
{
get { return X11ChannelOpenInfo.NAME; }
get { return NAME; }
}
/// <summary>
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Messages.Connection
{
@@ -23,7 +20,7 @@ namespace Renci.SshNet.Messages.Connection
/// </value>
public override string RequestName
{
get { return BreakRequestInfo.NAME; }
get { return NAME; }
}
/// <summary>
@@ -1,7 +1,4 @@
using System;
using System.Globalization;
namespace Renci.SshNet.Messages.Connection
namespace Renci.SshNet.Messages.Connection
{
/// <summary>
/// Represents SSH_MSG_CHANNEL_REQUEST message.
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Renci.SshNet.Messages.Connection
namespace Renci.SshNet.Messages.Connection
{
/// <summary>
/// Represents "eow@openssh.com" type channel request information
@@ -23,7 +18,7 @@ namespace Renci.SshNet.Messages.Connection
/// </value>
public override string RequestName
{
get { return EndOfWriteRequestInfo.NAME; }
get { return NAME; }
}
/// <summary>
@@ -18,7 +18,7 @@
/// </value>
public override string RequestName
{
get { return EnvironmentVariableRequestInfo.NAME; }
get { return NAME; }
}
/// <summary>
@@ -20,7 +20,7 @@ namespace Renci.SshNet.Messages.Connection
/// </value>
public override string RequestName
{
get { return ExecRequestInfo.NAME; }
get { return NAME; }
}
/// <summary>
@@ -51,12 +51,15 @@ namespace Renci.SshNet.Messages.Connection
/// Initializes a new instance of the <see cref="ExecRequestInfo"/> class.
/// </summary>
/// <param name="command">The command.</param>
/// <exception cref="System.ArgumentNullException"><paramref name="command"/> is null.</exception>
/// <param name="encoding">The character encoding to use.</param>
/// <exception cref="System.ArgumentNullException"><paramref name="command"/> or <paramref name="encoding"/> is null.</exception>
public ExecRequestInfo(string command, Encoding encoding)
: this()
{
if (command == null)
throw new System.ArgumentNullException("command");
if (encoding == null)
throw new System.ArgumentNullException("encoding");
this.Command = command;
this.Encoding = encoding;
@@ -1,5 +1,4 @@
using System.Text;
namespace Renci.SshNet.Messages.Connection
namespace Renci.SshNet.Messages.Connection
{
/// <summary>
/// Represents "exit-signal" type channel request information
@@ -19,7 +18,7 @@ namespace Renci.SshNet.Messages.Connection
/// </value>
public override string RequestName
{
get { return ExitSignalRequestInfo.NAME; }
get { return NAME; }
}
/// <summary>

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