From e436a98242cb0280351585df19bbb3666a1dfc25 Mon Sep 17 00:00:00 2001 From: olegkap_cp Date: Wed, 15 Sep 2010 20:22:07 +0000 Subject: [PATCH] Rearange compression classes into seperate namespace --- .../Compression.cs => Compression/Compressor.cs} | 7 ++++--- .../{Security/CompressionZlib.cs => Compression/Zlib.cs} | 6 +++--- .../ZlibOpenSsh.cs} | 7 +++---- Renci.SshClient/Renci.SshClient/Renci.SshClient.csproj | 6 +++--- Renci.SshClient/Renci.SshClient/Security/KeyExchange.cs | 9 +++++---- Renci.SshClient/Renci.SshClient/Settings.cs | 9 +++++---- 6 files changed, 23 insertions(+), 21 deletions(-) rename Renci.SshClient/Renci.SshClient/{Security/Compression.cs => Compression/Compressor.cs} (63%) rename Renci.SshClient/Renci.SshClient/{Security/CompressionZlib.cs => Compression/Zlib.cs} (85%) rename Renci.SshClient/Renci.SshClient/{Security/CompressionZlibOpenSsh.cs => Compression/ZlibOpenSsh.cs} (91%) diff --git a/Renci.SshClient/Renci.SshClient/Security/Compression.cs b/Renci.SshClient/Renci.SshClient/Compression/Compressor.cs similarity index 63% rename from Renci.SshClient/Renci.SshClient/Security/Compression.cs rename to Renci.SshClient/Renci.SshClient/Compression/Compressor.cs index 2cf33a7c..420ec2c5 100644 --- a/Renci.SshClient/Renci.SshClient/Security/Compression.cs +++ b/Renci.SshClient/Renci.SshClient/Compression/Compressor.cs @@ -1,11 +1,12 @@ using System.Collections.Generic; -namespace Renci.SshClient.Security +using Renci.SshClient.Security; +namespace Renci.SshClient.Compression { - internal abstract class Compression : Algorithm + internal abstract class Compressor : Algorithm { protected Session Session { get; private set; } - public Compression(Session session) + public Compressor(Session session) { this.Session = session; } diff --git a/Renci.SshClient/Renci.SshClient/Security/CompressionZlib.cs b/Renci.SshClient/Renci.SshClient/Compression/Zlib.cs similarity index 85% rename from Renci.SshClient/Renci.SshClient/Security/CompressionZlib.cs rename to Renci.SshClient/Renci.SshClient/Compression/Zlib.cs index 68e66f73..123708b8 100644 --- a/Renci.SshClient/Renci.SshClient/Security/CompressionZlib.cs +++ b/Renci.SshClient/Renci.SshClient/Compression/Zlib.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -namespace Renci.SshClient.Security +namespace Renci.SshClient.Compression { - internal class CompressionZlib : Compression + internal class Zlib : Compressor { private bool _active; @@ -12,7 +12,7 @@ namespace Renci.SshClient.Security get { return "zlib"; } } - public CompressionZlib(Session session) + public Zlib(Session session) : base(session) { session.MessageReceived += Session_MessageReceived; diff --git a/Renci.SshClient/Renci.SshClient/Security/CompressionZlibOpenSsh.cs b/Renci.SshClient/Renci.SshClient/Compression/ZlibOpenSsh.cs similarity index 91% rename from Renci.SshClient/Renci.SshClient/Security/CompressionZlibOpenSsh.cs rename to Renci.SshClient/Renci.SshClient/Compression/ZlibOpenSsh.cs index a8bf3871..90c4a301 100644 --- a/Renci.SshClient/Renci.SshClient/Security/CompressionZlibOpenSsh.cs +++ b/Renci.SshClient/Renci.SshClient/Compression/ZlibOpenSsh.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -namespace Renci.SshClient.Security +namespace Renci.SshClient.Compression { - internal class CompressionZlibOpenSsh : Compression + internal class ZlibOpenSsh : Compressor { private bool _active; @@ -12,7 +12,7 @@ namespace Renci.SshClient.Security get { return "zlib@openssh.org"; } } - public CompressionZlibOpenSsh(Session session) + public ZlibOpenSsh(Session session) : base(session) { session.MessageReceived += Session_MessageReceived; @@ -33,7 +33,6 @@ namespace Renci.SshClient.Security { return data; } - throw new NotImplementedException(); //using (var output = new MemoryStream()) diff --git a/Renci.SshClient/Renci.SshClient/Renci.SshClient.csproj b/Renci.SshClient/Renci.SshClient/Renci.SshClient.csproj index f5d22c28..f6205c7a 100644 --- a/Renci.SshClient/Renci.SshClient/Renci.SshClient.csproj +++ b/Renci.SshClient/Renci.SshClient/Renci.SshClient.csproj @@ -69,7 +69,7 @@ - + @@ -110,8 +110,8 @@ - - + + diff --git a/Renci.SshClient/Renci.SshClient/Security/KeyExchange.cs b/Renci.SshClient/Renci.SshClient/Security/KeyExchange.cs index a797f11b..5880b02b 100644 --- a/Renci.SshClient/Renci.SshClient/Security/KeyExchange.cs +++ b/Renci.SshClient/Renci.SshClient/Security/KeyExchange.cs @@ -5,6 +5,7 @@ using System.Numerics; using System.Security.Cryptography; using System.Threading; using Renci.SshClient.Common; +using Renci.SshClient.Compression; using Renci.SshClient.Messages; using Renci.SshClient.Messages.Transport; @@ -34,9 +35,9 @@ namespace Renci.SshClient.Security /// private Func, HMAC> _serverHmacAlgorithm; - private Func _compression; + private Func _compression; - private Func _decompression; + private Func _decompression; /// /// Gets the key exchange algorithm name. @@ -97,9 +98,9 @@ namespace Renci.SshClient.Security /// The server cipher. public Cipher ServerCipher { get; private set; } - public Compression ServerDecompression { get; private set; } + public Compressor ServerDecompression { get; private set; } - public Compression ClientCompression { get; private set; } + public Compressor ClientCompression { get; private set; } /// /// Gets or sets a value indicating whether key exchange is in progress. diff --git a/Renci.SshClient/Renci.SshClient/Settings.cs b/Renci.SshClient/Renci.SshClient/Settings.cs index 4b040b00..483af1eb 100644 --- a/Renci.SshClient/Renci.SshClient/Settings.cs +++ b/Renci.SshClient/Renci.SshClient/Settings.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; +using Renci.SshClient.Compression; using Renci.SshClient.Security; namespace Renci.SshClient @@ -14,7 +15,7 @@ namespace Renci.SshClient public static IDictionary, HMAC>> HmacAlgorithms { get; private set; } - public static IDictionary> CompressionAlgorithms { get; private set; } + public static IDictionary> CompressionAlgorithms { get; private set; } public static IDictionary> HostKeyAlgorithms { get; private set; } @@ -56,11 +57,11 @@ namespace Renci.SshClient {"password", (session)=> {return new UserAuthenticationPassword(session);}}, }; - Settings.CompressionAlgorithms = new Dictionary>() + Settings.CompressionAlgorithms = new Dictionary>() { {"none", (session) => { return null;}}, - {"zlib", (session) => { return new CompressionZlib(session);}}, - {"zlib@openssh.com", (session) => { return new CompressionZlibOpenSsh(session);}}, + {"zlib", (session) => { return new Zlib(session);}}, + {"zlib@openssh.com", (session) => { return new ZlibOpenSsh(session);}}, }; }