Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernisation and bug-fixes #22

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ x64/
build/
[Bb]in/
[Oo]bj/
/.vs

# MSTest test Results
[Tt]est[Rr]esult*/
Expand Down
93 changes: 26 additions & 67 deletions Client/FileTransferSettings.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Net.Xmpp.Extensions;
using System;
using System;
using System.Collections.Generic;
using System.Net;

using Net.Xmpp.Extensions;

namespace Net.Xmpp.Client
{
/// <summary>
Expand All @@ -13,39 +14,27 @@ public class FileTransferSettings
/// <summary>
/// A reference to the Socks5Bytestreams extension.
/// </summary>
private Socks5Bytestreams socks5;
private readonly Socks5Bytestreams socks5;

/// <summary>
/// A reference to the SIFileTransfer extension.
/// </summary>
private SIFileTransfer siFileTransfer;
private readonly SIFileTransfer siFileTransfer;

/// <summary>
/// Determines whether usage of a SOCKS5 proxy server is allowed.
/// </summary>
public bool ProxyAllowed
{
get
{
return socks5.ProxyAllowed;
}

set
{
socks5.ProxyAllowed = value;
}
get => socks5.ProxyAllowed;

set => socks5.ProxyAllowed = value;
}

/// <summary>
/// A collection of user-defined SOCKS5 proxy servers.
/// </summary>
public ICollection<Streamhost> Proxies
{
get
{
return socks5.Proxies;
}
}
public ICollection<Streamhost> Proxies => socks5.Proxies;

/// <summary>
/// Defines, along with the Socks5ServerPortTo property, a range of ports
Expand All @@ -56,15 +45,9 @@ public ICollection<Streamhost> Proxies
/// Socks5ServerPortTo property.</exception>
public int Socks5ServerPortFrom
{
get
{
return socks5.ServerPortFrom;
}

set
{
socks5.ServerPortFrom = value;
}
get => socks5.ServerPortFrom;

set => socks5.ServerPortFrom = value;
}

/// <summary>
Expand All @@ -77,31 +60,19 @@ public int Socks5ServerPortFrom
/// 65535.</exception>
public int Socks5ServerPortTo
{
get
{
return socks5.ServerPortTo;
}

set
{
socks5.ServerPortTo = value;
}
get => socks5.ServerPortTo;

set => socks5.ServerPortTo = value;
}

/// <summary>
/// Determines whether usage of UPnP for automatic port-forwarding is allowed.
/// </summary>
public bool UseUPnP
{
get
{
return socks5.UseUPnP;
}

set
{
socks5.UseUPnP = value;
}
get => socks5.UseUPnP;

set => socks5.UseUPnP = value;
}

/// <summary>
Expand All @@ -113,15 +84,9 @@ public bool UseUPnP
/// </remarks>
public DnsEndPoint StunServer
{
get
{
return socks5.StunServer;
}

set
{
socks5.StunServer = value;
}
get => socks5.StunServer;

set => socks5.StunServer = value;
}

/// <summary>
Expand All @@ -130,15 +95,9 @@ public DnsEndPoint StunServer
/// </summary>
public bool ForceInBandBytestreams
{
get
{
return siFileTransfer.ForceInBandBytestreams;
}

set
{
siFileTransfer.ForceInBandBytestreams = value;
}
get => siFileTransfer.ForceInBandBytestreams;

set => siFileTransfer.ForceInBandBytestreams = value;
}

/// <summary>
Expand All @@ -153,8 +112,8 @@ public bool ForceInBandBytestreams
internal FileTransferSettings(Socks5Bytestreams socks5,
SIFileTransfer siFileTransfer)
{
socks5.ThrowIfNull("socks5");
siFileTransfer.ThrowIfNull("siFileTransfer");
socks5.ThrowIfNull(nameof(socks5));
siFileTransfer.ThrowIfNull(nameof(siFileTransfer));
this.socks5 = socks5;
this.siFileTransfer = siFileTransfer;
}
Expand Down
Loading