Просмотр исходного кода

1. 修改地址处理的细节,让数据质量更准确
2. 对象比较器更换至[CompareNETObjects]

Shun 2 лет назад
Родитель
Сommit
3dd8d8f135
77 измененных файлов с 209 добавлено и 2991 удалено
  1. 5 1
      README.md
  2. 2 2
      src/YSAI.AllenBradley/YSAI.AllenBradley.csproj
  3. 2 2
      src/YSAI.Beckhoff/YSAI.Beckhoff.csproj
  4. 2 2
      src/YSAI.Can/YSAI.Can.csproj
  5. 2 2
      src/YSAI.Core/YSAI.Core.csproj
  6. 25 28
      src/YSAI.Core/handler/AddressHandler.cs
  7. 2 2
      src/YSAI.DB/YSAI.DB.csproj
  8. 1 1
      src/YSAI.DaqManage/YSAI.DaqManage.csproj
  9. 2 2
      src/YSAI.Kafka/YSAI.Kafka.csproj
  10. 2 2
      src/YSAI.Mewtocol/YSAI.Mewtocol.csproj
  11. 2 2
      src/YSAI.Mitsubishi/YSAI.Mitsubishi.csproj
  12. 2 2
      src/YSAI.Modbus/YSAI.Modbus.csproj
  13. 2 2
      src/YSAI.Model/YSAI.Model.csproj
  14. 4 4
      src/YSAI.Mqtt/YSAI.Mqtt.csproj
  15. 2 2
      src/YSAI.NetMQ/YSAI.NetMQ.csproj
  16. 2 2
      src/YSAI.Netty/YSAI.Netty.csproj
  17. 2 2
      src/YSAI.Omron/YSAI.Omron.csproj
  18. 2 2
      src/YSAI.Opc/YSAI.Opc.csproj
  19. 2 2
      src/YSAI.RabbitMQ/YSAI.RabbitMQ.csproj
  20. 2 2
      src/YSAI.Redis/YSAI.Redis.csproj
  21. 1 1
      src/YSAI.RelayManage/YSAI.RelayManage.csproj
  22. 1 1
      src/YSAI.Rest/YSAI.Rest.csproj
  23. 2 2
      src/YSAI.Rpc/YSAI.Rpc.csproj
  24. 2 2
      src/YSAI.Siemens/YSAI.Siemens.csproj
  25. 81 66
      src/YSAI.Test.Console/Program.cs
  26. 2 2
      src/YSAI.Test.Console/YSAI.Test.Console.csproj
  27. 1 1
      src/YSAI.Test/YSAI.Test.csproj
  28. 30 11
      src/YSAI.Unility/ExtensionTool.cs
  29. 0 10
      src/YSAI.Unility/ParamTool.cs
  30. 2 1
      src/YSAI.Unility/YSAI.Unility.csproj
  31. 0 79
      src/YSAI.Unility/objectsComparer/AbstractComparer.cs
  32. 0 46
      src/YSAI.Unility/objectsComparer/AbstractComparer~1.cs
  33. 0 18
      src/YSAI.Unility/objectsComparer/Attributes/IgnoreInComparisonAttribute.cs
  34. 0 186
      src/YSAI.Unility/objectsComparer/BaseComparer.cs
  35. 0 45
      src/YSAI.Unility/objectsComparer/Comparer.cs
  36. 0 219
      src/YSAI.Unility/objectsComparer/ComparerOverridesCollection.cs
  37. 0 32
      src/YSAI.Unility/objectsComparer/ComparersFactory.cs
  38. 0 183
      src/YSAI.Unility/objectsComparer/Comparer~1.cs
  39. 0 67
      src/YSAI.Unility/objectsComparer/ComparisonSettings.cs
  40. 0 122
      src/YSAI.Unility/objectsComparer/CustomComparers/AbstractDynamicObjectsComprer.cs
  41. 0 44
      src/YSAI.Unility/objectsComparer/CustomComparers/AbstractEnumerablesComparer.cs
  42. 0 58
      src/YSAI.Unility/objectsComparer/CustomComparers/CompilerGeneratedObjectComparer.cs
  43. 0 60
      src/YSAI.Unility/objectsComparer/CustomComparers/DynamicObjectComparer.cs
  44. 0 103
      src/YSAI.Unility/objectsComparer/CustomComparers/EnumerablesComparer.cs
  45. 0 65
      src/YSAI.Unility/objectsComparer/CustomComparers/EnumerablesComparer~1.cs
  46. 0 44
      src/YSAI.Unility/objectsComparer/CustomComparers/ExpandoObjectComparer.cs
  47. 0 77
      src/YSAI.Unility/objectsComparer/CustomComparers/GenericEnumerablesComparer.cs
  48. 0 51
      src/YSAI.Unility/objectsComparer/CustomComparers/HashSetsComparer.cs
  49. 0 66
      src/YSAI.Unility/objectsComparer/CustomComparers/HashSetsComparer~1.cs
  50. 0 13
      src/YSAI.Unility/objectsComparer/CustomComparers/IComparerWithCondition.cs
  51. 0 86
      src/YSAI.Unility/objectsComparer/CustomComparers/MultidimensionalArrayComparer~1.cs
  52. 0 52
      src/YSAI.Unility/objectsComparer/CustomComparers/MultidimensionalArraysComparer.cs
  53. 0 49
      src/YSAI.Unility/objectsComparer/CustomComparers/TypesComparer.cs
  54. 0 69
      src/YSAI.Unility/objectsComparer/Difference.cs
  55. 0 45
      src/YSAI.Unility/objectsComparer/DifferenceTypes.cs
  56. 0 44
      src/YSAI.Unility/objectsComparer/Exceptions/AmbiguousComparerOverrideResolutionException.cs
  57. 0 21
      src/YSAI.Unility/objectsComparer/Exceptions/ValueComparerExistsException.cs
  58. 0 88
      src/YSAI.Unility/objectsComparer/IBaseComparer.cs
  59. 0 64
      src/YSAI.Unility/objectsComparer/IComparer.cs
  60. 0 26
      src/YSAI.Unility/objectsComparer/IComparersFactory.cs
  61. 0 33
      src/YSAI.Unility/objectsComparer/IComparer~1.cs
  62. 0 54
      src/YSAI.Unility/objectsComparer/Utils/MemberInfoExtensions.cs
  63. 0 39
      src/YSAI.Unility/objectsComparer/Utils/PropertyHelper.cs
  64. 0 51
      src/YSAI.Unility/objectsComparer/Utils/TypeExtensions.cs
  65. 0 15
      src/YSAI.Unility/objectsComparer/ValueComparers/AbstractValueComparer.cs
  66. 0 41
      src/YSAI.Unility/objectsComparer/ValueComparers/AbstractValueComparer~1.cs
  67. 0 63
      src/YSAI.Unility/objectsComparer/ValueComparers/DefaultValueComparer.cs
  68. 0 50
      src/YSAI.Unility/objectsComparer/ValueComparers/DefaultValueValueComparer.cs
  69. 0 61
      src/YSAI.Unility/objectsComparer/ValueComparers/DoNotCompareValueComparer.cs
  70. 0 71
      src/YSAI.Unility/objectsComparer/ValueComparers/DynamicValueComparer.cs
  71. 0 24
      src/YSAI.Unility/objectsComparer/ValueComparers/IValueComparer.cs
  72. 0 25
      src/YSAI.Unility/objectsComparer/ValueComparers/IValueComparer~1.cs
  73. 0 48
      src/YSAI.Unility/objectsComparer/ValueComparers/IgnoreCaseStringsValueComparer.cs
  74. 0 63
      src/YSAI.Unility/objectsComparer/ValueComparers/NulableStringsValueComparer.cs
  75. 0 10
      src/YSAI.Unility/objectsComparer/ValueComparers/ToStringComparer.cs
  76. 0 38
      src/YSAI.Unility/objectsComparer/ValueComparers/UriComparer.cs
  77. 20 20
      src/YSAI.VT/Program.cs

+ 5 - 1
README.md

@@ -514,4 +514,8 @@ while(true)
 #### 2023-11-30
 1. 修改所有协议的函数开始返回的SN
 2. 优化解析,当解析失败异常,则返回空数据,为了更好的判断数据质量
-3. OPCUA新增是否重连,重连间隔参数
+3. OPCUA新增是否重连,重连间隔参数
+
+#### 2023-12-4
+1. 修改地址处理的细节,让数据质量更准确
+2. 对象比较器更换至[CompareNETObjects]

+ 2 - 2
src/YSAI.AllenBradley/YSAI.AllenBradley.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17728</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -16,6 +16,6 @@
     <Description>$(DescriptionType):$(DescriptionName) ( $(DescriptionDetails) )</Description>
   </PropertyGroup>
   <ItemGroup>
-    <PackageReference Include="YSAI.Core" Version="23.334.19090" />
+    <PackageReference Include="YSAI.Core" Version="23.338.17220" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.Beckhoff/YSAI.Beckhoff.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -17,6 +17,6 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="Beckhoff.TwinCAT.Ads" Version="6.1.125" />
-    <PackageReference Include="YSAI.Core" Version="23.334.19090" />
+    <PackageReference Include="YSAI.Core" Version="23.338.17220" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.Can/YSAI.Can.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -16,7 +16,7 @@
     <Description>$(DescriptionType):$(DescriptionName) ( $(DescriptionDetails) )</Description>
   </PropertyGroup>
   <ItemGroup>
-    <PackageReference Include="YSAI.Core" Version="23.334.19090" />
+    <PackageReference Include="YSAI.Core" Version="23.338.17220" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="Kvaser.CanLib">

+ 2 - 2
src/YSAI.Core/YSAI.Core.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19090</Version>
+    <Version>23.338.17220</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -17,7 +17,7 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="System.IO.Ports" Version="8.0.0" />
-    <PackageReference Include="YSAI.Model" Version="23.334.18639" />
+    <PackageReference Include="YSAI.Model" Version="23.338.16757" />
     <PackageReference Include="Microsoft.ClearScript" Version="7.4.4" />
   </ItemGroup>
 </Project>

+ 25 - 28
src/YSAI.Core/handler/AddressHandler.cs

@@ -29,11 +29,6 @@ namespace YSAI.Core.handler
         /// </summary>
         private static readonly string RelayLog = "Core/Relay.log";
 
-        /// <summary>
-        /// 转发失败数据备份日志输出文件
-        /// </summary>
-        private static readonly string RelayBackupsLog = "Core/RelayBackups.log";
-
         /// <summary>
         /// 转发操作
         /// </summary>
@@ -93,19 +88,13 @@ namespace YSAI.Core.handler
                         Value = outValue;
 
                         //进行解析
-                        Value = Parse(addressDetails, Value);
+                        (int Q, object? V) resData = Parse(addressDetails, Value);
 
-                        //解析完后数据为空
-                        if (Value is null || string.IsNullOrWhiteSpace(Value?.ToString()))
-                        {
-                            //数据解析错误
-                            Quality = 4;
-                        }
-                        else
-                        {
-                            //数据经过解析,并且解析成功,无法得知数据解析后的正确性
-                            Quality = 3;
-                        }
+                        //解析后的结果
+                        Value = resData.V;
+
+                        //数据质量
+                        Quality = resData.Q;
                     }
                 }
 
@@ -255,7 +244,7 @@ namespace YSAI.Core.handler
                     OperateResult operateResult = relayOperate.Produce(addressDetails.AddressRelayParam.Topic, value.ToString(), addressDetails.AddressRelayParam.ISns);
                     if (!operateResult.State)
                     {
-                        LogHelper.Error("{" + $"\"Topic\":\"{addressDetails.AddressRelayParam?.Topic}\",\"Content\":\"{value}\",\"ISns\":{addressDetails.AddressRelayParam?.ISns?.ToJson()}" + "}", RelayBackupsLog, consoleShow: false);
+                        LogHelper.Error("{" + $"\"Topic\":\"{addressDetails.AddressRelayParam?.Topic}\",\"Content\":\"{value}\",\"ISns\":{addressDetails.AddressRelayParam?.ISns?.ToJson()}" + "}", RelayLog, consoleShow: false);
                     }
                 }
             });
@@ -266,11 +255,12 @@ namespace YSAI.Core.handler
         /// </summary>
         /// <param name="addressDetails">地址详情</param>
         /// <param name="value">当前值</param>
-        /// <returns>解析后的值</returns>
-        private static string? Parse(AddressDetails addressDetails, object value)
+        /// <returns>解析后的值(数据质量,值)</returns>
+        private static (int Q, object? V) Parse(AddressDetails addressDetails, object value)
         {
             //最新值
-            object? NewValue = value;
+            object? NewValue = null;
+            //判断地址解析参数是否为空
             if (addressDetails.AddressParseParam != null)
             {
                 try
@@ -304,7 +294,7 @@ namespace YSAI.Core.handler
                         }
                         else
                         {
-                            LogHelper.Error("使用了“反射”解析,但参数错误或为空", ParseLog);
+                            LogHelper.Error("使用了“反射”解析,但参数错误", ParseLog);
                         }
                     }
 
@@ -332,22 +322,29 @@ namespace YSAI.Core.handler
                         }
                         else
                         {
-                            LogHelper.Error("使用了“脚本”解析,但参数错误或为空", ParseLog);
+                            LogHelper.Error("使用了“脚本”解析,但参数错误", ParseLog);
                         }
                     }
-                    //如果没解析到结果则赋值为空
-                    if (NewValue is null)
+
+                    //判断是否为空
+                    if (NewValue is null || string.IsNullOrWhiteSpace(NewValue.ToString()))
+                    {
+                        //为空返回空字符串,并设置数据质量为4
+                        return (4, string.Empty);
+                    }
+                    else
                     {
-                        NewValue = string.Empty;
+                        //不为空返回解析到的数据,并设置数据质量为3
+                        return (3, NewValue);
                     }
-                    return NewValue?.ToString();
                 }
                 catch (Exception ex)
                 {
                     LogHelper.Error("解析异常:" + ex.ToString(), ParseLog);
                 }
             }
-            return string.Empty;
+            //没有使用解析
+            return (1, value);
         }
     }
 }

+ 2 - 2
src/YSAI.DB/YSAI.DB.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -21,6 +21,6 @@
     <PackageReference Include="System.Data.OracleClient" Version="1.0.8" />
     <PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
     <PackageReference Include="System.Data.SQLite" Version="1.0.118" />
-    <PackageReference Include="YSAI.Core" Version="23.334.19090" />
+    <PackageReference Include="YSAI.Core" Version="23.338.17220" />
   </ItemGroup>
 </Project>

+ 1 - 1
src/YSAI.DaqManage/YSAI.DaqManage.csproj

@@ -7,7 +7,7 @@
   </PropertyGroup>
 	<ItemGroup>
 		<FrameworkReference Include="Microsoft.AspNetCore.App" />
-		<PackageReference Include="YSAI.Core" Version="23.334.19090" />
+		<PackageReference Include="YSAI.Core" Version="23.338.17220" />
 	</ItemGroup>
 
 	<!--<ItemGroup>

+ 2 - 2
src/YSAI.Kafka/YSAI.Kafka.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -17,6 +17,6 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="Confluent.Kafka" Version="2.3.0" />
-    <PackageReference Include="YSAI.Model" Version="23.334.18639" />
+    <PackageReference Include="YSAI.Model" Version="23.338.16757" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.Mewtocol/YSAI.Mewtocol.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -17,6 +17,6 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="Mewtocol.NET" Version="0.8.1" />
-    <PackageReference Include="YSAI.Core" Version="23.334.19090" />
+    <PackageReference Include="YSAI.Core" Version="23.338.17220" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.Mitsubishi/YSAI.Mitsubishi.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -16,7 +16,7 @@
     <Description>$(DescriptionType):$(DescriptionName) ( $(DescriptionDetails) )</Description>
   </PropertyGroup>
   <ItemGroup>
-    <PackageReference Include="YSAI.Core" Version="23.334.19090" />
+    <PackageReference Include="YSAI.Core" Version="23.338.17220" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\YSAI.Modbus\YSAI.Modbus.csproj" />

+ 2 - 2
src/YSAI.Modbus/YSAI.Modbus.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -18,6 +18,6 @@
   <ItemGroup>
     <PackageReference Include="NModbus" Version="3.0.81" />
     <PackageReference Include="NModbus.Serial" Version="3.0.81" />
-    <PackageReference Include="YSAI.Core" Version="23.334.19090" />
+    <PackageReference Include="YSAI.Core" Version="23.338.17220" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.Model/YSAI.Model.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.18639</Version>
+    <Version>23.338.16757</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -17,6 +17,6 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="YSAI.Log" Version="23.333.10146" />
-    <PackageReference Include="YSAI.Unility" Version="23.328.18305" />
+    <PackageReference Include="YSAI.Unility" Version="23.338.16401" />
   </ItemGroup>
 </Project>

+ 4 - 4
src/YSAI.Mqtt/YSAI.Mqtt.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -16,8 +16,8 @@
     <Description>$(DescriptionType):$(DescriptionName) ( $(DescriptionDetails) )</Description>
   </PropertyGroup>
   <ItemGroup>
-    <PackageReference Include="MQTTnet" Version="4.3.1.873" />
-    <PackageReference Include="MQTTnet.AspNetCore" Version="4.3.1.873" />
-    <PackageReference Include="YSAI.Model" Version="23.334.18639" />
+    <PackageReference Include="MQTTnet" Version="4.3.2.930" />
+    <PackageReference Include="MQTTnet.AspNetCore" Version="4.3.2.930" />
+    <PackageReference Include="YSAI.Model" Version="23.338.16757" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.NetMQ/YSAI.NetMQ.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -18,6 +18,6 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="NetMQ" Version="4.0.1.13" />
-    <PackageReference Include="YSAI.Model" Version="23.334.18639" />
+    <PackageReference Include="YSAI.Model" Version="23.338.16757" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.Netty/YSAI.Netty.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -18,6 +18,6 @@
   <ItemGroup>
     <PackageReference Include="DotNetty.Handlers" Version="0.7.5" />
     <PackageReference Include="DotNetty.Transport" Version="0.7.5" />
-    <PackageReference Include="YSAI.Model" Version="23.334.18639" />
+    <PackageReference Include="YSAI.Model" Version="23.338.16757" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.Omron/YSAI.Omron.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -16,6 +16,6 @@
     <Description>$(DescriptionType):$(DescriptionName) ( $(DescriptionDetails) )</Description>
   </PropertyGroup>
   <ItemGroup>
-    <PackageReference Include="YSAI.Core" Version="23.334.19090" />
+    <PackageReference Include="YSAI.Core" Version="23.338.17220" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.Opc/YSAI.Opc.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -17,6 +17,6 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="OPCFoundation.NetStandard.Opc.Ua" Version="1.4.372.76" />
-    <PackageReference Include="YSAI.Core" Version="23.334.19090" />
+    <PackageReference Include="YSAI.Core" Version="23.338.17220" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.RabbitMQ/YSAI.RabbitMQ.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -17,6 +17,6 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="RabbitMQ.Client" Version="6.7.0" />
-    <PackageReference Include="YSAI.Model" Version="23.334.18639" />
+    <PackageReference Include="YSAI.Model" Version="23.338.16757" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.Redis/YSAI.Redis.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -17,6 +17,6 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="StackExchange.Redis" Version="2.7.4" />
-    <PackageReference Include="YSAI.Model" Version="23.334.18639" />
+    <PackageReference Include="YSAI.Model" Version="23.338.16757" />
   </ItemGroup>
 </Project>

+ 1 - 1
src/YSAI.RelayManage/YSAI.RelayManage.csproj

@@ -9,7 +9,7 @@
 	<ItemGroup>
 		<PackageReference Include="RabbitMQ.Client" Version="6.7.0" />
 		<PackageReference Include="Confluent.Kafka" Version="2.3.0" />
-		<PackageReference Include="YSAI.Core" Version="23.334.19090" />
+		<PackageReference Include="YSAI.Core" Version="23.338.17220" />
 		<FrameworkReference Include="Microsoft.AspNetCore.App" />
 	</ItemGroup>
 

+ 1 - 1
src/YSAI.Rest/YSAI.Rest.csproj

@@ -17,6 +17,6 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="RabbitMQ.Client" Version="6.7.0" />
-    <PackageReference Include="YSAI.Model" Version="23.334.18639" />
+    <PackageReference Include="YSAI.Model" Version="23.338.16757" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.Rpc/YSAI.Rpc.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -18,6 +18,6 @@
   <ItemGroup>
     <PackageReference Include="DotNetty.Codecs" Version="0.7.5" />
     <PackageReference Include="ImpromptuInterface" Version="8.0.4" />
-    <PackageReference Include="YSAI.Model" Version="23.334.18639" />
+    <PackageReference Include="YSAI.Model" Version="23.338.16757" />
   </ItemGroup>
 </Project>

+ 2 - 2
src/YSAI.Siemens/YSAI.Siemens.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.334.19910</Version>
+    <Version>23.338.17729</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -17,6 +17,6 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="S7netplus" Version="0.20.0" />
-    <PackageReference Include="YSAI.Core" Version="23.334.19090" />
+    <PackageReference Include="YSAI.Core" Version="23.338.17220" />
   </ItemGroup>
 </Project>

+ 81 - 66
src/YSAI.Test.Console/Program.cs

@@ -1,4 +1,4 @@
-Console.WriteLine();
+//Console.WriteLine();
 
 ////实例创建的几种方式
 ////以OPCUA 采集协议为例
@@ -679,72 +679,87 @@
 //    LogHelper.Info(result.ToJson().JsonFormatting());
 //}
 
-//using S7.Net;
-//using System.Collections.Concurrent;
-//using YSAI.Core.data;
-//using YSAI.Core.@enum;
-//using YSAI.Siemens;
-//using YSAI.Unility;
-
-//SiemensOperate s7ClientOperate = SiemensOperate.Instance(new SiemensData.Basics()
-//{
-//    Ip = "192.168.2.20",
-//    Port = 102,
-//    Rack = 0,
-//    Slot = 1,
-//    CType = CpuType.S71200,
-//    ChangeOut = true,
-//    HandleInterval = 1000,
-//    SN = Guid.NewGuid().ToString()
-//}); ;
-
-////打开
-//OperateResult operateResult = s7ClientOperate.On();
-//Console.WriteLine(operateResult.Message);
+using S7.Net;
+using System.Collections.Concurrent;
+using YSAI.Model.data;
+using YSAI.Model.@enum;
+using YSAI.Siemens;
+using YSAI.Unility;
+using DataType = YSAI.Model.@enum.DataType;
+
+SiemensOperate s7ClientOperate = SiemensOperate.Instance(new SiemensData.Basics()
+{
+    Ip = "192.168.2.20",
+    Port = 102,
+    Rack = 0,
+    Slot = 1,
+    CType = CpuType.S71200,
+    ChangeOut = true,
+    HandleInterval = 1000,
+    SN = Guid.NewGuid().ToString()
+}); ;
 
-////点位地址
-//Address address = new Address();
-//address.SN = Guid.NewGuid().ToString();
-//address.CreationTime = DateTime.Now.ToLocalTime();
-//address.AddressArray = new List<AddressDetails>();
-//address.AddressArray.Add(new AddressDetails()
-//{
-//    AddressName = "DB71.DBD4",
-//    AddressDataType = YSAI.DataType.String,
-//    AddressType = AddressType.Reality
-//});
-
-////读取
-//operateResult = s7ClientOperate.Read(address);
-//Console.WriteLine(operateResult.Message);
-//if (operateResult.State)
-//{
-//    foreach (var item in operateResult.RData as ConcurrentDictionary<string, AddressValue>)
-//    {
-//        Console.WriteLine(item.Key);
-//        Console.WriteLine(item.Value.Value);
-//    }
-//}
-
-////订阅
-//s7ClientOperate.OnEvent += S7ClientOperate_OnEvent;
-//s7ClientOperate.Subscribe(address);
-
-//while (true)
-//{
-//    string value = Console.ReadLine();
-//    //写入
-//    ConcurrentDictionary<string, string> keyValuePairs = new ConcurrentDictionary<string, string>();
-//    //keyValuePairs.TryAdd("DB71.DBD4", string.IsNullOrWhiteSpace(value) ? uint.MaxValue : uint.Parse(value));
-//    keyValuePairs.TryAdd("DB71.DBD4", value);
-//    operateResult = s7ClientOperate.Write(keyValuePairs);
-//    Console.WriteLine(operateResult.Message);
-//}
-
-//void S7ClientOperate_OnEvent(object? sender, EventResult e)
-//{
-//    Console.WriteLine(e.ToJson());
-//}
+//打开
+OperateResult operateResult = s7ClientOperate.On();
+Console.WriteLine(operateResult.Message);
+
+//点位地址
+Address address = new Address();
+address.SN = Guid.NewGuid().ToString();
+address.CreationTime = DateTime.Now.ToLocalTime();
+address.AddressArray = new List<AddressDetails>();
+address.AddressArray.Add(new AddressDetails()
+{
+    AddressName = "DB71.DBD4",
+    AddressDataType = DataType.String,
+    AddressType = AddressType.Reality
+});
+
+//读取
+operateResult = s7ClientOperate.Read(address);
+Console.WriteLine(operateResult.Message);
+if (operateResult.State)
+{
+    foreach (var item in operateResult.RData as ConcurrentDictionary<string, AddressValue>)
+    {
+        Console.WriteLine(item.Key);
+        Console.WriteLine(item.Value.Value);
+    }
+}
+
+//订阅
+s7ClientOperate.OnEvent += S7ClientOperate_OnEvent;
+s7ClientOperate.Subscribe(address);
+
+while (true)
+{
+    string value = Console.ReadLine();
+    //写入
+    ConcurrentDictionary<string, string> keyValuePairs = new ConcurrentDictionary<string, string>();
+    //keyValuePairs.TryAdd("DB71.DBD4", string.IsNullOrWhiteSpace(value) ? uint.MaxValue : uint.Parse(value));
+    keyValuePairs.TryAdd("DB71.DBD4", value);
+    operateResult = s7ClientOperate.Write(keyValuePairs);
+    Console.WriteLine(operateResult.Message);
+
+
+    ////读取
+    //operateResult = s7ClientOperate.Read(address);
+    //Console.WriteLine(operateResult.Message);
+    //if (operateResult.State)
+    //{
+    //    foreach (var item in operateResult.RData as ConcurrentDictionary<string, AddressValue>)
+    //    {
+    //        Console.WriteLine(item.Key);
+    //        Console.WriteLine(item.Value.Value);
+    //    }
+    //}
+
+}
+
+void S7ClientOperate_OnEvent(object? sender, EventResult e)
+{
+    Console.WriteLine(e.ToJson());
+}
 
 //WsServiceOperate wsServiceOperate = WsServiceOperate.Instance(new WsServiceData.Basics
 //{

+ 2 - 2
src/YSAI.Test.Console/YSAI.Test.Console.csproj

@@ -9,7 +9,7 @@
   </PropertyGroup>
 
 	<ItemGroup>
-		<ProjectReference Include="..\YSAI.AllenBradley\YSAI.AllenBradley.csproj" />
+		<!--<ProjectReference Include="..\YSAI.AllenBradley\YSAI.AllenBradley.csproj" />
 		<ProjectReference Include="..\YSAI.Beckhoff\YSAI.Beckhoff.csproj" />
 		<ProjectReference Include="..\YSAI.Can\YSAI.Can.csproj" />
 		<ProjectReference Include="..\YSAI.DB\YSAI.DB.csproj" />
@@ -24,7 +24,7 @@
 		<ProjectReference Include="..\YSAI.Opc\YSAI.Opc.csproj" />
 		<ProjectReference Include="..\YSAI.RabbitMQ\YSAI.RabbitMQ.csproj" />
 		<ProjectReference Include="..\YSAI.DaqManage\YSAI.DaqManage.csproj" />
-		<ProjectReference Include="..\YSAI.RelayManage\YSAI.RelayManage.csproj" />
+		<ProjectReference Include="..\YSAI.RelayManage\YSAI.RelayManage.csproj" />-->
 		<ProjectReference Include="..\YSAI.Siemens\YSAI.Siemens.csproj" />
 	</ItemGroup>
 

+ 1 - 1
src/YSAI.Test/YSAI.Test.csproj

@@ -17,7 +17,7 @@
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
-	<PackageReference Include="YSAI.Core" Version="23.334.19090" />
+	<PackageReference Include="YSAI.Core" Version="23.338.17220" />
   </ItemGroup>
 
   <ItemGroup>

+ 30 - 11
src/YSAI.Unility/ExtensionTool.cs

@@ -1,11 +1,11 @@
-using Newtonsoft.Json;
+using KellermanSoftware.CompareNetObjects;
+using Newtonsoft.Json;
 using System.Diagnostics;
 using System.Net;
 using System.Security.Cryptography;
 using System.Text;
 using System.Text.RegularExpressions;
 using System.Xml.Serialization;
-using YSAI.Unility.objectsComparer;
 
 namespace YSAI.Unility
 {
@@ -40,6 +40,11 @@ namespace YSAI.Unility
             stopTime.Stop();
         }
 
+        /// <summary>
+        /// 对象比对器
+        /// </summary>
+        private static CompareLogic compare;
+
         /// <summary>
         /// 对象比对器
         /// </summary>
@@ -50,24 +55,38 @@ namespace YSAI.Unility
         /// <returns>(是否一致,不一致的原因)</returns>
         public static (bool result, string message) Comparer<T>(this T a, T b, string[]? ignoreMember = null)
         {
+            if (compare == null)
+            {
+                compare = new CompareLogic();
+                //使用识别对象比较
+                compare.Config.UseHashCodeIdentifier = true;
+                //对象比较
+                compare.Config.IgnoreObjectTypes = true;
+                //执行深比较
+                compare.Config.CompareChildren = true;
+            }
             //操作结果
             (bool result, string message) OR = new(false, string.Empty);
-            objectsComparer.Comparer<T> comparer = new objectsComparer.Comparer<T>();
-            IEnumerable<Difference> differences;
+
             //忽略比对成员
             if (ignoreMember != null && ignoreMember.Length > 0)
             {
-                for (int i = 0; i < ignoreMember.Length; i++)
-                {
-                    comparer.IgnoreMember(ignoreMember[i]);
-                }
+                compare.Config.MembersToIgnore.AddRange(ignoreMember.ToList());
             }
-            OR.result = comparer.Compare(a, b, out differences);
-            if (!OR.result)
+            //进行比对
+            ComparisonResult result = compare.Compare(a, b);
+            //结果状态
+            OR.result = result.AreEqual;
+            if (!result.AreEqual)
             {
-                OR.message = string.Join(Environment.NewLine, differences);
+                //不同之处
+                OR.message = result.DifferencesString;
             }
+            //清空按名称忽略特定成员
+            compare.Config.MembersToIgnore.Clear();
+            //返回结果
             return OR;
+
         }
 
 

+ 0 - 10
src/YSAI.Unility/ParamTool.cs

@@ -1,10 +0,0 @@
-namespace YSAI.Unility
-{
-    /// <summary>
-    /// 参数工具
-    /// </summary>
-    public class ParamTool
-    {
-
-    }
-}

+ 2 - 1
src/YSAI.Unility/YSAI.Unility.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.328.18305</Version>
+    <Version>23.338.16401</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>
@@ -16,6 +16,7 @@
     <Description>$(DescriptionType):$(DescriptionName) ( $(DescriptionDetails) )</Description>
   </PropertyGroup>
   <ItemGroup>
+    <PackageReference Include="CompareNETObjects" Version="4.82.0" />
     <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
   </ItemGroup>
 </Project>

+ 0 - 79
src/YSAI.Unility/objectsComparer/AbstractComparer.cs

@@ -1,79 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Implementation of <see cref="T:YSAI.Unility.objectsComparer.IComparer" /> which provides implementation of Compare methods.
-    /// </summary>
-    public abstract class AbstractComparer : BaseComparer, IComparer
-    {
-        protected AbstractComparer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        public abstract IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2);
-
-        /// <summary>
-        /// Calculates list of differences between objects.
-        /// </summary>
-        /// <typeparam name="T">Type.</typeparam>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>List of differences between objects.</returns>
-        public IEnumerable<Difference> CalculateDifferences<T>(T obj1, T obj2)
-        {
-            return CalculateDifferences(typeof(T), obj1, obj2);
-        }
-
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <param name="type">Type.</param>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="differences">List of differences.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        public bool Compare(Type type, object obj1, object obj2, out IEnumerable<Difference> differences)
-        {
-            differences = CalculateDifferences(type, obj1, obj2);
-
-            return !differences.Any();
-        }
-
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <param name="type">Type.</param>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        public bool Compare(Type type, object obj1, object obj2)
-        {
-            return !CalculateDifferences(type, obj1, obj2).Any();
-        }
-
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <typeparam name="T">Type.</typeparam>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="differences">List of differences.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        public bool Compare<T>(T obj1, T obj2, out IEnumerable<Difference> differences)
-        {
-            return Compare(typeof(T), obj1, obj2, out differences);
-        }
-
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <typeparam name="T">Type.</typeparam>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        public bool Compare<T>(T obj1, T obj2)
-        {
-            return Compare(typeof(T), obj1, obj2);
-        }
-    }
-}

+ 0 - 46
src/YSAI.Unility/objectsComparer/AbstractComparer~1.cs

@@ -1,46 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Implementation of <see cref="IComparer{T}"/> which provides implementation of Compare methods.
-    /// </summary>
-    public abstract class AbstractComparer<T> : BaseComparer, IComparer<T>
-    {
-        protected AbstractComparer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="differences">List of differences.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        public bool Compare(T obj1, T obj2, out IEnumerable<Difference> differences)
-        {
-            differences = CalculateDifferences(obj1, obj2);
-
-            return !differences.Any();
-        }
-
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        public bool Compare(T obj1, T obj2)
-        {
-            return !CalculateDifferences(obj1, obj2).Any();
-        }
-
-        /// <summary>
-        /// Calculates list of differences between objects.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>List of differences between objects.</returns>
-        public abstract IEnumerable<Difference> CalculateDifferences(T obj1, T obj2);
-    }
-}

+ 0 - 18
src/YSAI.Unility/objectsComparer/Attributes/IgnoreInComparisonAttribute.cs

@@ -1,18 +0,0 @@
-// ***********************************************************************
-// Assembly         : Objects Comparer
-// Author           : Ankur Kumar Gupta
-// Created          : 24-Feb-2022
-// ***********************************************************************
-
-namespace YSAI.Unility.objectsComparer.Attributes
-{
-    using System;
-
-    /// <summary>
-    /// Class is used to specify whether the element on which it is applied will have comparison effect
-    /// </summary>
-    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
-    public sealed class IgnoreInComparisonAttribute : Attribute
-    {
-    }
-}

+ 0 - 186
src/YSAI.Unility/objectsComparer/BaseComparer.cs

@@ -1,186 +0,0 @@
-using System.Linq.Expressions;
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Provides base implementation to configure comparer.
-    /// </summary>
-    public abstract class BaseComparer : IBaseComparer
-    {
-        /// <summary>
-        /// Comparison Settings.
-        /// </summary>
-        public ComparisonSettings Settings { get; }
-
-        /// <summary>
-        /// Default <see cref="IValueComparer"/>
-        /// </summary>
-        public IValueComparer DefaultValueComparer { get; private set; }
-
-        protected IComparersFactory Factory { get; }
-
-        internal ComparerOverridesCollection OverridesCollection { get; } = new ComparerOverridesCollection();
-
-        protected BaseComparer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory)
-        {
-            Factory = factory ?? new ComparersFactory();
-            Settings = settings ?? new ComparisonSettings();
-            DefaultValueComparer = new DefaultValueComparer();
-            // ReSharper disable once InvertIf
-            if (parentComparer != null)
-            {
-                DefaultValueComparer = parentComparer.DefaultValueComparer;
-                OverridesCollection.Merge(parentComparer.OverridesCollection);
-            }
-        }
-
-        /// <summary>
-        /// Adds Comparer Override by Type.
-        /// </summary>
-        /// <param name="type">Type.</param>
-        /// <param name="valueComparer">Value Comparer.</param>
-        /// <param name="filter">Value Comparer will be used only if filter(memberInfo) == true. Null by default.</param>
-        public void AddComparerOverride(Type type, IValueComparer valueComparer, Func<MemberInfo, bool> filter = null)
-        {
-            OverridesCollection.AddComparer(type, valueComparer, filter);
-        }
-
-        /// <summary>
-        /// Adds Comparer Override by member filter.
-        /// </summary>
-        /// <param name="valueComparer">Value Comparer.</param>
-        /// <param name="filter">Value Comparer will be used only if filter(memberInfo) == true.</param>
-        public void AddComparerOverride(IValueComparer valueComparer, Func<MemberInfo, bool> filter)
-        {
-            OverridesCollection.AddComparer(valueComparer, filter);
-        }
-
-        /// <summary>
-        /// Adds Comparer Override by Type.
-        /// </summary>
-        /// <typeparam name="TType">Type.</typeparam>
-        /// <param name="valueComparer">Value Comparer.</param>
-        /// <param name="filter">Value Comparer will be used only if filter(memberInfo) == true. Null by default.</param>
-        public void AddComparerOverride<TType>(IValueComparer valueComparer, Func<MemberInfo, bool> filter = null)
-        {
-            AddComparerOverride(typeof(TType), valueComparer, filter);
-        }
-
-        /// <summary>
-        /// Adds Comparer Override by Member.
-        /// </summary>
-        /// <typeparam name="TProp">Type of the member.</typeparam>
-        /// <param name="memberLambda">Lambda to get member.</param>
-        /// <param name="valueComparer">Value Comparer.</param>
-        public void AddComparerOverride<TProp>(Expression<Func<TProp>> memberLambda, IValueComparer valueComparer)
-        {
-            OverridesCollection.AddComparer(PropertyHelper.GetMemberInfo(memberLambda), valueComparer);
-        }
-
-        /// <summary>
-        /// Adds Comparer Override by Member.
-        /// </summary>
-        /// <typeparam name="TProp">Type of the member.</typeparam>
-        /// <param name="memberLambda">Lambda to get member.</param>
-        /// <param name="compareFunction">Function to compare objects.</param>
-        /// <param name="toStringFunction">Function to convert objects to string.</param>
-        public void AddComparerOverride<TProp>(
-            Expression<Func<TProp>> memberLambda,
-            Func<TProp, TProp, ComparisonSettings, bool> compareFunction,
-            Func<TProp, string> toStringFunction)
-        {
-            OverridesCollection.AddComparer(
-                PropertyHelper.GetMemberInfo(memberLambda),
-                new DynamicValueComparer<TProp>(
-                    compareFunction,
-                    toStringFunction));
-        }
-
-        /// <summary>
-        /// Adds Comparer Override by Member.
-        /// </summary>
-        /// <typeparam name="TProp">Type of the member.</typeparam>
-        /// <param name="memberLambda">Lambda to get member.</param>
-        /// <param name="compareFunction">Function to compare objects.</param>
-        public void AddComparerOverride<TProp>(
-            Expression<Func<TProp>> memberLambda,
-            Func<TProp, TProp, ComparisonSettings, bool> compareFunction)
-        {
-            OverridesCollection.AddComparer(
-                PropertyHelper.GetMemberInfo(memberLambda),
-                new DynamicValueComparer<TProp>(
-                    compareFunction,
-                    obj => obj?.ToString()));
-        }
-
-        /// <summary>
-        /// Adds Comparer Override by Member.
-        /// </summary>
-        /// <param name="memberInfo">Member Info.</param>
-        /// <param name="valueComparer">Value Comparer.</param>
-        public void AddComparerOverride(MemberInfo memberInfo, IValueComparer valueComparer)
-        {
-            OverridesCollection.AddComparer(memberInfo, valueComparer);
-        }
-
-        /// <summary>
-        /// Adds Comparer Override by Member name.
-        /// </summary>
-        /// <param name="memberName">Member Name.</param>
-        /// <param name="valueComparer">Value Comparer.</param>
-        /// <param name="filter">Value Comparer will be used only if filter(memberInfo) == true. Null by default.</param>
-        public void AddComparerOverride(string memberName, IValueComparer valueComparer, Func<MemberInfo, bool> filter = null)
-        {
-            OverridesCollection.AddComparer(memberName, valueComparer, filter);
-        }
-
-        /// <summary>
-        /// Sets <see cref="IBaseComparer.DefaultValueComparer"/>.
-        /// </summary>
-        /// <param name="valueComparer">Value Comparer.</param>
-        public void SetDefaultComparer(IValueComparer valueComparer)
-        {
-            DefaultValueComparer = valueComparer ?? throw new ArgumentNullException(nameof(valueComparer));
-        }
-
-        /// <summary>
-        /// Ignors comparison for Type.
-        /// </summary>
-        /// <typeparam name="TType">Type.</typeparam>
-        public void IgnoreMember<TType>()
-        {
-            OverridesCollection.AddComparer(typeof(TType), DoNotCompareValueComparer.Instance);
-        }
-
-        /// <summary>
-        /// Ignors comparison for Member.
-        /// </summary>
-        /// <typeparam name="TProp">Type of the member.</typeparam>
-        public void IgnoreMember<TProp>(Expression<Func<TProp>> memberLambda)
-        {
-            OverridesCollection.AddComparer(
-                PropertyHelper.GetMemberInfo(memberLambda),
-                DoNotCompareValueComparer.Instance);
-        }
-
-        /// <summary>
-        /// Ignors comparison for Member by Member name.
-        /// </summary>
-        /// <param name="memberName">Member Name.</param>
-        public void IgnoreMember(string memberName)
-        {
-            OverridesCollection.AddComparer(memberName, DoNotCompareValueComparer.Instance);
-        }
-
-        /// <summary>
-        /// Ignors comparison by Member filter.
-        /// </summary>
-        /// <param name="filter">Member will be ignored if filter(memberInfo) == true.</param>
-        public void IgnoreMember(Func<MemberInfo, bool> filter)
-        {
-            OverridesCollection.AddComparer(DoNotCompareValueComparer.Instance, filter);
-        }
-    }
-}

+ 0 - 45
src/YSAI.Unility/objectsComparer/Comparer.cs

@@ -1,45 +0,0 @@
-using System.Reflection;
-
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Compares objects.
-    /// </summary>
-    public class Comparer : AbstractComparer
-    {
-        private static string CalculateDifferencesMethodName
-        {
-            // ReSharper disable once IteratorMethodResultIsIgnored
-            get { return Utils.MemberInfoExtensions.GetMethodName<Comparer<object>>(x => x.CalculateDifferences(null, null)); }
-        }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="Comparer" /> class.
-        /// </summary>
-        /// <param name="settings">Comparison Settings.</param>
-        /// <param name="parentComparer">Parent Comparer. Is used to copy DefaultValueComparer and Overrides. Null by default.</param>
-        /// <param name="factory">Factory to create comparers in case of some members of the objects will need it.</param>
-        public Comparer(ComparisonSettings settings = null, BaseComparer parentComparer = null, IComparersFactory factory = null) : base(settings, parentComparer, factory)
-        {
-        }
-
-        /// <summary>
-        /// Calculates list of differences between objects.
-        /// </summary>
-        /// <param name="type">Type.</param>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>List of differences between objects.</returns>
-        public override IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2)
-        {
-            var objectsComparerMethod = typeof(IComparersFactory).GetTypeInfo().GetMethods().First(m => m.IsGenericMethod);
-            var objectsComparerGenericMethod = objectsComparerMethod.MakeGenericMethod(type);
-            var comparer = objectsComparerGenericMethod.Invoke(Factory, new object[] { Settings, this });
-            var genericType = typeof(IComparer<>).MakeGenericType(type);
-            var method = genericType.GetTypeInfo().GetMethod(CalculateDifferencesMethodName, new[] { type, type });
-
-            // ReSharper disable once PossibleNullReferenceException
-            return (IEnumerable<Difference>)method.Invoke(comparer, new[] { obj1, obj2 });
-        }
-    }
-}

+ 0 - 219
src/YSAI.Unility/objectsComparer/ComparerOverridesCollection.cs

@@ -1,219 +0,0 @@
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Exceptions;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class ComparerOverridesCollection
-    {
-        private class ValueComparerWithFilter
-        {
-            public IValueComparer ValueComparer { get; }
-
-            public Func<MemberInfo, bool> Filter { get; }
-
-            public ValueComparerWithFilter(IValueComparer valueComparer, Func<MemberInfo, bool> filter)
-            {
-                Filter = filter;
-                ValueComparer = valueComparer;
-            }
-        }
-
-        private readonly List<Tuple<Func<MemberInfo, bool>, IValueComparer>> _overridesByMemberFilter = new List<Tuple<Func<MemberInfo, bool>, IValueComparer>>();
-        private readonly Dictionary<MemberInfo, IValueComparer> _overridesByMember = new Dictionary<MemberInfo, IValueComparer>();
-        private readonly Dictionary<Type, List<ValueComparerWithFilter>> _overridesByType = new Dictionary<Type, List<ValueComparerWithFilter>>();
-        private readonly Dictionary<string, List<ValueComparerWithFilter>> _overridesByName = new Dictionary<string, List<ValueComparerWithFilter>>();
-
-        public void AddComparer(MemberInfo memberInfo, IValueComparer valueComparer)
-        {
-            if (memberInfo == null)
-            {
-                throw new ArgumentNullException(nameof(memberInfo));
-            }
-
-            if (_overridesByMember.ContainsKey(memberInfo))
-            {
-                throw new ValueComparerExistsException(memberInfo);
-            }
-
-            _overridesByMember[memberInfo] = valueComparer ?? throw new ArgumentNullException(nameof(valueComparer));
-        }
-
-        public void AddComparer(IValueComparer valueComparer, Func<MemberInfo, bool> filter)
-        {
-            if (filter == null)
-            {
-                throw new ArgumentNullException(nameof(filter));
-            }
-
-            _overridesByMemberFilter.Add(new Tuple<Func<MemberInfo, bool>, IValueComparer>(filter, valueComparer));
-        }
-
-        public void AddComparer(Type type, IValueComparer valueComparer,
-            Func<MemberInfo, bool> filter = null)
-        {
-            if (type == null)
-            {
-                throw new ArgumentNullException(nameof(type));
-            }
-
-            if (valueComparer == null)
-            {
-                throw new ArgumentNullException(nameof(valueComparer));
-            }
-
-            if (!_overridesByType.ContainsKey(type))
-            {
-                _overridesByType[type] = new List<ValueComparerWithFilter>();
-            }
-
-            if (!_overridesByType[type].Any(comparer => comparer.ValueComparer == valueComparer && comparer.Filter == filter))
-            {
-                _overridesByType[type].Add(new ValueComparerWithFilter(valueComparer, filter));
-            }
-        }
-
-        public void AddComparer(string memberName, IValueComparer valueComparer,
-            Func<MemberInfo, bool> filter = null)
-        {
-            if (string.IsNullOrWhiteSpace(memberName))
-            {
-                throw new ArgumentException($"{nameof(memberName)} cannot be null or empty");
-            }
-
-            if (valueComparer == null)
-            {
-                throw new ArgumentNullException(nameof(valueComparer));
-            }
-
-            if (!_overridesByName.ContainsKey(memberName))
-            {
-                _overridesByName[memberName] = new List<ValueComparerWithFilter>();
-            }
-
-            _overridesByName[memberName].Add(new ValueComparerWithFilter(valueComparer, filter));
-        }
-
-        public void Merge(ComparerOverridesCollection collection)
-        {
-            foreach (var overridePair in collection._overridesByMember)
-            {
-                AddComparer(overridePair.Key, overridePair.Value);
-            }
-
-            foreach (var overrideCollection in collection._overridesByType)
-            {
-                foreach (var overridePair in overrideCollection.Value)
-                {
-                    AddComparer(overrideCollection.Key, overridePair.ValueComparer, overridePair.Filter);
-                }
-            }
-
-            foreach (var overrideCollection in collection._overridesByName)
-            {
-                foreach (var overridePair in overrideCollection.Value)
-                {
-                    AddComparer(overrideCollection.Key, overridePair.ValueComparer, overridePair.Filter);
-                }
-            }
-
-            foreach (var memberFilterOverride in collection._overridesByMemberFilter)
-            {
-                AddComparer(memberFilterOverride.Item2, memberFilterOverride.Item1);
-            }
-        }
-
-        public IValueComparer GetComparer(Type type)
-        {
-            if (type == null)
-            {
-                throw new ArgumentNullException(nameof(type));
-            }
-
-            if (!_overridesByType.TryGetValue(type, out var overridesByType))
-            {
-                return null;
-            }
-
-            overridesByType = overridesByType.Where(o => o.Filter == null).ToList();
-            if (overridesByType.Count > 1)
-            {
-                throw new AmbiguousComparerOverrideResolutionException(type);
-            }
-
-            return overridesByType.Count == 1 ? overridesByType[0].ValueComparer : null;
-        }
-
-        public IValueComparer GetComparer(MemberInfo memberInfo)
-        {
-            if (memberInfo == null)
-            {
-                throw new ArgumentNullException(nameof(memberInfo));
-            }
-
-            if (_overridesByMember.TryGetValue(memberInfo, out var overrideByMemberInfo))
-            {
-                return overrideByMemberInfo;
-            }
-
-            var memberFilterOverride = _overridesByMemberFilter.Find(t => t.Item1(memberInfo))?.Item2;
-            if (memberFilterOverride != null)
-            {
-                return memberFilterOverride;
-            }
-
-            if (_overridesByName.TryGetValue(memberInfo.Name, out var overridesByName))
-            {
-                overridesByName = overridesByName.Where(o => o.Filter == null || o.Filter(memberInfo)).ToList();
-
-                if (overridesByName.Count > 1)
-                {
-                    throw new AmbiguousComparerOverrideResolutionException(memberInfo);
-                }
-
-                if (overridesByName.Count == 1)
-                {
-                    return overridesByName[0].ValueComparer;
-                }
-            }
-
-            if (_overridesByType.TryGetValue(memberInfo.GetMemberType(), out var overridesByType))
-            {
-                overridesByType = overridesByType.Where(o => o.Filter == null || o.Filter(memberInfo)).ToList();
-
-                if (overridesByType.Count > 1)
-                {
-                    throw new AmbiguousComparerOverrideResolutionException(memberInfo);
-                }
-
-                if (overridesByType.Count == 1)
-                {
-                    return overridesByType[0].ValueComparer;
-                }
-            }
-
-            return null;
-        }
-
-        public IValueComparer GetComparer(string memberName)
-        {
-            if (string.IsNullOrWhiteSpace(memberName))
-            {
-                throw new ArgumentNullException(nameof(memberName));
-            }
-
-            if (!_overridesByName.TryGetValue(memberName, out var overridesByName))
-            {
-                return null;
-            }
-
-            overridesByName = overridesByName.Where(o => o.Filter == null).ToList();
-            if (overridesByName.Count > 1)
-            {
-                throw new AmbiguousComparerOverrideResolutionException(memberName);
-            }
-
-            return overridesByName.Count == 1 ? overridesByName[0].ValueComparer : null;
-        }
-    }
-}

+ 0 - 32
src/YSAI.Unility/objectsComparer/ComparersFactory.cs

@@ -1,32 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Implements Comparers Factory.
-    /// </summary>
-    public class ComparersFactory : IComparersFactory
-    {
-        /// <summary>
-        /// Creates type specific comparer.
-        /// </summary>
-        /// <typeparam name="T">Type.</typeparam>
-        /// <param name="settings">Comparison Settings. Null by default.</param>
-        /// <param name="parentComparer">Parent comparer. Null by default.</param>
-        /// <returns>Instance of <see cref="IComparer{T}"/>.</returns>
-        public virtual IComparer<T> GetObjectsComparer<T>(ComparisonSettings settings = null, BaseComparer parentComparer = null)
-        {
-            return new Comparer<T>(settings, parentComparer, this);
-        }
-
-        /// <summary>
-        /// Creates type specific comparer.
-        /// </summary>
-        /// <param name="type">Type.</param>
-        /// <param name="settings">Comparison Settings. Null by default.</param>
-        /// <param name="parentComparer">Parent comparer. Null by default.</param>
-        /// <returns>Instance of <see cref="IComparer"/>.</returns>
-        public IComparer GetObjectsComparer(Type type, ComparisonSettings settings = null, BaseComparer parentComparer = null)
-        {
-            return new Comparer(settings, parentComparer, this);
-        }
-    }
-}

+ 0 - 183
src/YSAI.Unility/objectsComparer/Comparer~1.cs

@@ -1,183 +0,0 @@
-using System.Reflection;
-using System.Text;
-using YSAI.Unility.objectsComparer.Attributes;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Compares objects of type <see cref="T"/>.
-    /// </summary>
-    public class Comparer<T> : AbstractComparer<T>
-    {
-        private readonly List<MemberInfo> _members;
-        private readonly List<IComparerWithCondition> _conditionalComparers;
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="Comparer{T}" /> class.
-        /// </summary>
-        /// <param name="settings">Comparison Settings.</param>
-        /// <param name="parentComparer">Parent Comparer. Is used to copy DefaultValueComparer and Overrides. Null by default.</param>
-        /// <param name="factory">Factory to create comparers in case of some members of the objects will need it.</param>
-        public Comparer(ComparisonSettings settings = null, BaseComparer parentComparer = null, IComparersFactory factory = null)
-            : base(settings, parentComparer, factory)
-        {
-            var properties = GetProperties(typeof(T), new List<Type>());
-            var fields = typeof(T).GetTypeInfo().GetFields().Where(f =>
-                f.IsPublic
-                && !f.IsStatic
-                && !f.GetCustomAttributes(true).Any(c => c is IgnoreInComparisonAttribute)).ToList();
-            _members = properties.Union(fields.Cast<MemberInfo>()).ToList();
-            _conditionalComparers = new List<IComparerWithCondition>
-            {
-                new MultidimensionalArraysComparer(Settings, this, Factory),
-                new ExpandoObjectComparer(Settings, this, Factory),
-                new DynamicObjectComparer(Settings, this, Factory),
-                new CompilerGeneratedObjectComparer(Settings, this, Factory),
-                new HashSetsComparer(Settings, this, Factory),
-                new GenericEnumerablesComparer(Settings, this, Factory),
-                new EnumerablesComparer(Settings, this, Factory),
-                new TypesComparer(Settings, this, Factory)
-            };
-
-            // Additional value comparers
-            AddComparerOverride<StringBuilder>(new ToStringComparer<StringBuilder>());
-            AddComparerOverride<Uri>(UriComparer.Instance);
-        }
-
-        /// <summary>
-        /// Calculates list of differences between objects.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>List of differences between objects.</returns>
-        public override IEnumerable<Difference> CalculateDifferences(T obj1, T obj2)
-        {
-            return CalculateDifferences(obj1, obj2, null);
-        }
-
-        internal IEnumerable<Difference> CalculateDifferences(T obj1, T obj2, MemberInfo memberInfo)
-        {
-            var comparer = memberInfo != null
-                ? OverridesCollection.GetComparer(memberInfo)
-                : OverridesCollection.GetComparer(typeof(T));
-
-            if (typeof(T).IsComparable() ||
-                comparer != null)
-            {
-                comparer = comparer ?? DefaultValueComparer;
-                if (!comparer.Compare(obj1, obj2, Settings))
-                {
-                    yield return
-                        new Difference(string.Empty, comparer.ToString(obj1),
-                            comparer.ToString(obj2));
-                }
-
-                yield break;
-            }
-
-            var conditionalComparer = _conditionalComparers.FirstOrDefault(c => c.IsMatch(typeof(T), obj1, obj2));
-            if (conditionalComparer != null)
-            {
-                foreach (var difference in conditionalComparer.CalculateDifferences(typeof(T), obj1, obj2))
-                {
-                    yield return difference;
-                }
-
-                if (conditionalComparer.IsStopComparison(typeof(T), obj1, obj2))
-                {
-                    yield break;
-                }
-            }
-
-            if (obj1 == null || obj2 == null)
-            {
-                if (!DefaultValueComparer.Compare(obj1, obj2, Settings))
-                {
-                    yield return new Difference(string.Empty, DefaultValueComparer.ToString(obj1), DefaultValueComparer.ToString(obj2));
-                }
-
-                yield break;
-            }
-
-            if (!Settings.RecursiveComparison)
-            {
-                yield break;
-            }
-
-            foreach (var member in _members)
-            {
-                if (member.GetCustomAttributes(true).Any(c => c is IgnoreInComparisonAttribute))
-                {
-                    continue;
-                }
-
-                var value1 = member.GetMemberValue(obj1);
-                var value2 = member.GetMemberValue(obj2);
-                var type = member.GetMemberType();
-
-                if (conditionalComparer != null && conditionalComparer.SkipMember(typeof(T), member))
-                {
-                    continue;
-                }
-
-                var valueComparer = DefaultValueComparer;
-                var hasCustomComparer = false;
-
-                var comparerOverride = OverridesCollection.GetComparer(member);
-                if (comparerOverride != null)
-                {
-                    valueComparer = comparerOverride;
-                    hasCustomComparer = true;
-                }
-
-                if (!hasCustomComparer
-                    && !type.IsComparable())
-                {
-                    var objectDataComparer = Factory.GetObjectsComparer(type, Settings, this);
-
-                    foreach (var failure in objectDataComparer.CalculateDifferences(type, value1, value2))
-                    {
-                        yield return failure.InsertPath(member.Name);
-                    }
-
-                    continue;
-                }
-
-                if (!valueComparer.Compare(value1, value2, Settings))
-                {
-                    yield return new Difference(member.Name, valueComparer.ToString(value1), valueComparer.ToString(value2));
-                }
-            }
-        }
-
-        private List<PropertyInfo> GetProperties(Type type, List<Type> processedTypes)
-        {
-            var properties = type.GetTypeInfo().GetProperties().Where(p =>
-                p.CanRead
-                && p.GetGetMethod(true).IsPublic
-                && p.GetGetMethod(true).GetParameters().Length == 0
-                && !p.GetCustomAttributes(true).Any(c => c is IgnoreInComparisonAttribute)
-                && !p.GetGetMethod(true).IsStatic).ToList();
-            processedTypes.Add(type);
-
-            if (type.GetTypeInfo().IsInterface)
-            {
-                foreach (var parrentInterface in type.GetTypeInfo().GetInterfaces())
-                {
-                    if (processedTypes.Contains(parrentInterface))
-                    {
-                        continue;
-                    }
-
-                    properties = properties
-                        .Union(GetProperties(parrentInterface, processedTypes))
-                        .Distinct()
-                        .ToList();
-                }
-            }
-
-            return properties;
-        }
-    }
-}

+ 0 - 67
src/YSAI.Unility/objectsComparer/ComparisonSettings.cs

@@ -1,67 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Configuration for Objects Comparer.
-    /// </summary>
-    public class ComparisonSettings
-    {
-        /// <summary>
-        /// If true, all members which are not primitive types, do not have custom comparison rule and
-        /// do not implement <see cref="IComparable"/> will be compared as separate objects using the same rules as current objects. True by default.
-        /// </summary>
-        public bool RecursiveComparison { get; set; }
-
-        /// <summary>
-        /// If true, empty <see cref="System.Collections.IEnumerable"/>  and null values will be considered as equal values. False by default.
-        /// </summary>
-        public bool EmptyAndNullEnumerablesEqual { get; set; }
-
-        /// <summary>
-        /// If true and member does not exists, objects comparer will consider that this member is equal to default value of opposite member type.
-        /// Applicable for dynamic types comparison only. False by default.
-        /// </summary>
-        public bool UseDefaultIfMemberNotExist { get; set; }
-
-        private readonly Dictionary<Tuple<Type, string>, object> _settings = new Dictionary<Tuple<Type, string>, object>();
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ComparisonSettings" /> class.
-        /// </summary>
-        public ComparisonSettings()
-        {
-            RecursiveComparison = true;
-            EmptyAndNullEnumerablesEqual = false;
-            UseDefaultIfMemberNotExist = false;
-        }
-
-        /// <summary>
-        /// Sets value of custom setting. Could be used to pass parameters to custom value comparers.
-        /// </summary>
-        /// <typeparam name="T">Setting Type.</typeparam>
-        /// <param name="value">Setting Value.</param>
-        /// <param name="key">Setting Key.</param>
-        public void SetCustomSetting<T>(T value, string key = null)
-        {
-            var dictionaryKey = new Tuple<Type, string>(typeof(T), key);
-            _settings[dictionaryKey] = value;
-        }
-
-        /// <summary>
-        /// Gets value of custom setting. Could be used in custom value comparers.
-        /// </summary>
-        /// <typeparam name="T">Setting Type.</typeparam>
-        /// <param name="key">Setting Key.</param>
-        /// <returns>Setting Value.</returns>
-        public T GetCustomSetting<T>(string key = null)
-        {
-            var dictionaryKey = new Tuple<Type, string>(typeof(T), key);
-
-            if (_settings.TryGetValue(dictionaryKey, out var value))
-            {
-                return (T)value;
-            }
-
-            throw new KeyNotFoundException();
-        }
-    }
-}

+ 0 - 122
src/YSAI.Unility/objectsComparer/CustomComparers/AbstractDynamicObjectsComprer.cs

@@ -1,122 +0,0 @@
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal abstract class AbstractDynamicObjectsComprer<T> : AbstractComparer, IComparerWithCondition
-    {
-        protected AbstractDynamicObjectsComprer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory) : base(settings, parentComparer, factory)
-        {
-        }
-
-        public override IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2)
-        {
-            var castedObject1 = (T)obj1;
-            var castedObject2 = (T)obj2;
-            var propertyKeys1 = GetProperties(castedObject1);
-            var propertyKeys2 = GetProperties(castedObject2);
-
-            var propertyKeys = propertyKeys1.Union(propertyKeys2);
-
-            foreach (var propertyKey in propertyKeys)
-            {
-                var existsInObject1 = propertyKeys1.Contains(propertyKey);
-                var existsInObject2 = propertyKeys2.Contains(propertyKey);
-                object value1 = null;
-                if (existsInObject1)
-                {
-                    TryGetMemberValue(castedObject1, propertyKey, out value1);
-                }
-
-                object value2 = null;
-                if (existsInObject2)
-                {
-                    TryGetMemberValue(castedObject2, propertyKey, out value2);
-                }
-
-                var propertyType = (value1 ?? value2)?.GetType() ?? typeof(object);
-                var customComparer = OverridesCollection.GetComparer(propertyType) ??
-                                     OverridesCollection.GetComparer(propertyKey);
-                var valueComparer = customComparer ?? DefaultValueComparer;
-
-                if (Settings.UseDefaultIfMemberNotExist)
-                {
-                    if (!existsInObject1)
-                    {
-                        value1 = propertyType.GetDefaultValue();
-                    }
-
-                    if (!existsInObject2)
-                    {
-                        value2 = propertyType.GetDefaultValue();
-                    }
-                }
-
-                if (!Settings.UseDefaultIfMemberNotExist)
-                {
-                    if (!existsInObject1)
-                    {
-                        yield return new Difference(propertyKey, string.Empty, valueComparer.ToString(value2),
-                            DifferenceTypes.MissedMemberInFirstObject);
-                        continue;
-                    }
-
-                    if (!existsInObject2)
-                    {
-                        yield return new Difference(propertyKey, valueComparer.ToString(value1), string.Empty,
-                            DifferenceTypes.MissedMemberInSecondObject);
-                        continue;
-                    }
-                }
-
-                if (value1 != null && value2 != null && value1.GetType() != value2.GetType())
-                {
-                    var valueComparer2 = OverridesCollection.GetComparer(value2.GetType()) ??
-                        OverridesCollection.GetComparer(propertyKey) ??
-                        DefaultValueComparer;
-                    yield return new Difference(propertyKey, valueComparer.ToString(value1), valueComparer2.ToString(value2),
-                        DifferenceTypes.TypeMismatch);
-                    continue;
-                }
-
-                //null cannot be casted to ValueType
-                if (value1 == null && value2 != null && value2.GetType().GetTypeInfo().IsValueType ||
-                    value2 == null && value1 != null && value1.GetType().GetTypeInfo().IsValueType)
-                {
-                    var valueComparer2 = value2 != null ?
-                        OverridesCollection.GetComparer(value2.GetType()) ?? OverridesCollection.GetComparer(propertyKey) ?? DefaultValueComparer :
-                        DefaultValueComparer;
-                    yield return new Difference(propertyKey, valueComparer.ToString(value1), valueComparer2.ToString(value2),
-                        DifferenceTypes.TypeMismatch);
-                    continue;
-                }
-
-                if (customComparer != null)
-                {
-                    if (!customComparer.Compare(value1, value2, Settings))
-                    {
-                        yield return new Difference(propertyKey, customComparer.ToString(value1), customComparer.ToString(value2));
-                    }
-
-                    continue;
-                }
-
-                var comparer = Factory.GetObjectsComparer(propertyType, Settings, this);
-                foreach (var failure in comparer.CalculateDifferences(propertyType, value1, value2))
-                {
-                    yield return failure.InsertPath(propertyKey);
-                }
-            }
-        }
-
-        public abstract bool IsMatch(Type type, object obj1, object obj2);
-
-        public abstract bool IsStopComparison(Type type, object obj1, object obj2);
-
-        public abstract bool SkipMember(Type type, MemberInfo member);
-
-        protected abstract IList<string> GetProperties(T obj);
-
-        protected abstract bool TryGetMemberValue(T obj, string propertyName, out object value);
-    }
-}

+ 0 - 44
src/YSAI.Unility/objectsComparer/CustomComparers/AbstractEnumerablesComparer.cs

@@ -1,44 +0,0 @@
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal abstract class AbstractEnumerablesComparer : AbstractComparer, IComparerWithCondition
-    {
-        protected AbstractEnumerablesComparer(ComparisonSettings settings, BaseComparer parentComparer,
-            IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        public bool IsStopComparison(Type type, object obj1, object obj2)
-        {
-            return Settings.EmptyAndNullEnumerablesEqual && (obj1 == null || obj2 == null);
-        }
-
-        public virtual bool SkipMember(Type type, MemberInfo member)
-        {
-            if (type.InheritsFrom(typeof(Array)))
-            {
-                if (member.Name == "LongLength")
-                {
-                    return true;
-                }
-            }
-
-            if (type.InheritsFrom(typeof(List<>)))
-            {
-                if (member.Name == PropertyHelper.GetMemberInfo(() => new List<string>().Capacity).Name)
-                {
-                    return true;
-                }
-            }
-
-            return false;
-        }
-
-        public abstract override IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2);
-
-        public abstract bool IsMatch(Type type, object obj1, object obj2);
-    }
-}

+ 0 - 58
src/YSAI.Unility/objectsComparer/CustomComparers/CompilerGeneratedObjectComparer.cs

@@ -1,58 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class CompilerGeneratedObjectComparer : AbstractDynamicObjectsComprer<object>
-    {
-        public CompilerGeneratedObjectComparer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        public override bool IsMatch(Type type, object obj1, object obj2)
-        {
-            return (obj1 != null || obj2 != null) &&
-                   (obj1 == null || obj1.GetType().GetTypeInfo().GetCustomAttribute(typeof(CompilerGeneratedAttribute)) != null) &&
-                   (obj2 == null || obj2.GetType().GetTypeInfo().GetCustomAttribute(typeof(CompilerGeneratedAttribute)) != null);
-        }
-
-        public override bool IsStopComparison(Type type, object obj1, object obj2)
-        {
-            return true;
-        }
-
-        public override bool SkipMember(Type type, MemberInfo member)
-        {
-            return false;
-        }
-
-        protected override IList<string> GetProperties(object obj)
-        {
-            return obj?.GetType().GetTypeInfo().GetMembers()
-                .Where(memberInfo => memberInfo is PropertyInfo)
-                .Select(memberInfo => memberInfo.Name)
-                .Distinct()
-                .ToList() ?? new List<string>();
-        }
-
-        protected override bool TryGetMemberValue(object obj, string propertyName, out object value)
-        {
-            value = null;
-            if (obj == null)
-            {
-                return false;
-            }
-
-            var propertyInfo = obj.GetType().GetTypeInfo().GetProperty(propertyName);
-            if (propertyInfo == null)
-            {
-                return false;
-            }
-
-            value = propertyInfo.GetValue(obj);
-
-            return true;
-        }
-    }
-}

+ 0 - 60
src/YSAI.Unility/objectsComparer/CustomComparers/DynamicObjectComparer.cs

@@ -1,60 +0,0 @@
-using System.Dynamic;
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class DynamicObjectComparer : AbstractDynamicObjectsComprer<DynamicObject>
-    {
-        private class FakeGetMemberBinder : GetMemberBinder
-        {
-            public FakeGetMemberBinder(string name, bool ignoreCase) : base(name, ignoreCase)
-            {
-            }
-
-            public override DynamicMetaObject FallbackGetMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion)
-            {
-                throw new NotSupportedException();
-            }
-        }
-
-        public DynamicObjectComparer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        public override bool IsMatch(Type type, object obj1, object obj2)
-        {
-            return type.InheritsFrom(typeof(DynamicObject)) ||
-                   (obj1 != null && obj2 != null && type == typeof(object) && obj1.GetType().InheritsFrom(typeof(DynamicObject)) && obj2.GetType().InheritsFrom(typeof(DynamicObject)));
-        }
-
-        public override bool IsStopComparison(Type type, object obj1, object obj2)
-        {
-            return obj1 == null || obj2 == null;
-        }
-
-        public override bool SkipMember(Type type, MemberInfo member)
-        {
-            return false;
-        }
-
-        protected override IList<string> GetProperties(DynamicObject obj)
-        {
-            return obj?.GetDynamicMemberNames().ToList() ?? new List<string>();
-        }
-
-        protected override bool TryGetMemberValue(DynamicObject obj, string propertyName, out object value)
-        {
-            if (obj == null)
-            {
-                value = null;
-                return false;
-            }
-
-            var getBinder = new FakeGetMemberBinder(propertyName, false);
-
-            return obj.TryGetMember(getBinder, out value);
-        }
-    }
-}

+ 0 - 103
src/YSAI.Unility/objectsComparer/CustomComparers/EnumerablesComparer.cs

@@ -1,103 +0,0 @@
-using System.Collections;
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class EnumerablesComparer : AbstractComparer, IComparerWithCondition
-    {
-        public EnumerablesComparer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        public override IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2)
-        {
-            if (!Settings.EmptyAndNullEnumerablesEqual &&
-                (obj1 == null || obj2 == null) && obj1 != obj2)
-            {
-                yield return new Difference("[]", obj1?.ToString() ?? string.Empty, obj2?.ToString() ?? string.Empty);
-                yield break;
-            }
-
-            obj1 = obj1 ?? Enumerable.Empty<object>();
-            obj2 = obj2 ?? Enumerable.Empty<object>();
-
-            if (!type.InheritsFrom(typeof(IEnumerable)))
-            {
-                throw new ArgumentException(nameof(type));
-            }
-
-            if (!obj1.GetType().InheritsFrom(typeof(IEnumerable)))
-            {
-                throw new ArgumentException(nameof(obj1));
-            }
-
-            if (!obj2.GetType().InheritsFrom(typeof(IEnumerable)))
-            {
-                throw new ArgumentException(nameof(obj2));
-            }
-
-            var array1 = ((IEnumerable)obj1).Cast<object>().ToArray();
-            var array2 = ((IEnumerable)obj2).Cast<object>().ToArray();
-
-            if (array1.Length != array2.Length)
-            {
-                yield return new Difference("", array1.Length.ToString(), array2.Length.ToString(),
-                    DifferenceTypes.NumberOfElementsMismatch);
-                yield break;
-            }
-
-            //ToDo Extract type
-            for (var i = 0; i < array2.Length; i++)
-            {
-                if (array1[i] == null && array2[i] == null)
-                {
-                    continue;
-                }
-
-                var valueComparer1 = array1[i] != null ? OverridesCollection.GetComparer(array1[i].GetType()) ?? DefaultValueComparer : DefaultValueComparer;
-                var valueComparer2 = array2[i] != null ? OverridesCollection.GetComparer(array2[i].GetType()) ?? DefaultValueComparer : DefaultValueComparer;
-
-                if (array1[i] == null)
-                {
-                    yield return new Difference($"[{i}]", string.Empty, valueComparer2.ToString(array2[i]));
-                    continue;
-                }
-
-                if (array2[i] == null)
-                {
-                    yield return new Difference($"[{i}]", valueComparer1.ToString(array1[i]), string.Empty);
-                    continue;
-                }
-
-                if (array1[i].GetType() != array2[i].GetType())
-                {
-                    yield return new Difference($"[{i}]", valueComparer1.ToString(array1[i]), valueComparer2.ToString(array2[i]), DifferenceTypes.TypeMismatch);
-                    continue;
-                }
-
-                var comparer = Factory.GetObjectsComparer(array1[i].GetType(), Settings, this);
-                foreach (var failure in comparer.CalculateDifferences(array1[i].GetType(), array1[i], array2[i]))
-                {
-                    yield return failure.InsertPath($"[{i}]");
-                }
-            }
-        }
-
-        public bool IsMatch(Type type, object obj1, object obj2)
-        {
-            return type.InheritsFrom(typeof(IEnumerable)) && !type.InheritsFrom(typeof(IEnumerable<>));
-        }
-
-        public bool IsStopComparison(Type type, object obj1, object obj2)
-        {
-            return Settings.EmptyAndNullEnumerablesEqual && obj1 == null || obj2 == null;
-        }
-
-        public bool SkipMember(Type type, MemberInfo member)
-        {
-            return false;
-        }
-    }
-}

+ 0 - 65
src/YSAI.Unility/objectsComparer/CustomComparers/EnumerablesComparer~1.cs

@@ -1,65 +0,0 @@
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class EnumerablesComparer<T> : AbstractComparer
-    {
-        private readonly IComparer<T> _comparer;
-
-        public EnumerablesComparer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-            _comparer = Factory.GetObjectsComparer<T>(Settings, this);
-        }
-
-        public override IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2)
-        {
-            if (!type.InheritsFrom(typeof(IEnumerable<>)))
-            {
-                throw new ArgumentException("Invalid type");
-            }
-
-            if (!Settings.EmptyAndNullEnumerablesEqual &&
-                (obj1 == null || obj2 == null) && obj1 != obj2)
-            {
-                yield break;
-            }
-
-            obj1 = obj1 ?? Enumerable.Empty<T>();
-            obj2 = obj2 ?? Enumerable.Empty<T>();
-
-            if (!obj1.GetType().InheritsFrom(typeof(IEnumerable<T>)))
-            {
-                throw new ArgumentException(nameof(obj1));
-            }
-
-            if (!obj2.GetType().InheritsFrom(typeof(IEnumerable<T>)))
-            {
-                throw new ArgumentException(nameof(obj2));
-            }
-
-            var list1 = ((IEnumerable<T>)obj1).ToList();
-            var list2 = ((IEnumerable<T>)obj2).ToList();
-
-            if (list1.Count != list2.Count)
-            {
-                if (!type.GetTypeInfo().IsArray)
-                {
-                    yield return new Difference("", list1.Count.ToString(), list2.Count.ToString(),
-                        DifferenceTypes.NumberOfElementsMismatch);
-                }
-
-                yield break;
-            }
-
-            for (var i = 0; i < list2.Count; i++)
-            {
-                foreach (var failure in _comparer.CalculateDifferences(list1[i], list2[i]))
-                {
-                    yield return failure.InsertPath($"[{i}]");
-                }
-            }
-        }
-    }
-}

+ 0 - 44
src/YSAI.Unility/objectsComparer/CustomComparers/ExpandoObjectComparer.cs

@@ -1,44 +0,0 @@
-using System.Dynamic;
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class ExpandoObjectComparer : AbstractDynamicObjectsComprer<ExpandoObject>
-    {
-        public ExpandoObjectComparer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        public override bool IsMatch(Type type, object obj1, object obj2)
-        {
-            return type.InheritsFrom(typeof(ExpandoObject)) ||
-                   (obj1 != null && obj2 != null && type == typeof(object) && obj1.GetType().InheritsFrom(typeof(ExpandoObject)) && obj2.GetType().InheritsFrom(typeof(ExpandoObject)));
-        }
-
-        public override bool IsStopComparison(Type type, object obj1, object obj2)
-        {
-            return obj1 == null || obj2 == null;
-        }
-
-        public override bool SkipMember(Type type, MemberInfo member) => false;
-
-        protected override IList<string> GetProperties(ExpandoObject obj)
-        {
-            return ((IDictionary<string, object>)obj)?.Keys.ToList() ?? new List<string>();
-        }
-
-        protected override bool TryGetMemberValue(ExpandoObject obj, string propertyName, out object value)
-        {
-            if (obj != null)
-            {
-                return ((IDictionary<string, object>)obj).TryGetValue(propertyName, out value);
-            }
-
-            value = null;
-
-            return false;
-        }
-    }
-}

+ 0 - 77
src/YSAI.Unility/objectsComparer/CustomComparers/GenericEnumerablesComparer.cs

@@ -1,77 +0,0 @@
-using System.Collections.ObjectModel;
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class GenericEnumerablesComparer : AbstractEnumerablesComparer
-    {
-        public GenericEnumerablesComparer(ComparisonSettings settings, BaseComparer parentComparer,
-            IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        public override IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2)
-        {
-            if (obj1 == null && obj2 == null)
-            {
-                yield break;
-            }
-
-            var typeInfo = (obj1 ?? obj2).GetType().GetTypeInfo();
-
-            Type elementType;
-
-            if (typeInfo.IsGenericType && typeInfo.GetGenericTypeDefinition() == typeof(IEnumerable<>))
-            {
-                elementType = typeInfo.GetElementType();
-            }
-            else
-            {
-                elementType = typeInfo.GetInterfaces()
-                    .Where(
-                        i =>
-                            i.GetTypeInfo().IsGenericType &&
-                            i.GetTypeInfo().GetGenericTypeDefinition() == typeof(IEnumerable<>))
-                    .Select(i => i.GetTypeInfo().GetGenericArguments()[0])
-                    .First();
-            }
-
-            var enumerablesComparerType = typeof(EnumerablesComparer<>).MakeGenericType(elementType);
-            var comparer = (IComparer)Activator.CreateInstance(enumerablesComparerType, Settings, this, Factory);
-
-            foreach (var difference in comparer.CalculateDifferences(type, obj1, obj2))
-            {
-                yield return difference;
-            }
-        }
-
-        public override bool IsMatch(Type type, object obj1, object obj2)
-        {
-            return type.InheritsFrom(typeof(IEnumerable<>));
-        }
-
-        public override bool SkipMember(Type type, MemberInfo member)
-        {
-            if (base.SkipMember(type, member))
-            {
-                return true;
-            }
-
-            if (type.InheritsFrom(typeof(ICollection<>)) &&
-                member.Name == PropertyHelper.GetMemberInfo(() => new Collection<string>().Count).Name)
-            {
-                return true;
-            }
-
-            if (!type.InheritsFrom(typeof(IDictionary<,>)))
-            {
-                return false;
-            }
-
-            return member.Name == PropertyHelper.GetMemberInfo(() => new Dictionary<object, object>().Values).Name ||
-                   member.Name == PropertyHelper.GetMemberInfo(() => new Dictionary<object, object>().Keys).Name;
-        }
-    }
-}

+ 0 - 51
src/YSAI.Unility/objectsComparer/CustomComparers/HashSetsComparer.cs

@@ -1,51 +0,0 @@
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class HashSetsComparer : AbstractEnumerablesComparer
-    {
-        public HashSetsComparer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        public override IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2)
-        {
-            if (obj1 == null && obj2 == null)
-            {
-                yield break;
-            }
-
-            var typeInfo = (obj1 ?? obj2).GetType().GetTypeInfo();
-
-            Type elementType = typeInfo.GetInterfaces()
-                    .Where(
-                        i =>
-                            i.GetTypeInfo().IsGenericType &&
-                            i.GetTypeInfo().GetGenericTypeDefinition() == typeof(ISet<>))
-                    .Select(i => i.GetTypeInfo().GetGenericArguments()[0])
-                    .First();
-
-            var enumerablesComparerType = typeof(HashSetsComparer<>).MakeGenericType(elementType);
-            var comparer = (IComparer)Activator.CreateInstance(enumerablesComparerType, Settings, this, Factory);
-
-            foreach (var difference in comparer.CalculateDifferences(type, obj1, obj2))
-            {
-                yield return difference;
-            }
-        }
-
-        public override bool IsMatch(Type type, object obj1, object obj2)
-        {
-            return type.InheritsFrom(typeof(HashSet<>));
-        }
-
-        public override bool SkipMember(Type type, MemberInfo member)
-        {
-            return base.SkipMember(type, member) ||
-                   member.Name == PropertyHelper.GetMemberInfo(() => new HashSet<string>().Comparer).Name ||
-                   member.Name == PropertyHelper.GetMemberInfo(() => new HashSet<string>().Count).Name;
-        }
-    }
-}

+ 0 - 66
src/YSAI.Unility/objectsComparer/CustomComparers/HashSetsComparer~1.cs

@@ -1,66 +0,0 @@
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class HashSetsComparer<T> : AbstractComparer
-    {
-        public HashSetsComparer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        public override IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2)
-        {
-            if (!type.InheritsFrom(typeof(HashSet<>)))
-            {
-                throw new ArgumentException("Invalid type");
-            }
-
-            if (!Settings.EmptyAndNullEnumerablesEqual &&
-                (obj1 == null || obj2 == null) && obj1 != obj2)
-            {
-                yield break;
-            }
-
-            obj1 = obj1 ?? new HashSet<T>();
-            obj2 = obj2 ?? new HashSet<T>();
-
-            if (!obj1.GetType().InheritsFrom(typeof(HashSet<T>)))
-            {
-                throw new ArgumentException(nameof(obj1));
-            }
-
-            if (!obj2.GetType().InheritsFrom(typeof(HashSet<T>)))
-            {
-                throw new ArgumentException(nameof(obj2));
-            }
-
-            var hashSet1 = ((IEnumerable<T>)obj1).ToList();
-            var hashSet2 = ((IEnumerable<T>)obj2).ToList();
-            var valueComparer = OverridesCollection.GetComparer(typeof(T)) ?? DefaultValueComparer;
-
-            foreach (var element in hashSet1)
-            {
-                if (!hashSet2.Contains(element))
-                {
-                    yield return new Difference("", valueComparer.ToString(element), string.Empty,
-                        DifferenceTypes.MissedElementInSecondObject);
-                }
-            }
-
-            foreach (var element in hashSet2)
-            {
-                if (!hashSet1.Contains(element))
-                {
-                    yield return new Difference("", string.Empty, valueComparer.ToString(element),
-                        DifferenceTypes.MissedElementInFirstObject);
-                }
-            }
-        }
-
-        public bool IsMatch(Type type, object obj1, object obj2)
-        {
-            return type.InheritsFrom(typeof(HashSet<>));
-        }
-    }
-}

+ 0 - 13
src/YSAI.Unility/objectsComparer/CustomComparers/IComparerWithCondition.cs

@@ -1,13 +0,0 @@
-using System.Reflection;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal interface IComparerWithCondition : IComparer
-    {
-        bool IsMatch(Type type, object obj1, object obj2);
-
-        bool IsStopComparison(Type type, object obj1, object obj2);
-
-        bool SkipMember(Type type, MemberInfo member);
-    }
-}

+ 0 - 86
src/YSAI.Unility/objectsComparer/CustomComparers/MultidimensionalArrayComparer~1.cs

@@ -1,86 +0,0 @@
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class MultidimensionalArrayComparer<T> : AbstractComparer
-    {
-        private readonly IComparer<T> _comparer;
-
-        public MultidimensionalArrayComparer(ComparisonSettings settings, BaseComparer parentComparer, IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-            _comparer = Factory.GetObjectsComparer<T>(Settings, this);
-        }
-
-        public override IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2)
-        {
-            if (!type.InheritsFrom(typeof(Array)))
-            {
-                throw new ArgumentException("Invalid type");
-            }
-
-            if (!Settings.EmptyAndNullEnumerablesEqual &&
-                (obj1 == null || obj2 == null) && obj1 != obj2)
-            {
-                yield break;
-            }
-
-            if (obj1 != null && !obj1.GetType().InheritsFrom(typeof(Array)))
-            {
-                throw new ArgumentException(nameof(obj1));
-            }
-
-            if (obj2 != null && !obj2.GetType().InheritsFrom(typeof(Array)))
-            {
-                throw new ArgumentException(nameof(obj2));
-            }
-
-            var array1 = (Array)obj1 ?? Array.CreateInstance(typeof(T), new int[type.GetArrayRank()]);
-            var array2 = (Array)obj2 ?? Array.CreateInstance(typeof(T), new int[type.GetArrayRank()]);
-
-            if (array1.Rank != array2.Rank)
-            {
-                yield return new Difference("Rank", array1.Rank.ToString(), array2.Rank.ToString());
-                yield break;
-            }
-
-            var dimensionsFailure = false;
-            for (var i = 0; i < array1.Rank; i++)
-            {
-                var length1 = array1.GetLength(i);
-                var length2 = array2.GetLength(i);
-
-                // ReSharper disable once InvertIf
-                if (length1 != length2)
-                {
-                    dimensionsFailure = true;
-                    yield return new Difference($"Dimension{i}", length1.ToString(), length2.ToString());
-                }
-            }
-
-            if (dimensionsFailure)
-            {
-                yield break;
-            }
-
-            for (var i = 0; i < array1.Length; i++)
-            {
-                var indecies = IndexToCoordinates(array1, i);
-
-                foreach (var failure in _comparer.CalculateDifferences((T)array1.GetValue(indecies), (T)array2.GetValue(indecies)))
-                {
-                    yield return failure.InsertPath($"[{string.Join(",", indecies)}]");
-                }
-            }
-        }
-
-        private static int[] IndexToCoordinates(Array arr, int i)
-        {
-            var dims = Enumerable.Range(0, arr.Rank)
-                .Select(arr.GetLength)
-                .ToArray();
-
-            return dims.Select((d, n) => i / dims.Take(n).Aggregate(1, (i1, i2) => i1 * i2) % d).ToArray();
-        }
-    }
-}

+ 0 - 52
src/YSAI.Unility/objectsComparer/CustomComparers/MultidimensionalArraysComparer.cs

@@ -1,52 +0,0 @@
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class MultidimensionalArraysComparer : AbstractEnumerablesComparer
-    {
-        public MultidimensionalArraysComparer(ComparisonSettings settings, BaseComparer parentComparer,
-            IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        public override IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2)
-        {
-            if (obj1 == null && obj2 == null)
-            {
-                yield break;
-            }
-
-            var typeInfo = (obj1 ?? obj2).GetType().GetTypeInfo();
-            var enumerablesComparerType = typeof(MultidimensionalArrayComparer<>).MakeGenericType(typeInfo.GetElementType());
-            var comparer = (IComparer)Activator.CreateInstance(enumerablesComparerType, Settings, this, Factory);
-
-            foreach (var difference in comparer.CalculateDifferences(type, obj1, obj2))
-            {
-                yield return difference;
-            }
-        }
-
-        public override bool IsMatch(Type type, object obj1, object obj2)
-        {
-            return type.GetTypeInfo().IsArray && type.GetTypeInfo().GetArrayRank() > 1;
-        }
-
-        public override bool SkipMember(Type type, MemberInfo member)
-        {
-            if (base.SkipMember(type, member))
-            {
-                return true;
-            }
-
-            if (!type.IsArray)
-            {
-                return false;
-            }
-
-            Array array = new int[0];
-            return member.Name == PropertyHelper.GetMemberInfo(() => array.Length).Name;
-        }
-    }
-}

+ 0 - 49
src/YSAI.Unility/objectsComparer/CustomComparers/TypesComparer.cs

@@ -1,49 +0,0 @@
-using System.Reflection;
-using YSAI.Unility.objectsComparer.Utils;
-
-namespace YSAI.Unility.objectsComparer
-{
-    internal class TypesComparer : AbstractComparer, IComparerWithCondition
-    {
-        public TypesComparer(ComparisonSettings settings, BaseComparer parentComparer,
-            IComparersFactory factory)
-            : base(settings, parentComparer, factory)
-        {
-        }
-
-        public override IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2)
-        {
-            if (obj1 == null && obj2 == null)
-            {
-                yield break;
-            }
-
-            if (obj1?.GetType().InheritsFrom(typeof(Type)) == false)
-            {
-                throw new ArgumentException(nameof(obj1));
-            }
-
-            if (obj2?.GetType().InheritsFrom(typeof(Type)) == false)
-            {
-                throw new ArgumentException(nameof(obj2));
-            }
-
-            var type1Str = obj1?.ToString();
-            var type2Str = obj2?.ToString();
-
-            if (type1Str != type2Str)
-            {
-                yield return new Difference(string.Empty, type1Str, type2Str);
-            }
-        }
-
-        public bool IsMatch(Type type, object obj1, object obj2)
-        {
-            return type.InheritsFrom(typeof(Type));
-        }
-
-        public bool IsStopComparison(Type type, object obj1, object obj2) => true;
-
-        public bool SkipMember(Type type, MemberInfo member) => true;
-    }
-}

+ 0 - 69
src/YSAI.Unility/objectsComparer/Difference.cs

@@ -1,69 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Represents difference in one member between objects.
-    /// </summary>
-    public class Difference
-    {
-        /// <summary>
-        /// Path to the member.
-        /// </summary>
-        public string MemberPath { get; }
-
-        /// <summary>
-        /// Value in the first object, converted to string.
-        /// </summary>
-        public string Value1 { get; }
-
-        /// <summary>
-        /// Value in the second object, converted to string.
-        /// </summary>
-        public string Value2 { get; }
-
-        /// <summary>
-        /// Type of the difference.
-        /// </summary>
-        public DifferenceTypes DifferenceType { get; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="Difference" /> class.
-        /// </summary>
-        /// <param name="memberPath">Member Path.</param>
-        /// <param name="value1">Value of the first object, converted to string.</param>
-        /// <param name="value2">Value of the second object, converted to string.</param>
-        /// <param name="differenceType">Type of the difference.</param>
-        public Difference(string memberPath, string value1, string value2,
-            DifferenceTypes differenceType = DifferenceTypes.ValueMismatch)
-        {
-            MemberPath = memberPath;
-            Value1 = value1;
-            Value2 = value2;
-            DifferenceType = differenceType;
-        }
-
-        /// <summary>
-        /// Combines difference with path of the root element.
-        /// </summary>
-        /// <param name="path">Root element path.</param>
-        /// <returns>Difference with combined <see cref="MemberPath"/>.</returns>
-        public Difference InsertPath(string path)
-        {
-            var newPath = string.IsNullOrWhiteSpace(MemberPath) || MemberPath.StartsWith("[")
-                ? path + MemberPath
-                : path + "." + MemberPath;
-
-            return new Difference(
-                newPath,
-                Value1,
-                Value2,
-                DifferenceType);
-        }
-
-        /// <summary>Returns a string that represents the current object.</summary>
-        /// <returns>A string that represents the current object.</returns>
-        public override string ToString()
-        {
-            return $"Difference: DifferenceType={DifferenceType}, MemberPath='{MemberPath}', Value1='{Value1}', Value2='{Value2}'.";
-        }
-    }
-}

+ 0 - 45
src/YSAI.Unility/objectsComparer/DifferenceTypes.cs

@@ -1,45 +0,0 @@
-using System.Collections;
-
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Specifies types of the differences between object members.
-    /// </summary>
-    public enum DifferenceTypes
-    {
-        /// <summary>
-        /// Value of the member in first and second objects are not equal.
-        /// </summary>
-        ValueMismatch,
-
-        /// <summary>
-        /// Type of the member in first and second objects  are not equal.
-        /// </summary>
-        TypeMismatch,
-
-        /// <summary>
-        /// Member does not exist in the first object.
-        /// </summary>
-        MissedMemberInFirstObject,
-
-        /// <summary>
-        /// Member does not exist in the second object.
-        /// </summary>
-        MissedMemberInSecondObject,
-
-        /// <summary>
-        /// First object does not contain element.
-        /// </summary>
-        MissedElementInFirstObject,
-
-        /// <summary>
-        /// Second object does not contain element.
-        /// </summary>
-        MissedElementInSecondObject,
-
-        /// <summary>
-        /// <see cref="IEnumerable"/>s have different number of elements.
-        /// </summary>
-        NumberOfElementsMismatch
-    }
-}

+ 0 - 44
src/YSAI.Unility/objectsComparer/Exceptions/AmbiguousComparerOverrideResolutionException.cs

@@ -1,44 +0,0 @@
-using System.Reflection;
-
-namespace YSAI.Unility.objectsComparer.Exceptions
-{
-    /// <summary>
-    /// Represents errors that occur when Objects Comparer has more than one comparer override which could be used to compare member.
-    /// </summary>
-    public class AmbiguousComparerOverrideResolutionException : Exception
-    {
-        /// <summary>
-        /// Name of the Member that was a cause of exception
-        /// </summary>
-        public string MemberName { get; }
-
-        /// <summary>
-        /// MemberInfo of the Member that was a cause of exception
-        /// </summary>
-        public MemberInfo MemberInfo { get; }
-
-        /// <summary>
-        /// Type that was a cause of exception
-        /// </summary>
-        public Type Type { get; }
-
-        internal AmbiguousComparerOverrideResolutionException(MemberInfo memberInfo)
-            : base($"Unable to resolve comparer for member {memberInfo.MemberType}. More than one value comparer meet criteria for this member.")
-        {
-            MemberInfo = memberInfo;
-            MemberName = memberInfo.Name;
-        }
-
-        internal AmbiguousComparerOverrideResolutionException(string memberName)
-            : base($"Unable to resolve comparer for member {memberName}. More than one value comparer meet criteria for this member.")
-        {
-            MemberName = memberName;
-        }
-
-        internal AmbiguousComparerOverrideResolutionException(Type type)
-            : base($"Unable to resolve comparer for type {type.GetTypeInfo().FullName}. More than one value comparer meet criteria for this type.")
-        {
-            Type = type;
-        }
-    }
-}

+ 0 - 21
src/YSAI.Unility/objectsComparer/Exceptions/ValueComparerExistsException.cs

@@ -1,21 +0,0 @@
-using System.Reflection;
-
-namespace YSAI.Unility.objectsComparer.Exceptions
-{
-    /// <summary>
-    /// Represents errors that occur when comparer for Member has already been added.
-    /// </summary>
-    public class ValueComparerExistsException : Exception
-    {
-        /// <summary>
-        /// MemberInfo of the Member that was a cause of exception
-        /// </summary>
-        public MemberInfo MemberInfo { get; }
-
-        internal ValueComparerExistsException(MemberInfo memberInfo)
-            : base($"Comparer override for member {memberInfo.MemberType} has already been added.")
-        {
-            MemberInfo = memberInfo;
-        }
-    }
-}

+ 0 - 88
src/YSAI.Unility/objectsComparer/IBaseComparer.cs

@@ -1,88 +0,0 @@
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Defines properties and methods to configure comparer.
-    /// </summary>
-    public interface IBaseComparer
-    {
-        /// <summary>
-        /// Default <see cref="IValueComparer"/>
-        /// </summary>
-        IValueComparer DefaultValueComparer { get; }
-
-        /// <summary>
-        /// Comparison Settings.
-        /// </summary>
-        ComparisonSettings Settings { get; }
-
-        /// <summary>
-        /// Sets <see cref="DefaultValueComparer"/>.
-        /// </summary>
-        /// <param name="valueComparer">Value Comparer.</param>
-        void SetDefaultComparer(IValueComparer valueComparer);
-
-        /// <summary>
-        /// Adds Comparer Override by Member.
-        /// </summary>
-        /// <typeparam name="TProp">Type of the member.</typeparam>
-        /// <param name="memberLambda">Lambda to get member.</param>
-        /// <param name="valueComparer">Value Comparer.</param>
-        void AddComparerOverride<TProp>(Expression<Func<TProp>> memberLambda, IValueComparer valueComparer);
-
-        /// <summary>
-        /// Adds Comparer Override by Member.
-        /// </summary>
-        /// <param name="memberInfo">Member Info.</param>
-        /// <param name="valueComparer">Value Comparer.</param>
-        void AddComparerOverride(MemberInfo memberInfo, IValueComparer valueComparer);
-
-        /// <summary>
-        /// Adds Comparer Override by Type.
-        /// </summary>
-        /// <param name="type">Type.</param>
-        /// <param name="valueComparer">Value Comparer.</param>
-        /// <param name="filter">Value Comparer will be used only if filter(memberInfo) == true. Null by default.</param>
-        void AddComparerOverride(Type type, IValueComparer valueComparer, Func<MemberInfo, bool> filter = null);
-
-        /// <summary>
-        /// Adds Comparer Override by Type.
-        /// </summary>
-        /// <typeparam name="TType">Type.</typeparam>
-        /// <param name="valueComparer">Value Comparer.</param>
-        /// <param name="filter">Value Comparer will be used only if filter(memberInfo) == true. Null by default.</param>
-        void AddComparerOverride<TType>(IValueComparer valueComparer, Func<MemberInfo, bool> filter = null);
-
-        /// <summary>
-        /// Adds Comparer Override by Member.
-        /// </summary>
-        /// <typeparam name="TProp">Type of the member.</typeparam>
-        /// <param name="memberLambda">Lambda to get member.</param>
-        /// <param name="compareFunction">Function to compare objects.</param>
-        /// <param name="toStringFunction">Function to convert objects to string.</param>
-        void AddComparerOverride<TProp>(
-            Expression<Func<TProp>> memberLambda,
-            Func<TProp, TProp, ComparisonSettings, bool> compareFunction,
-            Func<TProp, string> toStringFunction);
-
-        /// <summary>
-        /// Adds Comparer Override by Member.
-        /// </summary>
-        /// <typeparam name="TProp">Type of the member.</typeparam>
-        /// <param name="memberLambda">Lambda to get member.</param>
-        /// <param name="compareFunction">Function to compare objects.</param>
-        void AddComparerOverride<TProp>(
-            Expression<Func<TProp>> memberLambda,
-            Func<TProp, TProp, ComparisonSettings, bool> compareFunction);
-
-        /// <summary>
-        /// Adds Comparer Override by Member name.
-        /// </summary>
-        /// <param name="memberName">Member Name.</param>
-        /// <param name="valueComparer">Value Comparer.</param>
-        /// <param name="filter">Value Comparer will be used only if filter(memberInfo) == true. Null by default.</param>
-        void AddComparerOverride(string memberName, IValueComparer valueComparer, Func<MemberInfo, bool> filter = null);
-    }
-}

+ 0 - 64
src/YSAI.Unility/objectsComparer/IComparer.cs

@@ -1,64 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Defines methods to compare complex objects.
-    /// </summary>
-    public interface IComparer : IBaseComparer
-    {
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <param name="type">Type.</param>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="differences">List of differences.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        bool Compare(Type type, object obj1, object obj2, out IEnumerable<Difference> differences);
-
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <typeparam name="T">Type.</typeparam>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="differences">List of differences.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        bool Compare<T>(T obj1, T obj2, out IEnumerable<Difference> differences);
-
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <param name="type">Type.</param>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        bool Compare(Type type, object obj1, object obj2);
-
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <typeparam name="T">Type.</typeparam>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        bool Compare<T>(T obj1, T obj2);
-
-        /// <summary>
-        /// Calculates list of differences between objects.
-        /// </summary>
-        /// <param name="type">Type.</param>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>List of differences between objects.</returns>
-        IEnumerable<Difference> CalculateDifferences(Type type, object obj1, object obj2);
-
-        /// <summary>
-        /// Calculates list of differences between objects.
-        /// </summary>
-        /// <typeparam name="T">Type.</typeparam>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>List of differences between objects.</returns>
-        IEnumerable<Difference> CalculateDifferences<T>(T obj1, T obj2);
-    }
-}

+ 0 - 26
src/YSAI.Unility/objectsComparer/IComparersFactory.cs

@@ -1,26 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Defines methods to create type specific comparers.
-    /// </summary>
-    public interface IComparersFactory
-    {
-        /// <summary>
-        /// Creates type specific comparer.
-        /// </summary>
-        /// <typeparam name="T">Type.</typeparam>
-        /// <param name="settings">Comparison Settings. Null by default.</param>
-        /// <param name="parentComparer">Parent comparer. Null by default.</param>
-        /// <returns>Instance of <see cref="IComparer{T}"/>.</returns>
-        IComparer<T> GetObjectsComparer<T>(ComparisonSettings settings = null, BaseComparer parentComparer = null);
-
-        /// <summary>
-        /// Creates type specific comparer.
-        /// </summary>
-        /// <param name="type">Type.</param>
-        /// <param name="settings">Comparison Settings. Null by default.</param>
-        /// <param name="parentComparer">Parent comparer. Null by default.</param>
-        /// <returns>Instance of <see cref="IComparer"/>.</returns>
-        IComparer GetObjectsComparer(Type type, ComparisonSettings settings = null, BaseComparer parentComparer = null);
-    }
-}

+ 0 - 33
src/YSAI.Unility/objectsComparer/IComparer~1.cs

@@ -1,33 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Defines methods to compare complex objects of particular type.
-    /// </summary>
-    public interface IComparer<in T> : IBaseComparer
-    {
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="differences">List of differences.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        bool Compare(T obj1, T obj2, out IEnumerable<Difference> differences);
-
-        /// <summary>
-        /// Compares objects.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>True if objects are equal, otherwise false.</returns>
-        bool Compare(T obj1, T obj2);
-
-        /// <summary>
-        /// Calculates list of differences between objects.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <returns>List of differences between objects.</returns>
-        IEnumerable<Difference> CalculateDifferences(T obj1, T obj2);
-    }
-}

+ 0 - 54
src/YSAI.Unility/objectsComparer/Utils/MemberInfoExtensions.cs

@@ -1,54 +0,0 @@
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace YSAI.Unility.objectsComparer.Utils
-{
-    internal static class MemberInfoExtensions
-    {
-        public static Type GetMemberType(this MemberInfo memberInfo)
-        {
-            var propertyInfo = memberInfo as PropertyInfo;
-            if (propertyInfo != null)
-            {
-                return propertyInfo.PropertyType;
-            }
-
-            var fieldInfo = memberInfo as FieldInfo;
-            if (fieldInfo != null)
-            {
-                return fieldInfo.FieldType;
-            }
-
-            throw new Exception("Unsupported Type");
-        }
-
-        public static object GetMemberValue(this MemberInfo memberInfo, object obj)
-        {
-            var propertyInfo = memberInfo as PropertyInfo;
-            if (propertyInfo != null)
-            {
-                try
-                {
-                    return propertyInfo.GetValue(obj);
-                }
-                catch
-                {
-                    return $"Unable to get value of property {memberInfo.Name} of type {memberInfo.DeclaringType}";
-                }
-            }
-
-            var fieldInfo = memberInfo as FieldInfo;
-            if (fieldInfo != null)
-            {
-                return fieldInfo.GetValue(obj);
-            }
-
-            throw new Exception("Unsupported Type");
-        }
-
-        public static string GetMethodName<T>(Expression<Action<T>> expression)
-        {
-            return ((MethodCallExpression)expression.Body).Method.Name;
-        }
-    }
-}

+ 0 - 39
src/YSAI.Unility/objectsComparer/Utils/PropertyHelper.cs

@@ -1,39 +0,0 @@
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace YSAI.Unility.objectsComparer.Utils
-{
-    internal class PropertyHelper
-    {
-        public static MemberInfo GetMemberInfo<T>(Expression<Func<T>> memberLambda)
-        {
-            MemberExpression exp;
-
-            //this line is necessary, because sometimes the expression comes in as Convert(originalexpression)
-            switch (memberLambda.Body)
-            {
-                case UnaryExpression body:
-                    var unExp = body;
-                    if (unExp.Operand is MemberExpression operand)
-                    {
-                        exp = operand;
-                    }
-                    else
-                    {
-                        throw new ArgumentException();
-                    }
-
-                    break;
-
-                case MemberExpression _:
-                    exp = (MemberExpression)memberLambda.Body;
-                    break;
-
-                default:
-                    throw new ArgumentException();
-            }
-
-            return exp.Member;
-        }
-    }
-}

+ 0 - 51
src/YSAI.Unility/objectsComparer/Utils/TypeExtensions.cs

@@ -1,51 +0,0 @@
-using System.Reflection;
-
-namespace YSAI.Unility.objectsComparer.Utils
-{
-    internal static class TypeExtensions
-    {
-        public static bool InheritsFrom(this Type t1, Type t2)
-        {
-            if (null == t1 || null == t2)
-            {
-                return false;
-            }
-
-            if (t1 == t2)
-            {
-                return true;
-            }
-
-            if (t1.GetTypeInfo().IsGenericType && t1.GetTypeInfo().GetGenericTypeDefinition() == t2)
-            {
-                return true;
-            }
-
-            if (t1.GetTypeInfo().GetInterfaces().Any(i => i.GetTypeInfo().IsGenericType && i.GetGenericTypeDefinition() == t2 || i == t2))
-            {
-                return true;
-            }
-
-            return t1.GetTypeInfo().BaseType != null &&
-                   InheritsFrom(t1.GetTypeInfo().BaseType, t2);
-        }
-
-        public static bool IsComparable(this Type type)
-        {
-            return type.GetTypeInfo().IsPrimitive ||
-                   type.GetTypeInfo().IsEnum ||
-                   type.InheritsFrom(typeof(IComparable)) ||
-                   type.InheritsFrom(typeof(IComparable<>));
-        }
-
-        public static object GetDefaultValue(this Type t)
-        {
-            if (t.GetTypeInfo().IsValueType && Nullable.GetUnderlyingType(t) == null)
-            {
-                return Activator.CreateInstance(t);
-            }
-
-            return null;
-        }
-    }
-}

+ 0 - 15
src/YSAI.Unility/objectsComparer/ValueComparers/AbstractValueComparer.cs

@@ -1,15 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Implementation of <see cref="IValueComparer"/> which provides simplest implementation of <see cref="ToString(object)"/> method.
-    /// </summary>
-    public abstract class AbstractValueComparer : IValueComparer
-    {
-        public abstract bool Compare(object obj1, object obj2, ComparisonSettings settings);
-
-        public virtual string ToString(object value)
-        {
-            return value?.ToString();
-        }
-    }
-}

+ 0 - 41
src/YSAI.Unility/objectsComparer/ValueComparers/AbstractValueComparer~1.cs

@@ -1,41 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Implementation of <see cref="IValueComparer{T}"/> which provides simplest implementation of <see cref="ToString(T)"/> method and
-    /// <see cref="Compare(object, object, ComparisonSettings)"/> method to call <see cref="Compare(T, T, ComparisonSettings)"/>.
-    /// </summary>
-    /// <typeparam name="T">Type of the objects.</typeparam>
-    public abstract class AbstractValueComparer<T> : AbstractValueComparer, IValueComparer<T>
-    {
-        /// <summary>
-        /// Comparers <paramref name="obj1"/> and <paramref name="obj2"/>.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="settings">Instance of <see cref="ComparisonSettings"/> class.</param>
-        /// <returns>true if the objects are considered equal; otherwise, false.</returns>
-        public abstract bool Compare(T obj1, T obj2, ComparisonSettings settings);
-
-        /// <summary>
-        /// Converts values of comparing objects to <see cref="string"/>.
-        /// </summary>
-        /// <param name="value">Object to convert.</param>
-        /// <returns>A string that represents <see cref="value"/>.</returns>
-        public virtual string ToString(T value)
-        {
-            return base.ToString(value);
-        }
-
-        /// <summary>
-        /// Comparers <paramref name="obj1"/> and <paramref name="obj2"/>.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="settings">Instance of <see cref="ComparisonSettings"/> class.</param>
-        /// <returns>true if the objects are considered equal; otherwise, false.</returns>
-        public override bool Compare(object obj1, object obj2, ComparisonSettings settings)
-        {
-            return Compare((T)obj1, (T)obj2, settings);
-        }
-    }
-}

+ 0 - 63
src/YSAI.Unility/objectsComparer/ValueComparers/DefaultValueComparer.cs

@@ -1,63 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Default implementation of <see cref="IValueComparer"/>
-    /// </summary>
-    public class DefaultValueComparer : IValueComparer
-    {
-        private static volatile IValueComparer _instance;
-
-        /// <summary>
-        /// Static <see cref="DefaultValueComparer"/> instance.
-        /// </summary>
-        public static IValueComparer Instance
-        {
-            get
-            {
-                if (_instance != null)
-                {
-                    return _instance;
-                }
-
-                lock (SyncRoot)
-                {
-                    if (_instance == null)
-                    {
-                        _instance = new DefaultValueComparer();
-                    }
-                }
-
-                return _instance;
-            }
-        }
-
-        private static readonly object SyncRoot = new object();
-
-        /// <summary>
-        /// Comparers <paramref name="obj1"/> and <paramref name="obj2"/>.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="settings">Instance of <see cref="ComparisonSettings"/> class.</param>
-        /// <returns>true if the objects are considered equal; otherwise, false.</returns>
-        public bool Compare(object obj1, object obj2, ComparisonSettings settings)
-        {
-            if (obj1 == null || obj2 == null)
-            {
-                return obj1 == obj2;
-            }
-
-            return obj1.Equals(obj2);
-        }
-
-        /// <summary>
-        /// Converts values of comparing objects to <see cref="string"/>.
-        /// </summary>
-        /// <param name="value">Object to convert.</param>
-        /// <returns>A string that represents <see cref="value"/>.</returns>
-        public string ToString(object value)
-        {
-            return value?.ToString() ?? string.Empty;
-        }
-    }
-}

+ 0 - 50
src/YSAI.Unility/objectsComparer/ValueComparers/DefaultValueValueComparer.cs

@@ -1,50 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Allows to consider provided value and default value of type <see cref="T"/> as equal values.
-    /// </summary>
-    /// <typeparam name="T">Type of the objects.</typeparam>
-    public class DefaultValueValueComparer<T> : IValueComparer
-    {
-        private readonly T _defaultValue;
-        private readonly T _typeDefaultValue;
-        private readonly IValueComparer _valueComparer;
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="DefaultValueValueComparer{T}" /> class.
-        /// </summary>
-        /// <param name="defaultValue">Default value.</param>
-        /// <param name="valueComparer">Instance of <see cref="IValueComparer"/> which is used when values are not defaults.</param>
-        public DefaultValueValueComparer(T defaultValue, IValueComparer valueComparer)
-        {
-            _defaultValue = defaultValue;
-            _valueComparer = valueComparer;
-            _typeDefaultValue = default(T);
-        }
-
-        /// <summary>
-        /// Comparers <paramref name="obj1"/> and <paramref name="obj2"/>.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="settings">Instance of <see cref="ComparisonSettings"/> class.</param>
-        /// <returns>true if the objects are considered equal; otherwise, false.</returns>
-        public bool Compare(object obj1, object obj2, ComparisonSettings settings)
-        {
-            var isObj1Default = obj1?.Equals(_defaultValue) != false || obj1.Equals(_typeDefaultValue);
-            var isObj2Default = obj2?.Equals(_defaultValue) != false || obj2.Equals(_typeDefaultValue);
-
-            return isObj1Default && isObj2Default || _valueComparer.Compare(obj1, obj2, settings);
-        }
-
-        /// <summary>
-        /// Converts values of comparing objects to <see cref="string"/>.
-        /// </summary>
-        /// <param name="value">Object to convert.</param>
-        /// <returns>A string that represents <see cref="value"/>.</returns>
-        public string ToString(object value)
-        {
-            return value?.Equals(_typeDefaultValue) != false ? _valueComparer.ToString(_defaultValue) : _valueComparer.ToString(value);
-        }
-    }
-}

+ 0 - 61
src/YSAI.Unility/objectsComparer/ValueComparers/DoNotCompareValueComparer.cs

@@ -1,61 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Allows to ignore comparison. Considers all values as equal.
-    /// </summary>
-    public class DoNotCompareValueComparer : IValueComparer
-    {
-        private static volatile IValueComparer _instance;
-
-        /// <summary>
-        /// Static <see cref="DoNotCompareValueComparer"/> instance.
-        /// </summary>
-        public static IValueComparer Instance
-        {
-            get
-            {
-                if (_instance != null)
-                {
-                    return _instance;
-                }
-
-                lock (SyncRoot)
-                {
-                    if (_instance == null)
-                    {
-                        _instance = new DoNotCompareValueComparer();
-                    }
-                }
-
-                return _instance;
-            }
-        }
-
-        private static readonly object SyncRoot = new object();
-
-        private DoNotCompareValueComparer()
-        { }
-
-        /// <summary>
-        /// Comparers <paramref name="obj1"/> and <paramref name="obj2"/>.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="settings">Instance of <see cref="ComparisonSettings"/> class.</param>
-        /// <returns>true if the objects are considered equal; otherwise, false.</returns>
-        public bool Compare(object obj1, object obj2, ComparisonSettings settings)
-        {
-            return true;
-        }
-
-        /// <summary>
-        /// Converts values of comparing objects to <see cref="string"/>.
-        /// </summary>
-        /// <param name="value">Object to convert.</param>
-        /// <returns>A string that represents <see cref="value"/>.</returns>
-        public string ToString(object value)
-        {
-            return string.Empty;
-        }
-    }
-}

+ 0 - 71
src/YSAI.Unility/objectsComparer/ValueComparers/DynamicValueComparer.cs

@@ -1,71 +0,0 @@
-using System.Reflection;
-
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Allows to provide comparison rule as a function.
-    /// </summary>
-    /// <typeparam name="T">Type of the objects.</typeparam>
-    public class DynamicValueComparer<T> : IValueComparer
-    {
-        private readonly Func<T, T, ComparisonSettings, bool> _compareFunction;
-        private readonly Func<T, string> _toStringFunction;
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="DynamicValueComparer{T}" /> class.
-        /// </summary>
-        /// <param name="compareFunction">Function to compare objects of type <see cref="T"/>.</param>
-        public DynamicValueComparer(Func<T, T, ComparisonSettings, bool> compareFunction) : this(compareFunction, obj => obj?.ToString() ?? string.Empty)
-        {
-        }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="DynamicValueComparer{T}" /> class.
-        /// </summary>
-        /// <param name="compareFunction">Function to compare objects of type <see cref="T"/>.</param>
-        /// <param name="toStringFunction">Function to convert objects of type <see cref="T"/> to <see cref="string"/>.</param>
-        public DynamicValueComparer(Func<T, T, ComparisonSettings, bool> compareFunction, Func<T, string> toStringFunction)
-        {
-            _compareFunction = compareFunction ?? throw new ArgumentNullException(nameof(compareFunction));
-            _toStringFunction = toStringFunction ?? throw new ArgumentNullException(nameof(toStringFunction));
-        }
-
-        /// <summary>
-        /// Comparers <paramref name="obj1"/> and <paramref name="obj2"/>.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="settings">Instance of <see cref="ComparisonSettings"/> class.</param>
-        /// <returns>true if the objects are considered equal; otherwise, false.</returns>
-        public bool Compare(object obj1, object obj2, ComparisonSettings settings)
-        {
-            IsArgumentException(obj1, nameof(obj1));
-            IsArgumentException(obj2, nameof(obj2));
-
-            return _compareFunction((T)obj1, (T)obj2, settings);
-        }
-
-        /// <summary>
-        /// Converts values of comparing objects to <see cref="string"/>.
-        /// </summary>
-        /// <param name="value">Object to convert.</param>
-        /// <returns>A string that represents <see cref="value"/>.</returns>
-        public string ToString(object value)
-        {
-            IsArgumentException(value, nameof(value));
-
-            return _toStringFunction((T)value);
-        }
-
-        // ReSharper disable once UnusedParameter.Local
-        private void IsArgumentException(object obj, string argumentName)
-        {
-            var t = typeof(T).GetTypeInfo();
-
-            if (!(obj is T) && !((t.IsClass || Nullable.GetUnderlyingType(typeof(T)) != null) && obj == null))
-            {
-                throw new ArgumentException(argumentName);
-            }
-        }
-    }
-}

+ 0 - 24
src/YSAI.Unility/objectsComparer/ValueComparers/IValueComparer.cs

@@ -1,24 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Defines a generalized comparison method to compare 2 objects.
-    /// </summary>
-    public interface IValueComparer
-    {
-        /// <summary>
-        /// Comparers <paramref name="obj1"/> and <paramref name="obj2"/>.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="settings">Instance of <see cref="ComparisonSettings"/> class.</param>
-        /// <returns>true if the objects are considered equal; otherwise, false.</returns>
-        bool Compare(object obj1, object obj2, ComparisonSettings settings);
-
-        /// <summary>
-        /// Converts values of comparing objects to <see cref="string"/>.
-        /// </summary>
-        /// <param name="value">Object to convert.</param>
-        /// <returns>A string that represents <see cref="value"/>.</returns>
-        string ToString(object value);
-    }
-}

+ 0 - 25
src/YSAI.Unility/objectsComparer/ValueComparers/IValueComparer~1.cs

@@ -1,25 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Defines a generalized type-specific comparison method to compare 2 objects.
-    /// </summary>
-    /// <typeparam name="T">Type of the objects.</typeparam>
-    public interface IValueComparer<in T> : IValueComparer
-    {
-        /// <summary>
-        /// Comparers <paramref name="obj1"/> and <paramref name="obj2"/>.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="settings">Instance of <see cref="ComparisonSettings"/> class.</param>
-        /// <returns>true if the objects are considered equal; otherwise, false.</returns>
-        bool Compare(T obj1, T obj2, ComparisonSettings settings);
-
-        /// <summary>
-        /// Converts values of comparing objects to <see cref="string"/>.
-        /// </summary>
-        /// <param name="value">Object to convert.</param>
-        /// <returns>A string that represents <see cref="value"/>.</returns>
-        string ToString(T value);
-    }
-}

+ 0 - 48
src/YSAI.Unility/objectsComparer/ValueComparers/IgnoreCaseStringsValueComparer.cs

@@ -1,48 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Allows to compare string ignoring case.
-    /// </summary>
-    public class IgnoreCaseStringsValueComparer : AbstractValueComparer<string>
-    {
-        private static volatile IValueComparer _instance;
-
-        /// <summary>
-        /// Static <see cref="IgnoreCaseStringsValueComparer"/> instance.
-        /// </summary>
-        public static IValueComparer Instance
-        {
-            get
-            {
-                if (_instance != null)
-                {
-                    return _instance;
-                }
-
-                lock (SyncRoot)
-                {
-                    if (_instance == null)
-                    {
-                        _instance = new IgnoreCaseStringsValueComparer();
-                    }
-                }
-
-                return _instance;
-            }
-        }
-
-        private static readonly object SyncRoot = new object();
-
-        /// <summary>
-        /// Comparers <paramref name="obj1"/> and <paramref name="obj2"/>.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="settings">Instance of <see cref="ComparisonSettings"/> class.</param>
-        /// <returns>true if the objects are considered equal; otherwise, false.</returns>
-        public override bool Compare(string obj1, string obj2, ComparisonSettings settings)
-        {
-            return string.Compare(obj1, obj2, StringComparison.CurrentCultureIgnoreCase) == 0;
-        }
-    }
-}

+ 0 - 63
src/YSAI.Unility/objectsComparer/ValueComparers/NulableStringsValueComparer.cs

@@ -1,63 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    /// <summary>
-    /// Allows to compare strings considering that null and empty string are equal.
-    /// </summary>
-    public class NulableStringsValueComparer : AbstractValueComparer<string>
-    {
-        private static volatile IValueComparer<string> _instance;
-
-        /// <summary>
-        /// Static <see cref="NulableStringsValueComparer"/> instance.
-        /// </summary>
-        public static IValueComparer Instance
-        {
-            get
-            {
-                if (_instance != null)
-                {
-                    return _instance;
-                }
-
-                lock (SyncRoot)
-                {
-                    if (_instance == null)
-                    {
-                        _instance = new NulableStringsValueComparer();
-                    }
-                }
-
-                return _instance;
-            }
-        }
-
-        private static readonly object SyncRoot = new object();
-
-        /// <summary>
-        /// Comparers <paramref name="obj1"/> and <paramref name="obj2"/>.
-        /// </summary>
-        /// <param name="obj1">Object 1.</param>
-        /// <param name="obj2">Object 2.</param>
-        /// <param name="settings">Instance of <see cref="ComparisonSettings"/> class.</param>
-        /// <returns>true if the objects are considered equal; otherwise, false.</returns>
-        public override bool Compare(string obj1, string obj2, ComparisonSettings settings)
-        {
-            if (obj1 == null)
-            {
-                obj1 = string.Empty;
-            }
-
-            if (obj2 == null)
-            {
-                obj2 = string.Empty;
-            }
-
-            return obj1.Equals(obj2);
-        }
-
-        public override string ToString(string value)
-        {
-            return value ?? string.Empty;
-        }
-    }
-}

+ 0 - 10
src/YSAI.Unility/objectsComparer/ValueComparers/ToStringComparer.cs

@@ -1,10 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    public class ToStringComparer<T> : DynamicValueComparer<T>
-    {
-        public ToStringComparer() :
-            base((uri1, uri2, settings) => uri1?.ToString() == uri2?.ToString())
-        {
-        }
-    }
-}

+ 0 - 38
src/YSAI.Unility/objectsComparer/ValueComparers/UriComparer.cs

@@ -1,38 +0,0 @@
-namespace YSAI.Unility.objectsComparer
-{
-    public class UriComparer : DynamicValueComparer<Uri>
-    {
-        private static volatile UriComparer _instance;
-
-        /// <summary>
-        /// Static <see cref="UriComparer"/> instance.
-        /// </summary>
-        public static IValueComparer Instance
-        {
-            get
-            {
-                if (_instance != null)
-                {
-                    return _instance;
-                }
-
-                lock (SyncRoot)
-                {
-                    if (_instance == null)
-                    {
-                        _instance = new UriComparer();
-                    }
-                }
-
-                return _instance;
-            }
-        }
-
-        private static readonly object SyncRoot = new object();
-
-        public UriComparer() :
-            base((uri1, uri2, settings) => uri1.OriginalString == uri2.OriginalString, (uri) => uri.OriginalString)
-        {
-        }
-    }
-}

+ 20 - 20
src/YSAI.VT/Program.cs

@@ -22,26 +22,26 @@ namespace YSAI.VT
 
                 //"YSAI.Core",
 
-                //"YSAI.Rpc",
-                //"YSAI.Redis",
-
-                //"YSAI.Kafka",
-                //"YSAI.Mqtt",
-                //"YSAI.NetMQ",
-                //"YSAI.Netty",
-                //"YSAI.RabbitMQ",
-                //////////"YSAI.Rest",
-
-                //"YSAI.AllenBradley",
-                //"YSAI.Beckhoff",
-                //"YSAI.Can",
-                //"YSAI.DB",
-                //"YSAI.Mewtocol",
-                //"YSAI.Mitsubishi",
-                //"YSAI.Modbus",
-                //"YSAI.Omron",
-                //"YSAI.Opc",
-                //"YSAI.Siemens",
+                "YSAI.Rpc",
+                "YSAI.Redis",
+
+                "YSAI.Kafka",
+                "YSAI.Mqtt",
+                "YSAI.NetMQ",
+                "YSAI.Netty",
+                "YSAI.RabbitMQ",
+                ////////"YSAI.Rest",
+
+                "YSAI.AllenBradley",
+                "YSAI.Beckhoff",
+                "YSAI.Can",
+                "YSAI.DB",
+                "YSAI.Mewtocol",
+                "YSAI.Mitsubishi",
+                "YSAI.Modbus",
+                "YSAI.Omron",
+                "YSAI.Opc",
+                "YSAI.Siemens",
 
 #endif
             };