diff --git a/CHANGELOG.md b/CHANGELOG.md index db1c35f..da1e65f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed + - IcdHashSet preserves comparer when an operation creates a new IcdHashSet + +## [8.1.0] - 2019-01-02 ### Added - Added GetAttributeAsEnum xml utils method - Adding short parsing methods to XML utils diff --git a/ICD.Common.Utils/AttributeUtils.cs b/ICD.Common.Utils/AttributeUtils.cs index 74dc221..20260b4 100644 --- a/ICD.Common.Utils/AttributeUtils.cs +++ b/ICD.Common.Utils/AttributeUtils.cs @@ -233,7 +233,9 @@ namespace ICD.Common.Utils .GetTypeInfo() #endif .GetProperties() +// ReSharper disable InvokeAsExtensionMethod .Where(p => ReflectionExtensions.GetCustomAttributes(p, inherit).Any()); +// ReSharper restore InvokeAsExtensionMethod } #endregion diff --git a/ICD.Common.Utils/Collections/IcdHashSet.cs b/ICD.Common.Utils/Collections/IcdHashSet.cs index 9c68435..8a9bab3 100644 --- a/ICD.Common.Utils/Collections/IcdHashSet.cs +++ b/ICD.Common.Utils/Collections/IcdHashSet.cs @@ -95,7 +95,7 @@ namespace ICD.Common.Utils.Collections if (set == null) throw new ArgumentNullException("set"); - IcdHashSet unionSet = new IcdHashSet(this); + IcdHashSet unionSet = new IcdHashSet(m_Dict.Comparer, this); unionSet.AddRange(set); return unionSet; @@ -112,7 +112,7 @@ namespace ICD.Common.Utils.Collections if (set == null) throw new ArgumentNullException("set"); - IcdHashSet subtractSet = new IcdHashSet(this); + IcdHashSet subtractSet = new IcdHashSet(m_Dict.Comparer, this); foreach (T item in set) subtractSet.Remove(item); @@ -131,7 +131,7 @@ namespace ICD.Common.Utils.Collections if (set == null) throw new ArgumentNullException("set"); - IcdHashSet intersectionSet = new IcdHashSet(); + IcdHashSet intersectionSet = new IcdHashSet(m_Dict.Comparer); foreach (T item in set.Where(Contains)) intersectionSet.Add(item); @@ -150,7 +150,7 @@ namespace ICD.Common.Utils.Collections if (set == null) throw new ArgumentNullException("set"); - IcdHashSet output = new IcdHashSet(this); + IcdHashSet output = new IcdHashSet(m_Dict.Comparer, this); foreach (T item in set) { diff --git a/ICD.Common.Utils/Extensions/MethodInfoExtensions.cs b/ICD.Common.Utils/Extensions/MethodInfoExtensions.cs index 0b19219..452010a 100644 --- a/ICD.Common.Utils/Extensions/MethodInfoExtensions.cs +++ b/ICD.Common.Utils/Extensions/MethodInfoExtensions.cs @@ -71,7 +71,10 @@ namespace ICD.Common.Utils.Extensions sigBuilder.Append("("); firstParam = true; + +#if !SIMPLSHARP bool secondParam = false; +#endif foreach (ParameterInfo param in method.GetParameters()) { diff --git a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj index 90d90a8..103d153 100644 --- a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj +++ b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj @@ -111,7 +111,7 @@ - + diff --git a/ICD.Common.Utils/Properties/AssemblyInfo.cs b/ICD.Common.Utils/Properties/AssemblyInfo.cs index 375c25b..4497a46 100644 --- a/ICD.Common.Utils/Properties/AssemblyInfo.cs +++ b/ICD.Common.Utils/Properties/AssemblyInfo.cs @@ -4,4 +4,4 @@ using System.Reflection; [assembly: AssemblyCompany("ICD Systems")] [assembly: AssemblyProduct("ICD.Common.Utils")] [assembly: AssemblyCopyright("Copyright © ICD Systems 2018")] -[assembly: AssemblyVersion("8.0.0.0")] +[assembly: AssemblyVersion("8.1.0.0")] diff --git a/ICD.Common.Utils/UriUtils.cs b/ICD.Common.Utils/UriUtils.cs index aec717d..e9b7705 100644 --- a/ICD.Common.Utils/UriUtils.cs +++ b/ICD.Common.Utils/UriUtils.cs @@ -1,9 +1,17 @@ using System; +using System.Collections.Generic; namespace ICD.Common.Utils { public static class UriUtils { + private static readonly Dictionary s_SchemeToPort = + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + {Uri.UriSchemeHttp, 80}, + {Uri.UriSchemeHttps, 443} + }; + /// /// Attempts to parse the given URI string into a System.Uri instance. /// @@ -27,5 +35,16 @@ namespace ICD.Common.Utils return false; } } + + /// + /// Gets the port number for the given URI scheme. + /// + /// + /// + /// + public static bool TryGetPortForScheme(string scheme, out ushort port) + { + return s_SchemeToPort.TryGetValue(scheme, out port); + } } } diff --git a/ICD.Common.Utils/Xml/IcdXmlTextWriter.cs b/ICD.Common.Utils/Xml/IcdXmlTextWriter.cs index a2d5288..deff604 100644 --- a/ICD.Common.Utils/Xml/IcdXmlTextWriter.cs +++ b/ICD.Common.Utils/Xml/IcdXmlTextWriter.cs @@ -159,7 +159,8 @@ namespace ICD.Common.Utils.Xml { return new XmlWriterSettings { - Indent = true + Indent = true, + ConformanceLevel = ConformanceLevel.Auto }; } #endif diff --git a/ICD.Common.Utils/Xml/XmlUtils.cs b/ICD.Common.Utils/Xml/XmlUtils.cs index 1119b0c..1b698f8 100644 --- a/ICD.Common.Utils/Xml/XmlUtils.cs +++ b/ICD.Common.Utils/Xml/XmlUtils.cs @@ -1100,17 +1100,6 @@ namespace ICD.Common.Utils.Xml #region Print - /// - /// Prints the xml document. - /// - /// - [PublicAPI] - public static void Print(string xml) - { - string result = Format(xml); - IcdConsole.PrintLine(result); - } - /// /// Formats the given xml string into a human readable structure with indentations. /// @@ -1128,12 +1117,10 @@ namespace ICD.Common.Utils.Xml IcdXmlDocument document = new IcdXmlDocument(); document.LoadXml(xml); document.WriteContentTo(writer); - - writer.Flush(); - - return builder.ToString(); } } + + return builder.ToString(); } #endregion