From 470c35cab7c6bcd103de8ceda90a37f986fda8c9 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Wed, 2 Jan 2019 14:18:42 -0500 Subject: [PATCH 1/6] chore: Updating changelog, incrementing minor version --- CHANGELOG.md | 2 ++ ICD.Common.Utils/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db1c35f..ee842c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ 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] + +## [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/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")] From 4cd28a8a122aa0d889aadeb708e9ad3d5ce48d58 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Thu, 3 Jan 2019 13:03:51 -0500 Subject: [PATCH 2/6] fix: IcdHashSet preserves comparer when an operation creates a new IcdHashSet --- CHANGELOG.md | 2 ++ ICD.Common.Utils/Collections/IcdHashSet.cs | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee842c9..da1e65f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ 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 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) { From 4a411e899088ec3e85c9f14011a4a7a01c867de7 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Mon, 7 Jan 2019 12:20:13 -0500 Subject: [PATCH 3/6] refactor: Removing unused code --- ICD.Common.Utils/Xml/XmlUtils.cs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) 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 From 108317212cc6dace9de69f1c20f0a16ca30bd95d Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Mon, 7 Jan 2019 15:37:33 -0500 Subject: [PATCH 4/6] feat: Adding TryGetPortForScheme method to UriExtensions --- .../ICD.Common.Utils_SimplSharp.csproj | 2 +- ICD.Common.Utils/UriUtils.cs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj index f9eddd5..f8ee5b9 100644 --- a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj +++ b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj @@ -110,7 +110,7 @@ - + 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); + } } } From ad47c890a8252fca72ffb883eaa7cbd3d6aee7ab Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Tue, 8 Jan 2019 14:47:03 -0500 Subject: [PATCH 5/6] refactor: Tidying --- ICD.Common.Utils/AttributeUtils.cs | 2 ++ ICD.Common.Utils/Extensions/MethodInfoExtensions.cs | 3 +++ 2 files changed, 5 insertions(+) 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/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()) { From 466dc6deb51bdd6cf2323b0e99e4789b5e97ab00 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Wed, 9 Jan 2019 16:33:33 -0500 Subject: [PATCH 6/6] fix: Fixing bug where xml fragments were being written with prepended document info --- ICD.Common.Utils/Xml/IcdXmlTextWriter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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