public IpV6Address(string value) { if (value == null) { throw new ArgumentNullException("value"); } string str1 = value; int num1 = str1.LastIndexOf(':'); if (num1 == -1) { throw new ArgumentException("Invalid IPv6 address format " + value); } string str2 = value.Substring(num1 + 1, str1.Length - num1 - 1); if (str2.IndexOf('.') != -1) { uint num2 = new IpV4Address(str2).ToValue(); str1 = str1.Substring(0, num1 + 1) + (num2 >> 16).ToString("x", (IFormatProvider)CultureInfo.InvariantCulture) + ":" + (num2 & (uint)ushort.MaxValue).ToString("x", (IFormatProvider)CultureInfo.InvariantCulture); } int num3 = str1.IndexOf("::", StringComparison.Ordinal); if (num3 != -1) { int count = 7 - IEnumerableExtensions.Count <char>((IEnumerable <char>)str1, ':'); if (count < 0) { throw new ArgumentException("Invalid IPv6 address format " + value); } str1 = str1.Substring(0, num3 + 2) + new string(':', count) + str1.Substring(num3 + 2); } IEnumerable <ushort> source = Enumerable.Select <string, ushort>((IEnumerable <string>)str1.Split(':'), (Func <string, ushort>)(part => { if (!string.IsNullOrEmpty(part)) { return(ushort.Parse(part, NumberStyles.HexNumber, (IFormatProvider)CultureInfo.InvariantCulture)); } return((ushort)0); })); this._value = new UInt128(Enumerable.Aggregate <ushort, ulong>(Enumerable.Take <ushort>(source, 4), 0UL, (Func <ulong, ushort, ulong>)((sum, element) => (sum << 16) + (ulong)element)), Enumerable.Aggregate <ushort, ulong>(Enumerable.Take <ushort>(Enumerable.Skip <ushort>(source, 4), 4), 0UL, (Func <ulong, ushort, ulong>)((sum, element) => (sum << 16) + (ulong)element))); }