mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 12:45:01 +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).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Changed
|
||||||
|
- IcdHashSet preserves comparer when an operation creates a new IcdHashSet
|
||||||
|
|
||||||
|
## [8.1.0] - 2019-01-02
|
||||||
### Added
|
### Added
|
||||||
- Added GetAttributeAsEnum xml utils method
|
- Added GetAttributeAsEnum xml utils method
|
||||||
- Adding short parsing methods to XML utils
|
- Adding short parsing methods to XML utils
|
||||||
|
|||||||
@@ -233,7 +233,9 @@ namespace ICD.Common.Utils
|
|||||||
.GetTypeInfo()
|
.GetTypeInfo()
|
||||||
#endif
|
#endif
|
||||||
.GetProperties()
|
.GetProperties()
|
||||||
|
// ReSharper disable InvokeAsExtensionMethod
|
||||||
.Where(p => ReflectionExtensions.GetCustomAttributes<T>(p, inherit).Any());
|
.Where(p => ReflectionExtensions.GetCustomAttributes<T>(p, inherit).Any());
|
||||||
|
// ReSharper restore InvokeAsExtensionMethod
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ namespace ICD.Common.Utils.Collections
|
|||||||
if (set == null)
|
if (set == null)
|
||||||
throw new ArgumentNullException("set");
|
throw new ArgumentNullException("set");
|
||||||
|
|
||||||
IcdHashSet<T> unionSet = new IcdHashSet<T>(this);
|
IcdHashSet<T> unionSet = new IcdHashSet<T>(m_Dict.Comparer, this);
|
||||||
unionSet.AddRange(set);
|
unionSet.AddRange(set);
|
||||||
|
|
||||||
return unionSet;
|
return unionSet;
|
||||||
@@ -112,7 +112,7 @@ namespace ICD.Common.Utils.Collections
|
|||||||
if (set == null)
|
if (set == null)
|
||||||
throw new ArgumentNullException("set");
|
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)
|
foreach (T item in set)
|
||||||
subtractSet.Remove(item);
|
subtractSet.Remove(item);
|
||||||
@@ -131,7 +131,7 @@ namespace ICD.Common.Utils.Collections
|
|||||||
if (set == null)
|
if (set == null)
|
||||||
throw new ArgumentNullException("set");
|
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))
|
foreach (T item in set.Where(Contains))
|
||||||
intersectionSet.Add(item);
|
intersectionSet.Add(item);
|
||||||
@@ -150,7 +150,7 @@ namespace ICD.Common.Utils.Collections
|
|||||||
if (set == null)
|
if (set == null)
|
||||||
throw new ArgumentNullException("set");
|
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)
|
foreach (T item in set)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,7 +71,10 @@ namespace ICD.Common.Utils.Extensions
|
|||||||
sigBuilder.Append("(");
|
sigBuilder.Append("(");
|
||||||
|
|
||||||
firstParam = true;
|
firstParam = true;
|
||||||
|
|
||||||
|
#if !SIMPLSHARP
|
||||||
bool secondParam = false;
|
bool secondParam = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
foreach (ParameterInfo param in method.GetParameters())
|
foreach (ParameterInfo param in method.GetParameters())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
<Compile Include="Extensions\MethodInfoExtensions.cs" />
|
<Compile Include="Extensions\MethodInfoExtensions.cs" />
|
||||||
<Compile Include="Extensions\ParameterInfoExtensions.cs" />
|
<Compile Include="Extensions\ParameterInfoExtensions.cs" />
|
||||||
<Compile Include="Extensions\UriExtensions.cs" />
|
<Compile Include="Extensions\UriExtensions.cs" />
|
||||||
<Compile Include="Extensions\UshortExtensions.cs" />
|
<Compile Include="Extensions\UShortExtensions.cs" />
|
||||||
<Compile Include="IcdUriBuilder.cs" />
|
<Compile Include="IcdUriBuilder.cs" />
|
||||||
<Compile Include="IO\Compression\IcdZipEntry.cs" />
|
<Compile Include="IO\Compression\IcdZipEntry.cs" />
|
||||||
<Compile Include="IO\IcdBinaryReader.cs" />
|
<Compile Include="IO\IcdBinaryReader.cs" />
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ using System.Reflection;
|
|||||||
[assembly: AssemblyCompany("ICD Systems")]
|
[assembly: AssemblyCompany("ICD Systems")]
|
||||||
[assembly: AssemblyProduct("ICD.Common.Utils")]
|
[assembly: AssemblyProduct("ICD.Common.Utils")]
|
||||||
[assembly: AssemblyCopyright("Copyright © ICD Systems 2018")]
|
[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;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace ICD.Common.Utils
|
namespace ICD.Common.Utils
|
||||||
{
|
{
|
||||||
public static class UriUtils
|
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>
|
/// <summary>
|
||||||
/// Attempts to parse the given URI string into a System.Uri instance.
|
/// Attempts to parse the given URI string into a System.Uri instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -27,5 +35,16 @@ namespace ICD.Common.Utils
|
|||||||
return false;
|
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
|
return new XmlWriterSettings
|
||||||
{
|
{
|
||||||
Indent = true
|
Indent = true,
|
||||||
|
ConformanceLevel = ConformanceLevel.Auto
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1100,17 +1100,6 @@ namespace ICD.Common.Utils.Xml
|
|||||||
|
|
||||||
#region Print
|
#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>
|
/// <summary>
|
||||||
/// Formats the given xml string into a human readable structure with indentations.
|
/// Formats the given xml string into a human readable structure with indentations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1128,12 +1117,10 @@ namespace ICD.Common.Utils.Xml
|
|||||||
IcdXmlDocument document = new IcdXmlDocument();
|
IcdXmlDocument document = new IcdXmlDocument();
|
||||||
document.LoadXml(xml);
|
document.LoadXml(xml);
|
||||||
document.WriteContentTo(writer);
|
document.WriteContentTo(writer);
|
||||||
|
|
||||||
writer.Flush();
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return builder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user