mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 17:25:51 +00:00
Clean up logging and make silverlight and WindowsPhone projects compilable again
This commit is contained in:
@@ -715,7 +715,7 @@
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.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.
|
||||
|
||||
@@ -282,6 +282,9 @@
|
||||
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelOpen\X11ChannelOpenInfo.cs">
|
||||
<Link>Messages\Connection\ChannelOpen\X11ChannelOpenInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\BreakRequestInfo.cs">
|
||||
<Link>Messages\Connection\ChannelRequest\BreakRequestInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\ChannelRequestMessage.cs">
|
||||
<Link>Messages\Connection\ChannelRequest\ChannelRequestMessage.cs</Link>
|
||||
</Compile>
|
||||
@@ -691,7 +694,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.
|
||||
|
||||
@@ -278,6 +278,9 @@
|
||||
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelOpen\X11ChannelOpenInfo.cs">
|
||||
<Link>Messages\Connection\ChannelOpen\X11ChannelOpenInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\BreakRequestInfo.cs">
|
||||
<Link>Messages\Connection\ChannelRequest\BreakRequestInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\ChannelRequestMessage.cs">
|
||||
<Link>Messages\Connection\ChannelRequest\ChannelRequestMessage.cs</Link>
|
||||
</Compile>
|
||||
@@ -693,7 +696,7 @@
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.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.
|
||||
|
||||
@@ -7,11 +7,19 @@ using Renci.SshNet.Common;
|
||||
using System.Threading;
|
||||
using Renci.SshNet.Messages.Transport;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Renci.SshNet
|
||||
{
|
||||
public partial class Session
|
||||
{
|
||||
private TraceSource _log =
|
||||
#if DEBUG
|
||||
new TraceSource("SshNet.Logging", SourceLevels.All);
|
||||
#else
|
||||
new TraceSource("SshNet.Logging");
|
||||
#endif
|
||||
|
||||
partial void SocketConnect()
|
||||
{
|
||||
var ep = new IPEndPoint(Dns.GetHostAddresses(this.ConnectionInfo.Host)[0], this.ConnectionInfo.Port);
|
||||
@@ -23,7 +31,7 @@ namespace Renci.SshNet
|
||||
this._socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, socketBufferSize);
|
||||
this._socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, socketBufferSize);
|
||||
|
||||
this.log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 1, string.Format("Initiating connect to '{0}:{1}'.", this.ConnectionInfo.Host, this.ConnectionInfo.Port));
|
||||
this.Log(string.Format("Initiating connect to '{0}:{1}'.", this.ConnectionInfo.Host, this.ConnectionInfo.Port));
|
||||
|
||||
// Connect socket with specified timeout
|
||||
var connectResult = this._socket.BeginConnect(ep, null, null);
|
||||
@@ -111,5 +119,10 @@ namespace Renci.SshNet
|
||||
}
|
||||
} while (sent < length);
|
||||
}
|
||||
|
||||
partial void Log(string text)
|
||||
{
|
||||
this._log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 1, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ using Renci.SshNet.Security;
|
||||
using System.Globalization;
|
||||
using Renci.SshNet.Security.Cryptography.Ciphers;
|
||||
using Renci.SshNet.Security.Cryptography;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Renci.SshNet
|
||||
{
|
||||
@@ -28,14 +27,6 @@ namespace Renci.SshNet
|
||||
/// </summary>
|
||||
public partial class Session : IDisposable
|
||||
{
|
||||
|
||||
internal TraceSource log =
|
||||
#if DEBUG
|
||||
new TraceSource("SshNet.Logging", SourceLevels.All);
|
||||
#else
|
||||
new TraceSource("SshNet.Logging");
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Specifies maximum packet size defined by the protocol.
|
||||
/// </summary>
|
||||
@@ -474,7 +465,7 @@ namespace Renci.SshNet
|
||||
|
||||
var softwareName = versionMatch.Result("${softwareversion}");
|
||||
|
||||
this.log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 1, string.Format("Server version '{0}' on '{1}'.", version, softwareName));
|
||||
this.Log(string.Format("Server version '{0}' on '{1}'.", version, softwareName));
|
||||
|
||||
if (!(version.Equals("2.0") || version.Equals("1.99")))
|
||||
{
|
||||
@@ -654,7 +645,7 @@ namespace Renci.SshNet
|
||||
if (this._socket == null || !this._socket.Connected)
|
||||
return;
|
||||
|
||||
this.log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 1, string.Format("SendMessage to server '{0}': '{1}'.", message.GetType().Name, message.ToString()));
|
||||
this.Log(string.Format("SendMessage to server '{0}': '{1}'.", message.GetType().Name, message.ToString()));
|
||||
|
||||
// Messages can be sent by different thread so we need to synchronize it
|
||||
var paddingMultiplier = this._clientCipher == null ? (byte)8 : (byte)this._clientCipher.BlockSize; // Should be recalculate base on cipher min length if cipher specified
|
||||
@@ -1030,8 +1021,8 @@ namespace Renci.SshNet
|
||||
/// <param name="message"><see cref="DisconnectMessage"/> message.</param>
|
||||
protected virtual void OnDisconnectReceived(DisconnectMessage message)
|
||||
{
|
||||
this.Log("Disconnect received.");
|
||||
|
||||
log.TraceInformation("Disconnect received.");
|
||||
if (this.DisconnectReceived != null)
|
||||
{
|
||||
this.DisconnectReceived(this, new MessageEventArgs<DisconnectMessage>(message));
|
||||
@@ -1477,7 +1468,7 @@ namespace Renci.SshNet
|
||||
|
||||
message.Load(data);
|
||||
|
||||
this.log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 1, "ReceiveMessage from server: '{0}': '{1}'.", message.GetType().Name, message.ToString());
|
||||
this.Log(string.Format("ReceiveMessage from server: '{0}': '{1}'.", message.GetType().Name, message.ToString()));
|
||||
|
||||
return message;
|
||||
}
|
||||
@@ -1498,6 +1489,8 @@ namespace Renci.SshNet
|
||||
|
||||
partial void SocketReadLine(ref string response);
|
||||
|
||||
partial void Log(string text);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the specified data to the server.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user