aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs
diff options
context:
space:
mode:
authorErwin de Haan <EraYaN@users.noreply.github.com>2019-01-06 21:50:43 +0100
committerErwin de Haan <EraYaN@users.noreply.github.com>2019-01-10 20:38:53 +0100
commitec1f5dc317182582ebff843c9e8a4d5277405469 (patch)
tree6514de336cc9aa94becb3fbd767285dfa61d0b1b /Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs
parent3d867c2c46cec39b669bb8647efef677f32b8a8d (diff)
Mayor code cleanup
Add Argument*Exceptions now use proper nameof operators. Added exception messages to quite a few Argument*Exceptions. Fixed rethorwing to be proper syntax. Added a ton of null checkes. (This is only a start, there are about 500 places that need proper null handling) Added some TODOs to log certain exceptions. Fix sln again. Fixed all AssemblyInfo's and added proper copyright (where I could find them) We live in *current year*. Fixed the use of braces. Fixed a ton of properties, and made a fair amount of functions static that should be and can be static. Made more Methods that should be static static. You can now use static to find bad functions! Removed unused variable. And added one more proper XML comment.
Diffstat (limited to 'Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs')
-rw-r--r--Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs36
1 files changed, 10 insertions, 26 deletions
diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs
index 35cff88dc..48d404124 100644
--- a/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs
+++ b/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs
@@ -11,22 +11,12 @@ namespace System.Net
private byte _cidrSubnet;
private IPNetwork _ipnetwork;
- private byte _cidr
- {
- get { return this._ipnetwork.Cidr; }
- }
- private BigInteger _broadcast
- {
- get { return IPNetwork.ToBigInteger(this._ipnetwork.Broadcast); }
- }
- private BigInteger _lastUsable
- {
- get { return IPNetwork.ToBigInteger(this._ipnetwork.LastUsable); }
- }
- private BigInteger _network
- {
- get { return IPNetwork.ToBigInteger(this._ipnetwork.Network); }
- }
+ private byte _cidr => this._ipnetwork.Cidr;
+
+ private BigInteger _broadcast => IPNetwork.ToBigInteger(this._ipnetwork.Broadcast);
+
+ private BigInteger _lastUsable => IPNetwork.ToBigInteger(this._ipnetwork.LastUsable);
+ private BigInteger _network => IPNetwork.ToBigInteger(this._ipnetwork.Network);
#if TRAVISCI
public
#else
@@ -38,7 +28,7 @@ namespace System.Net
int maxCidr = ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetwork ? 32 : 128;
if (cidrSubnet > maxCidr)
{
- throw new ArgumentOutOfRangeException("cidrSubnet");
+ throw new ArgumentOutOfRangeException(nameof(cidrSubnet));
}
if (cidrSubnet < ipnetwork.Cidr)
@@ -68,7 +58,7 @@ namespace System.Net
{
if (i >= this.Count)
{
- throw new ArgumentOutOfRangeException("i");
+ throw new ArgumentOutOfRangeException(nameof(i));
}
BigInteger last = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetworkV6
@@ -96,10 +86,7 @@ namespace System.Net
#region IEnumerator<IPNetwork> Members
- public IPNetwork Current
- {
- get { return this[this._enumerator]; }
- }
+ public IPNetwork Current => this[this._enumerator];
#endregion
@@ -115,10 +102,7 @@ namespace System.Net
#region IEnumerator Members
- object IEnumerator.Current
- {
- get { return this.Current; }
- }
+ object IEnumerator.Current => this.Current;
public bool MoveNext()
{