Commit 46613819 authored by Brickner_cp's avatar Brickner_cp

258 warnings left.

parent 76ba668c
......@@ -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.
/// A return value indicates whether the conversion succeeded.
/// </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">
/// 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.
/// 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>
/// <returns></returns>
public static bool TryParse(string s, out IpV4Address result)
/// <returns>True iff parsing was successful.</returns>
public static bool TryParse(string ipV6AddressString, out IpV4Address result)
{
if (s == null)
if (ipV6AddressString == null)
{
result = Zero;
return false;
}
string[] valuesStrings = s.Split('.');
string[] valuesStrings = ipV6AddressString.Split('.');
if (valuesStrings.Length != 4)
{
result = Zero;
......
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4;
......@@ -117,7 +118,7 @@ namespace PcapDotNet.Packets.IpV6
break;
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.Globalization;
using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4;
......@@ -70,7 +71,8 @@ namespace PcapDotNet.Packets.IpV6
if (authenticationData.Length % 4 != 0)
{
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");
}
SecurityParametersIndex = securityParametersIndex;
......
using System;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4;
......@@ -96,14 +97,14 @@ namespace PcapDotNet.Packets.IpV6
if (commonPrefixLengthForNonLastAddresses > MaxCommonPrefixLength)
{
throw new ArgumentOutOfRangeException("commonPrefixLengthForNonLastAddresses", commonPrefixLengthForNonLastAddresses,
string.Format("Maximum value is {0}", MaxCommonPrefixLength));
string.Format(CultureInfo.InvariantCulture, "Maximum value is {0}", MaxCommonPrefixLength));
}
CommonPrefixLengthForNonLastAddresses = commonPrefixLengthForNonLastAddresses;
if (commonPrefixLengthForLastAddress > MaxCommonPrefixLength)
{
throw new ArgumentOutOfRangeException("commonPrefixLengthForLastAddress", commonPrefixLengthForLastAddress,
string.Format("Maximum value is {0}", MaxCommonPrefixLength));
string.Format(CultureInfo.InvariantCulture, "Maximum value is {0}", MaxCommonPrefixLength));
}
CommonPrefixLengthForLastAddress = commonPrefixLengthForLastAddress;
......@@ -130,7 +131,8 @@ namespace PcapDotNet.Packets.IpV6
if (address.ToValue() >> (8 * (IpV6Address.SizeOf - commonPrefixLength)) != 0)
{
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));
}
}
......
......@@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4;
......@@ -26,7 +27,8 @@ namespace PcapDotNet.Packets.IpV6
if (extensionHeaders[i].Protocol == IpV4Protocol.EncapsulatingSecurityPayload && i != extensionHeaders.Count - 1)
{
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");
}
}
......
......@@ -5,6 +5,11 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public enum IpV6AccessNetworkIdentifierOperatorIdentifierType : byte
{
/// <summary>
/// Undefined value.
/// </summary>
None = 0,
/// <summary>
/// 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.
......
using System;
using System.Globalization;
using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6
......@@ -58,11 +59,15 @@ namespace PcapDotNet.Packets.IpV6
double latitudeDegreesReal = LatitudeDegreesReal;
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;
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>
......
using System;
using System.Globalization;
using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6
......@@ -79,9 +80,12 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6AccessNetworkIdentifierSubOptionType.NetworkIdentifier)
{
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)
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;
NetworkName = networkName;
......
using System;
using System.Globalization;
namespace PcapDotNet.Packets.IpV6
{
......@@ -26,7 +27,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.AccessNetworkIdentifier)
{
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;
}
......
using System;
using System.Globalization;
using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4;
......@@ -288,7 +289,7 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.BindingIdentifier)
{
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;
Status = status;
SimultaneousHomeAndForeignBinding = simultaneousHomeAndForeignBinding;
......
using System;
using System.Globalization;
namespace PcapDotNet.Packets.IpV6
{
......@@ -39,7 +40,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.CgaParameters, cgaParameters)
{
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>
......
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using PcapDotNet.Base;
......@@ -52,7 +53,9 @@ namespace PcapDotNet.Packets.IpV6
Requests = requests;
_dataLength = Requests.Sum(request => request.Length);
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>
......
using System;
using System.Globalization;
using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6
......@@ -26,7 +27,8 @@ namespace PcapDotNet.Packets.IpV6
public IpV6MobilityOptionContextRequestEntry(byte requestType, DataSegment option)
{
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;
Option = option;
}
......
using System;
using System.Globalization;
using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6
......@@ -69,7 +70,8 @@ namespace PcapDotNet.Packets.IpV6
if (Offset.SubOptions + subOptions.BytesLength > byte.MaxValue)
{
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)));
}
FlowIdentifier = flowIdentifier;
......
using System;
using System.Globalization;
using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4;
......@@ -73,7 +74,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.IpV4AddressAcknowledgement)
{
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;
PrefixLength = prefixLength;
......
using System;
using System.Globalization;
using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4;
......@@ -76,7 +77,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.IpV4HomeAddress)
{
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;
RequestPrefix = requestPrefix;
......
using System;
using System.Globalization;
using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4;
......@@ -67,7 +68,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.IpV4HomeAddressReply)
{
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;
PrefixLength = prefixLength;
......
using System;
using System.Globalization;
using PcapDotNet.Base;
using PcapDotNet.Packets.IpV4;
......@@ -62,7 +63,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.IpV4HomeAddressRequest)
{
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;
HomeAddress = homeAddress;
......
using System;
using System.Globalization;
using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6
......@@ -57,7 +58,8 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6MobilityOptionType.IpV6AddressPrefix)
{
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;
PrefixLength = prefixLength;
......
using System;
using System.Globalization;
using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6
......@@ -53,7 +54,7 @@ namespace PcapDotNet.Packets.IpV6
{
if (subtype == IpV6MobileNodeIdentifierSubtype.NetworkAccessIdentifier && identifier.Length < MinNetworkAccessIdentifierLength)
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));
Subtype = subtype;
Identifier = identifier;
......
using System;
using System.Globalization;
namespace PcapDotNet.Packets.IpV6
{
......@@ -45,7 +46,8 @@ namespace PcapDotNet.Packets.IpV6
{
if (identifier.Length < MinIdentifierLength || identifier.Length > MaxIdentifierLength)
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));
}
......
using System;
using System.Globalization;
using System.Linq;
using PcapDotNet.Base;
......@@ -86,11 +87,13 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6OptionType.Calipso)
{
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)
{
throw new ArgumentOutOfRangeException(string.Format("Compartment Bitmap length must not be bigger than {0}.", CompartmentBitmapMaxLength),
"compartmentBitmap");
throw new ArgumentOutOfRangeException(
string.Format(CultureInfo.InvariantCulture, "Compartment Bitmap length must not be bigger than {0}.", CompartmentBitmapMaxLength),
"compartmentBitmap");
}
DomainOfInterpretation = domainOfInterpretation;
......
using System;
using System.Globalization;
namespace PcapDotNet.Packets.IpV6
{
......@@ -49,7 +50,7 @@ namespace PcapDotNet.Packets.IpV6
if (lineIdentification.Length > byte.MaxValue)
{
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;
}
......
using System;
using System.Globalization;
namespace PcapDotNet.Packets.IpV6
{
......@@ -47,13 +48,14 @@ namespace PcapDotNet.Packets.IpV6
if (taggerId.Length > TaggerIdMaxLength)
{
throw new ArgumentOutOfRangeException("taggerId", taggerId,
string.Format("Length is {0} but it must not be longer than {1} bytes.", taggerId.Length,
TaggerIdMaxLength));
string.Format(CultureInfo.InvariantCulture, "Length is {0} but it must not be longer than {1} bytes.",
taggerId.Length, TaggerIdMaxLength));
}
if (taggerId.Length == 0)
{
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;
}
......
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