Commit 46613819 authored by Brickner_cp's avatar Brickner_cp

258 warnings left.

parent 76ba668c
...@@ -63,22 +63,22 @@ namespace PcapDotNet.Packets.IpV4 ...@@ -63,22 +63,22 @@ namespace PcapDotNet.Packets.IpV4
/// Converts the string representation of an IPv4 address (1.2.3.4) to its IPv4 address equivalent. /// Converts the string representation of an IPv4 address (1.2.3.4) to its IPv4 address equivalent.
/// A return value indicates whether the conversion succeeded. /// A return value indicates whether the conversion succeeded.
/// </summary> /// </summary>
/// <param name="s">A string containing the IPv4 address to convert (1.2.3.4).</param> /// <param name="ipV6AddressString">A string containing the IPv4 address to convert (1.2.3.4).</param>
/// <param name="result"> /// <param name="result">
/// When this method returns, contains the IPv4 address value equivalent of the IPv4 address contained in s, if the conversion succeeded, /// When this method returns, contains the IPv4 address value equivalent of the IPv4 address contained in s, if the conversion succeeded,
/// or zero IPv4 address if the conversion failed. /// or zero IPv4 address if the conversion failed.
/// The conversion fails if the s parameter is null or String.Empty or is not of the correct format. This parameter is passed uninitialized. /// The conversion fails if the s parameter is null or String.Empty or is not of the correct format. This parameter is passed uninitialized.
/// </param> /// </param>
/// <returns></returns> /// <returns>True iff parsing was successful.</returns>
public static bool TryParse(string s, out IpV4Address result) public static bool TryParse(string ipV6AddressString, out IpV4Address result)
{ {
if (s == null) if (ipV6AddressString == null)
{ {
result = Zero; result = Zero;
return false; return false;
} }
string[] valuesStrings = s.Split('.'); string[] valuesStrings = ipV6AddressString.Split('.');
if (valuesStrings.Length != 4) if (valuesStrings.Length != 4)
{ {
result = Zero; result = Zero;
......
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.Linq; using System.Linq;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4; using PcapDotNet.Packets.IpV4;
...@@ -117,7 +118,7 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -117,7 +118,7 @@ namespace PcapDotNet.Packets.IpV6
break; break;
default: default:
throw new InvalidOperationException(string.Format("Invalid nextHeader value {0}", nextHeader)); throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Invalid nextHeader value {0}", nextHeader));
} }
} }
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4; using PcapDotNet.Packets.IpV4;
...@@ -70,7 +71,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -70,7 +71,8 @@ namespace PcapDotNet.Packets.IpV6
if (authenticationData.Length % 4 != 0) if (authenticationData.Length % 4 != 0)
{ {
throw new ArgumentException( throw new ArgumentException(
string.Format("Authentication Data must be an integral multiple of 4 byte in length, and not {0}.", authenticationData.Length), string.Format(CultureInfo.InvariantCulture, "Authentication Data must be an integral multiple of 4 byte in length, and not {0}.",
authenticationData.Length),
"authenticationData"); "authenticationData");
} }
SecurityParametersIndex = securityParametersIndex; SecurityParametersIndex = securityParametersIndex;
......
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq; using System.Linq;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4; using PcapDotNet.Packets.IpV4;
...@@ -96,14 +97,14 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -96,14 +97,14 @@ namespace PcapDotNet.Packets.IpV6
if (commonPrefixLengthForNonLastAddresses > MaxCommonPrefixLength) if (commonPrefixLengthForNonLastAddresses > MaxCommonPrefixLength)
{ {
throw new ArgumentOutOfRangeException("commonPrefixLengthForNonLastAddresses", commonPrefixLengthForNonLastAddresses, throw new ArgumentOutOfRangeException("commonPrefixLengthForNonLastAddresses", commonPrefixLengthForNonLastAddresses,
string.Format("Maximum value is {0}", MaxCommonPrefixLength)); string.Format(CultureInfo.InvariantCulture, "Maximum value is {0}", MaxCommonPrefixLength));
} }
CommonPrefixLengthForNonLastAddresses = commonPrefixLengthForNonLastAddresses; CommonPrefixLengthForNonLastAddresses = commonPrefixLengthForNonLastAddresses;
if (commonPrefixLengthForLastAddress > MaxCommonPrefixLength) if (commonPrefixLengthForLastAddress > MaxCommonPrefixLength)
{ {
throw new ArgumentOutOfRangeException("commonPrefixLengthForLastAddress", commonPrefixLengthForLastAddress, throw new ArgumentOutOfRangeException("commonPrefixLengthForLastAddress", commonPrefixLengthForLastAddress,
string.Format("Maximum value is {0}", MaxCommonPrefixLength)); string.Format(CultureInfo.InvariantCulture, "Maximum value is {0}", MaxCommonPrefixLength));
} }
CommonPrefixLengthForLastAddress = commonPrefixLengthForLastAddress; CommonPrefixLengthForLastAddress = commonPrefixLengthForLastAddress;
...@@ -130,7 +131,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -130,7 +131,8 @@ namespace PcapDotNet.Packets.IpV6
if (address.ToValue() >> (8 * (IpV6Address.SizeOf - commonPrefixLength)) != 0) if (address.ToValue() >> (8 * (IpV6Address.SizeOf - commonPrefixLength)) != 0)
{ {
throw new ArgumentOutOfRangeException("addresses", address, throw new ArgumentOutOfRangeException("addresses", address,
string.Format("When an address has {0} common bytes, it should start with {0} zero bytes.", string.Format(CultureInfo.InvariantCulture,
"When an address has {0} common bytes, it should start with {0} zero bytes.",
commonPrefixLength)); commonPrefixLength));
} }
} }
......
...@@ -2,6 +2,7 @@ using System; ...@@ -2,6 +2,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq; using System.Linq;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4; using PcapDotNet.Packets.IpV4;
...@@ -26,7 +27,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -26,7 +27,8 @@ namespace PcapDotNet.Packets.IpV6
if (extensionHeaders[i].Protocol == IpV4Protocol.EncapsulatingSecurityPayload && i != extensionHeaders.Count - 1) if (extensionHeaders[i].Protocol == IpV4Protocol.EncapsulatingSecurityPayload && i != extensionHeaders.Count - 1)
{ {
throw new ArgumentException( throw new ArgumentException(
string.Format("EncapsulatingSecurityPayload can only be the last extension header. However it is the {0} out of {1}.", (i + 1), string.Format(CultureInfo.InvariantCulture,
"EncapsulatingSecurityPayload can only be the last extension header. However it is the {0} out of {1}.", (i + 1),
extensionHeaders.Count), "extensionHeaders"); extensionHeaders.Count), "extensionHeaders");
} }
} }
......
...@@ -5,6 +5,11 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -5,6 +5,11 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public enum IpV6AccessNetworkIdentifierOperatorIdentifierType : byte public enum IpV6AccessNetworkIdentifierOperatorIdentifierType : byte
{ {
/// <summary>
/// Undefined value.
/// </summary>
None = 0,
/// <summary> /// <summary>
/// Operator-Identifier as a variable-length Private Enterprise Number (PEN) encoded in a network-byte order. /// Operator-Identifier as a variable-length Private Enterprise Number (PEN) encoded in a network-byte order.
/// The maximum PEN value depends on the ANI Length and is calculated using the formula: maximum PEN = 2^((ANI_length-1)*8)-1. /// The maximum PEN value depends on the ANI Length and is calculated using the formula: maximum PEN = 2^((ANI_length-1)*8)-1.
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
...@@ -58,11 +59,15 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -58,11 +59,15 @@ namespace PcapDotNet.Packets.IpV6
double latitudeDegreesReal = LatitudeDegreesReal; double latitudeDegreesReal = LatitudeDegreesReal;
if (latitudeDegreesReal < -90 || latitudeDegreesReal > 90) if (latitudeDegreesReal < -90 || latitudeDegreesReal > 90)
throw new ArgumentOutOfRangeException("latitudeDegrees", latitudeDegrees, string.Format("LatitudeDegreesReal is {0} and must be in [-90, 90] range.", latitudeDegreesReal)); throw new ArgumentOutOfRangeException("latitudeDegrees", latitudeDegrees,
string.Format(CultureInfo.InvariantCulture, "LatitudeDegreesReal is {0} and must be in [-90, 90] range.",
latitudeDegreesReal));
double longtitudeDegreesReal = LongitudeDegreesReal; double longtitudeDegreesReal = LongitudeDegreesReal;
if (longtitudeDegreesReal < -180 || longtitudeDegreesReal > 180) if (longtitudeDegreesReal < -180 || longtitudeDegreesReal > 180)
throw new ArgumentOutOfRangeException("longitudeDegrees", longitudeDegrees, string.Format("LongitudeDegreesReal is {0} and must be in [-180, 180] range.", longtitudeDegreesReal)); throw new ArgumentOutOfRangeException("longitudeDegrees", longitudeDegrees,
string.Format(CultureInfo.InvariantCulture,
"LongitudeDegreesReal is {0} and must be in [-180, 180] range.", longtitudeDegreesReal));
} }
/// <summary> /// <summary>
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
...@@ -79,9 +80,12 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -79,9 +80,12 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6AccessNetworkIdentifierSubOptionType.NetworkIdentifier) : base(IpV6AccessNetworkIdentifierSubOptionType.NetworkIdentifier)
{ {
if (networkName.Length > byte.MaxValue) if (networkName.Length > byte.MaxValue)
throw new ArgumentOutOfRangeException("networkName", networkName, string.Format("Network Name cannot be longer than {0} bytes.", byte.MaxValue)); throw new ArgumentOutOfRangeException("networkName", networkName,
string.Format(CultureInfo.InvariantCulture, "Network Name cannot be longer than {0} bytes.", byte.MaxValue));
if (accessPointName.Length > byte.MaxValue) if (accessPointName.Length > byte.MaxValue)
throw new ArgumentOutOfRangeException("accessPointName", accessPointName, string.Format("Access Point Name cannot be longer than {0} bytes.", byte.MaxValue)); throw new ArgumentOutOfRangeException("accessPointName", accessPointName,
string.Format(CultureInfo.InvariantCulture, "Access Point Name cannot be longer than {0} bytes.",
byte.MaxValue));
IsNetworkNameUtf8 = isNetworkNameUtf8; IsNetworkNameUtf8 = isNetworkNameUtf8;
NetworkName = networkName; NetworkName = networkName;
......
using System; using System;
using System.Globalization;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
{ {
...@@ -26,7 +27,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -26,7 +27,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.AccessNetworkIdentifier) : base(IpV6MobilityOptionType.AccessNetworkIdentifier)
{ {
if (subOptions.BytesLength > MaxDataLength) if (subOptions.BytesLength > MaxDataLength)
throw new ArgumentOutOfRangeException("subOptions", subOptions, string.Format("SubOptions take more than {0} bytes", MaxDataLength)); throw new ArgumentOutOfRangeException("subOptions", subOptions,
string.Format(CultureInfo.InvariantCulture, "SubOptions take more than {0} bytes", MaxDataLength));
SubOptions = subOptions; SubOptions = subOptions;
} }
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4; using PcapDotNet.Packets.IpV4;
...@@ -288,7 +289,7 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -288,7 +289,7 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.BindingIdentifier) : base(IpV6MobilityOptionType.BindingIdentifier)
{ {
if (priority > MaxPriority) if (priority > MaxPriority)
throw new ArgumentOutOfRangeException("priority", priority, string.Format("Must not exceed {0}", MaxPriority)); throw new ArgumentOutOfRangeException("priority", priority, string.Format(CultureInfo.InvariantCulture, "Must not exceed {0}", MaxPriority));
BindingId = bindingId; BindingId = bindingId;
Status = status; Status = status;
SimultaneousHomeAndForeignBinding = simultaneousHomeAndForeignBinding; SimultaneousHomeAndForeignBinding = simultaneousHomeAndForeignBinding;
......
using System; using System;
using System.Globalization;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
{ {
...@@ -39,7 +40,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -39,7 +40,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.CgaParameters, cgaParameters) : base(IpV6MobilityOptionType.CgaParameters, cgaParameters)
{ {
if (cgaParameters.Length > OptionDataMaxLength) if (cgaParameters.Length > OptionDataMaxLength)
throw new ArgumentOutOfRangeException("cgaParameters", cgaParameters, string.Format("Must not exceed {0} bytes.", OptionDataMaxLength)); throw new ArgumentOutOfRangeException("cgaParameters", cgaParameters,
string.Format(CultureInfo.InvariantCulture, "Must not exceed {0} bytes.", OptionDataMaxLength));
} }
/// <summary> /// <summary>
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq; using System.Linq;
using PcapDotNet.Base; using PcapDotNet.Base;
...@@ -52,7 +53,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -52,7 +53,9 @@ namespace PcapDotNet.Packets.IpV6
Requests = requests; Requests = requests;
_dataLength = Requests.Sum(request => request.Length); _dataLength = Requests.Sum(request => request.Length);
if (_dataLength > byte.MaxValue) if (_dataLength > byte.MaxValue)
throw new ArgumentOutOfRangeException("requests", requests, string.Format("requests length is too large. Takes over {0}>{1} bytes.", _dataLength, byte.MaxValue)); throw new ArgumentOutOfRangeException("requests", requests,
string.Format(CultureInfo.InvariantCulture, "requests length is too large. Takes over {0}>{1} bytes.",
_dataLength, byte.MaxValue));
} }
/// <summary> /// <summary>
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
...@@ -26,7 +27,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -26,7 +27,8 @@ namespace PcapDotNet.Packets.IpV6
public IpV6MobilityOptionContextRequestEntry(byte requestType, DataSegment option) public IpV6MobilityOptionContextRequestEntry(byte requestType, DataSegment option)
{ {
if (option.Length > byte.MaxValue) if (option.Length > byte.MaxValue)
throw new ArgumentOutOfRangeException("option", option, string.Format("Option length must not exceed {0}", byte.MaxValue)); throw new ArgumentOutOfRangeException("option", option,
string.Format(CultureInfo.InvariantCulture, "Option length must not exceed {0}", byte.MaxValue));
RequestType = requestType; RequestType = requestType;
Option = option; Option = option;
} }
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
...@@ -69,7 +70,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -69,7 +70,8 @@ namespace PcapDotNet.Packets.IpV6
if (Offset.SubOptions + subOptions.BytesLength > byte.MaxValue) if (Offset.SubOptions + subOptions.BytesLength > byte.MaxValue)
{ {
throw new ArgumentOutOfRangeException("subOptions", subOptions, throw new ArgumentOutOfRangeException("subOptions", subOptions,
string.Format("Sub Options take {0} bytes, which is more than the maximum length of {1} bytes", string.Format(CultureInfo.InvariantCulture,
"Sub Options take {0} bytes, which is more than the maximum length of {1} bytes",
subOptions.BytesLength, (byte.MaxValue - Offset.SubOptions))); subOptions.BytesLength, (byte.MaxValue - Offset.SubOptions)));
} }
FlowIdentifier = flowIdentifier; FlowIdentifier = flowIdentifier;
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4; using PcapDotNet.Packets.IpV4;
...@@ -73,7 +74,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -73,7 +74,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.IpV4AddressAcknowledgement) : base(IpV6MobilityOptionType.IpV4AddressAcknowledgement)
{ {
if (prefixLength > MaxPrefixLength) if (prefixLength > MaxPrefixLength)
throw new ArgumentOutOfRangeException("prefixLength", prefixLength, string.Format("Exceeded maximum value {0}", MaxPrefixLength)); throw new ArgumentOutOfRangeException("prefixLength", prefixLength,
string.Format(CultureInfo.InvariantCulture, "Exceeded maximum value {0}", MaxPrefixLength));
Status = status; Status = status;
PrefixLength = prefixLength; PrefixLength = prefixLength;
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4; using PcapDotNet.Packets.IpV4;
...@@ -76,7 +77,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -76,7 +77,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.IpV4HomeAddress) : base(IpV6MobilityOptionType.IpV4HomeAddress)
{ {
if (prefixLength > MaxPrefixLength) if (prefixLength > MaxPrefixLength)
throw new ArgumentOutOfRangeException("prefixLength", prefixLength, string.Format("Exceeded maximum value {0}", MaxPrefixLength)); throw new ArgumentOutOfRangeException("prefixLength", prefixLength,
string.Format(CultureInfo.InvariantCulture, "Exceeded maximum value {0}", MaxPrefixLength));
PrefixLength = prefixLength; PrefixLength = prefixLength;
RequestPrefix = requestPrefix; RequestPrefix = requestPrefix;
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4; using PcapDotNet.Packets.IpV4;
...@@ -67,7 +68,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -67,7 +68,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.IpV4HomeAddressReply) : base(IpV6MobilityOptionType.IpV4HomeAddressReply)
{ {
if (prefixLength > MaxPrefixLength) if (prefixLength > MaxPrefixLength)
throw new ArgumentOutOfRangeException("prefixLength", prefixLength, string.Format("Max prefix length is {0}", MaxPrefixLength)); throw new ArgumentOutOfRangeException("prefixLength", prefixLength,
string.Format(CultureInfo.InvariantCulture, "Max prefix length is {0}", MaxPrefixLength));
Status = status; Status = status;
PrefixLength = prefixLength; PrefixLength = prefixLength;
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4; using PcapDotNet.Packets.IpV4;
...@@ -62,7 +63,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -62,7 +63,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.IpV4HomeAddressRequest) : base(IpV6MobilityOptionType.IpV4HomeAddressRequest)
{ {
if (prefixLength > MaxPrefixLength) if (prefixLength > MaxPrefixLength)
throw new ArgumentOutOfRangeException("prefixLength", prefixLength, string.Format("Max prefix length is {0}", MaxPrefixLength)); throw new ArgumentOutOfRangeException("prefixLength", prefixLength,
string.Format(CultureInfo.InvariantCulture, "Max prefix length is {0}", MaxPrefixLength));
PrefixLength = prefixLength; PrefixLength = prefixLength;
HomeAddress = homeAddress; HomeAddress = homeAddress;
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
...@@ -57,7 +58,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -57,7 +58,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.IpV6AddressPrefix) : base(IpV6MobilityOptionType.IpV6AddressPrefix)
{ {
if (prefixLength > MaxPrefixLength) if (prefixLength > MaxPrefixLength)
throw new ArgumentOutOfRangeException("prefixLength", prefixLength, string.Format("Max value is {0}", MaxPrefixLength)); throw new ArgumentOutOfRangeException("prefixLength", prefixLength,
string.Format(CultureInfo.InvariantCulture, "Max value is {0}", MaxPrefixLength));
Code = code; Code = code;
PrefixLength = prefixLength; PrefixLength = prefixLength;
......
using System; using System;
using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
...@@ -53,7 +54,7 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -53,7 +54,7 @@ namespace PcapDotNet.Packets.IpV6
{ {
if (subtype == IpV6MobileNodeIdentifierSubtype.NetworkAccessIdentifier && identifier.Length < MinNetworkAccessIdentifierLength) if (subtype == IpV6MobileNodeIdentifierSubtype.NetworkAccessIdentifier && identifier.Length < MinNetworkAccessIdentifierLength)
throw new ArgumentOutOfRangeException("identifier", identifier, throw new ArgumentOutOfRangeException("identifier", identifier,
string.Format("Network Access Identifier must be at least {0} bytes long.", string.Format(CultureInfo.InvariantCulture, "Network Access Identifier must be at least {0} bytes long.",
MinNetworkAccessIdentifierLength)); MinNetworkAccessIdentifierLength));
Subtype = subtype; Subtype = subtype;
Identifier = identifier; Identifier = identifier;
......
using System; using System;
using System.Globalization;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
{ {
...@@ -45,7 +46,8 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -45,7 +46,8 @@ namespace PcapDotNet.Packets.IpV6
{ {
if (identifier.Length < MinIdentifierLength || identifier.Length > MaxIdentifierLength) if (identifier.Length < MinIdentifierLength || identifier.Length > MaxIdentifierLength)
throw new ArgumentOutOfRangeException("identifier", identifier, throw new ArgumentOutOfRangeException("identifier", identifier,
string.Format("Identifier length must be at least {0} bytes long and at most {1} bytes long.", string.Format(CultureInfo.InvariantCulture,
"Identifier length must be at least {0} bytes long and at most {1} bytes long.",
MinIdentifierLength, MaxIdentifierLength)); MinIdentifierLength, MaxIdentifierLength));
} }
......
using System; using System;
using System.Globalization;
using System.Linq; using System.Linq;
using PcapDotNet.Base; using PcapDotNet.Base;
...@@ -86,11 +87,13 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -86,11 +87,13 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6OptionType.Calipso) : base(IpV6OptionType.Calipso)
{ {
if (compartmentBitmap.Length % sizeof(int) != 0) if (compartmentBitmap.Length % sizeof(int) != 0)
throw new ArgumentException(string.Format("Compartment Bitmap length must divide by {0}.", sizeof(int)), "compartmentBitmap"); throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Compartment Bitmap length must divide by {0}.", sizeof(int)),
"compartmentBitmap");
if (compartmentBitmap.Length > CompartmentBitmapMaxLength) if (compartmentBitmap.Length > CompartmentBitmapMaxLength)
{ {
throw new ArgumentOutOfRangeException(string.Format("Compartment Bitmap length must not be bigger than {0}.", CompartmentBitmapMaxLength), throw new ArgumentOutOfRangeException(
"compartmentBitmap"); string.Format(CultureInfo.InvariantCulture, "Compartment Bitmap length must not be bigger than {0}.", CompartmentBitmapMaxLength),
"compartmentBitmap");
} }
DomainOfInterpretation = domainOfInterpretation; DomainOfInterpretation = domainOfInterpretation;
......
using System; using System;
using System.Globalization;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
{ {
...@@ -49,7 +50,7 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -49,7 +50,7 @@ namespace PcapDotNet.Packets.IpV6
if (lineIdentification.Length > byte.MaxValue) if (lineIdentification.Length > byte.MaxValue)
{ {
throw new ArgumentOutOfRangeException("lineIdentification", lineIdentification, throw new ArgumentOutOfRangeException("lineIdentification", lineIdentification,
string.Format("Cannot be longer than {0} bytes.", byte.MaxValue)); string.Format(CultureInfo.InvariantCulture, "Cannot be longer than {0} bytes.", byte.MaxValue));
} }
LineIdentification = lineIdentification; LineIdentification = lineIdentification;
} }
......
using System; using System;
using System.Globalization;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
{ {
...@@ -47,13 +48,14 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -47,13 +48,14 @@ namespace PcapDotNet.Packets.IpV6
if (taggerId.Length > TaggerIdMaxLength) if (taggerId.Length > TaggerIdMaxLength)
{ {
throw new ArgumentOutOfRangeException("taggerId", taggerId, throw new ArgumentOutOfRangeException("taggerId", taggerId,
string.Format("Length is {0} but it must not be longer than {1} bytes.", taggerId.Length, string.Format(CultureInfo.InvariantCulture, "Length is {0} but it must not be longer than {1} bytes.",
TaggerIdMaxLength)); taggerId.Length, TaggerIdMaxLength));
} }
if (taggerId.Length == 0) if (taggerId.Length == 0)
{ {
throw new ArgumentOutOfRangeException("taggerId", taggerId, throw new ArgumentOutOfRangeException("taggerId", taggerId,
string.Format("Length is {0} but it must be longer than 0 bytes.", taggerId.Length)); string.Format(CultureInfo.InvariantCulture, "Length is {0} but it must be longer than 0 bytes.",
taggerId.Length));
} }
TaggerId = taggerId; TaggerId = taggerId;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment