mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-06 16:25:04 +00:00
Merge branch 'MetLife_v5.4' of https://cs-gogs.icdpf.net/Common/Utils into MetLife_v5.4
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -233,7 +233,9 @@ namespace ICD.Common.Utils
|
||||
.GetTypeInfo()
|
||||
#endif
|
||||
.GetProperties()
|
||||
// ReSharper disable InvokeAsExtensionMethod
|
||||
.Where(p => ReflectionExtensions.GetCustomAttributes<T>(p, inherit).Any());
|
||||
// ReSharper restore InvokeAsExtensionMethod
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace ICD.Common.Utils.Collections
|
||||
if (set == null)
|
||||
throw new ArgumentNullException("set");
|
||||
|
||||
IcdHashSet<T> unionSet = new IcdHashSet<T>(this);
|
||||
IcdHashSet<T> unionSet = new IcdHashSet<T>(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<T> subtractSet = new IcdHashSet<T>(this);
|
||||
IcdHashSet<T> subtractSet = new IcdHashSet<T>(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<T> intersectionSet = new IcdHashSet<T>();
|
||||
IcdHashSet<T> intersectionSet = new IcdHashSet<T>(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<T> output = new IcdHashSet<T>(this);
|
||||
IcdHashSet<T> output = new IcdHashSet<T>(m_Dict.Comparer, this);
|
||||
|
||||
foreach (T item in set)
|
||||
{
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
<Compile Include="Extensions\MethodInfoExtensions.cs" />
|
||||
<Compile Include="Extensions\ParameterInfoExtensions.cs" />
|
||||
<Compile Include="Extensions\UriExtensions.cs" />
|
||||
<Compile Include="Extensions\UshortExtensions.cs" />
|
||||
<Compile Include="Extensions\UShortExtensions.cs" />
|
||||
<Compile Include="IcdUriBuilder.cs" />
|
||||
<Compile Include="IO\Compression\IcdZipEntry.cs" />
|
||||
<Compile Include="IO\IcdBinaryReader.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")]
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ICD.Common.Utils
|
||||
{
|
||||
public static class UriUtils
|
||||
{
|
||||
private static readonly Dictionary<string, ushort> s_SchemeToPort =
|
||||
new Dictionary<string, ushort>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{Uri.UriSchemeHttp, 80},
|
||||
{Uri.UriSchemeHttps, 443}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to parse the given URI string into a System.Uri instance.
|
||||
/// </summary>
|
||||
@@ -27,5 +35,16 @@ namespace ICD.Common.Utils
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the port number for the given URI scheme.
|
||||
/// </summary>
|
||||
/// <param name="scheme"></param>
|
||||
/// <param name="port"></param>
|
||||
/// <returns></returns>
|
||||
public static bool TryGetPortForScheme(string scheme, out ushort port)
|
||||
{
|
||||
return s_SchemeToPort.TryGetValue(scheme, out port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,8 @@ namespace ICD.Common.Utils.Xml
|
||||
{
|
||||
return new XmlWriterSettings
|
||||
{
|
||||
Indent = true
|
||||
Indent = true,
|
||||
ConformanceLevel = ConformanceLevel.Auto
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1100,17 +1100,6 @@ namespace ICD.Common.Utils.Xml
|
||||
|
||||
#region Print
|
||||
|
||||
/// <summary>
|
||||
/// Prints the xml document.
|
||||
/// </summary>
|
||||
/// <param name="xml"></param>
|
||||
[PublicAPI]
|
||||
public static void Print(string xml)
|
||||
{
|
||||
string result = Format(xml);
|
||||
IcdConsole.PrintLine(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formats the given xml string into a human readable structure with indentations.
|
||||
/// </summary>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user