diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index d2ca0ff1..dd5343bf 100644 Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 405ed30a..c589e7ed 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/SunnyUI/Static/UGDI.cs b/SunnyUI/Static/UGDI.cs index 582b4ed8..f440ee8e 100644 --- a/SunnyUI/Static/UGDI.cs +++ b/SunnyUI/Static/UGDI.cs @@ -29,20 +29,6 @@ namespace Sunny.UI { public static class GDI { - public static PointF AzRange(this PointF center, float range, float az, float xOffset = 0, float yOffset = 0) - { - float x = (float)(range * 1.0f * Math.Sin(az * Math.PI / 180)); - float y = (float)(range * 1.0f * Math.Cos(az * Math.PI / 180)); - return new PointF(center.X + xOffset + x, center.Y + yOffset - y); - } - - public static PointF AzRange(this Point center, float range, float az, float xOffset = 0, float yOffset = 0) - { - float x = (float)(range * 1.0f * Math.Sin(az * Math.PI / 180)); - float y = (float)(range * 1.0f * Math.Cos(az * Math.PI / 180)); - return new PointF(center.X + xOffset + x, center.Y + yOffset - y); - } - /// /// 点是否在区域内 /// diff --git a/SunnyUI/Static/UMapper.cs b/SunnyUI/Static/UMapper.cs new file mode 100644 index 00000000..bb439c71 --- /dev/null +++ b/SunnyUI/Static/UMapper.cs @@ -0,0 +1,46 @@ +using System; +using System.Linq; + +namespace Sunny.UI +{ + public static class MapperEx + { + private static void Mapper(T source, T dest) + { + var listSource = source.GetType().GetNeedProperties().ToDictionary(prop => prop.Name); + var listDest = source.GetType().GetNeedProperties().ToDictionary(prop => prop.Name); + + foreach (var item in listDest) + { + if (listSource.ContainsKey(item.Key)) + { + var sourceInfo = listSource[item.Key]; + object sourceValue = sourceInfo.GetValue(source, null); + Type sourceType = sourceInfo.PropertyType; + + Type destType = item.Value.PropertyType; + var destInfo = item.Value; + + if (sourceType.IsValueType) + { + destInfo.SetValue(dest, sourceValue, null); + } + else + { + + } + } + } + } + + public static void MapperTo(this T source, T dest) + { + Mapper(source, dest); + } + + public static void MapperFrom(this T dest, T source) + { + Mapper(source, dest); + } + } +}