From 3cc919c7a46a08252c776bbfde36c54293b91d26 Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Wed, 15 Apr 2020 11:50:21 -0700 Subject: [PATCH 1/3] type mappings for xaml structs --- TestComponentCSharp/Class.cpp | 73 ++ TestComponentCSharp/Class.h | 27 + TestComponentCSharp/TestComponentCSharp.idl | 11 +- UnitTest/TestComponentCSharp_Tests.cs | 125 +++- WinUI/WinUIProjection/WinUIProjection.csproj | 3 - cswinrt/cswinrt.vcxproj | 5 + cswinrt/cswinrt.vcxproj.filters | 61 ++ cswinrt/helpers.h | 58 ++ cswinrt/main.cpp | 6 +- .../Windows.UI.Xaml.Controls.Primitives.cs | 61 ++ .../Windows.UI.Xaml.Media.Animation.cs | 287 +++++++ .../Windows.UI.Xaml.Media.Media3D.cs | 699 ++++++++++++++++++ .../Windows.UI.Xaml.Media.cs | 251 +++++++ .../Windows.UI.Xaml/Windows.UI.Xaml.SR.cs | 17 + .../Windows.UI.Xaml/Windows.UI.Xaml.cs | 422 ++++++++++- .../additions/Windows.UI/Windows.UI.cs | 10 +- 16 files changed, 2093 insertions(+), 23 deletions(-) create mode 100644 cswinrt/strings/additions/Windows.UI.Xaml.Controls.Primitives/Windows.UI.Xaml.Controls.Primitives.cs create mode 100644 cswinrt/strings/additions/Windows.UI.Xaml.Media.Animation/Windows.UI.Xaml.Media.Animation.cs create mode 100644 cswinrt/strings/additions/Windows.UI.Xaml.Media.Media3D/Windows.UI.Xaml.Media.Media3D.cs create mode 100644 cswinrt/strings/additions/Windows.UI.Xaml.Media/Windows.UI.Xaml.Media.cs create mode 100644 cswinrt/strings/additions/Windows.UI.Xaml/Windows.UI.Xaml.SR.cs diff --git a/TestComponentCSharp/Class.cpp b/TestComponentCSharp/Class.cpp index 97a876c5d..8c15e8d44 100644 --- a/TestComponentCSharp/Class.cpp +++ b/TestComponentCSharp/Class.cpp @@ -778,6 +778,79 @@ namespace winrt::TestComponentCSharp::implementation _color = value; } + Windows::UI::Xaml::CornerRadius Class::CornerRadiusProperty() + { + return _cornerRadius; + } + void Class::CornerRadiusProperty(Windows::UI::Xaml::CornerRadius const& value) + { + _cornerRadius = value; + } + Windows::UI::Xaml::Duration Class::DurationProperty() + { + return _duration; + } + void Class::DurationProperty(Windows::UI::Xaml::Duration const& value) + { + _duration = value; + } + Windows::UI::Xaml::GridLength Class::GridLengthProperty() + { + return _gridLength; + } + void Class::GridLengthProperty(Windows::UI::Xaml::GridLength const& value) + { + _gridLength = value; + } + Windows::UI::Xaml::Thickness Class::ThicknessProperty() + { + return _thickness; + } + void Class::ThicknessProperty(Windows::UI::Xaml::Thickness const& value) + { + _thickness = value; + } + Windows::UI::Xaml::Controls::Primitives::GeneratorPosition Class::GeneratorPositionProperty() + { + return _generatorPosition; + } + void Class::GeneratorPositionProperty(Windows::UI::Xaml::Controls::Primitives::GeneratorPosition const& value) + { + _generatorPosition = value; + } + Windows::UI::Xaml::Media::Matrix Class::MatrixProperty() + { + return _matrix; + } + void Class::MatrixProperty(Windows::UI::Xaml::Media::Matrix const& value) + { + _matrix = value; + } + Windows::UI::Xaml::Media::Animation::KeyTime Class::KeyTimeProperty() + { + return _keyTime; + } + void Class::KeyTimeProperty(Windows::UI::Xaml::Media::Animation::KeyTime const& value) + { + _keyTime = value; + } + Windows::UI::Xaml::Media::Animation::RepeatBehavior Class::RepeatBehaviorProperty() + { + return _repeatBehavior; + } + void Class::RepeatBehaviorProperty(Windows::UI::Xaml::Media::Animation::RepeatBehavior const& value) + { + _repeatBehavior = value; + } + Windows::UI::Xaml::Media::Media3D::Matrix3D Class::Matrix3DProperty() + { + return _matrix3D; + } + void Class::Matrix3DProperty(Windows::UI::Xaml::Media::Media3D::Matrix3D const& value) + { + _matrix3D = value; + } + IReference Class::GetPointReference() { return _point; diff --git a/TestComponentCSharp/Class.h b/TestComponentCSharp/Class.h index b4eb84a95..53f0be826 100644 --- a/TestComponentCSharp/Class.h +++ b/TestComponentCSharp/Class.h @@ -47,6 +47,15 @@ namespace winrt::TestComponentCSharp::implementation Windows::Foundation::Rect _rect{}; Windows::Foundation::Size _size{}; Windows::UI::Color _color{}; + Windows::UI::Xaml::CornerRadius _cornerRadius{}; + Windows::UI::Xaml::Duration _duration{}; + Windows::UI::Xaml::GridLength _gridLength{}; + Windows::UI::Xaml::Thickness _thickness{}; + Windows::UI::Xaml::Controls::Primitives::GeneratorPosition _generatorPosition{}; + Windows::UI::Xaml::Media::Matrix _matrix{}; + Windows::UI::Xaml::Media::Animation::KeyTime _keyTime{}; + Windows::UI::Xaml::Media::Animation::RepeatBehavior _repeatBehavior{}; + Windows::UI::Xaml::Media::Media3D::Matrix3D _matrix3D{}; Windows::Foundation::TimeSpan _timeSpan{}; Windows::Foundation::DateTime _dateTime{}; winrt::hresult _hr; @@ -211,6 +220,24 @@ namespace winrt::TestComponentCSharp::implementation void SizeProperty(Windows::Foundation::Size const& value); Windows::UI::Color ColorProperty(); void ColorProperty(Windows::UI::Color const& value); + Windows::UI::Xaml::CornerRadius CornerRadiusProperty(); + void CornerRadiusProperty(Windows::UI::Xaml::CornerRadius const& value); + Windows::UI::Xaml::Duration DurationProperty(); + void DurationProperty(Windows::UI::Xaml::Duration const& value); + Windows::UI::Xaml::GridLength GridLengthProperty(); + void GridLengthProperty(Windows::UI::Xaml::GridLength const& value); + Windows::UI::Xaml::Thickness ThicknessProperty(); + void ThicknessProperty(Windows::UI::Xaml::Thickness const& value); + Windows::UI::Xaml::Controls::Primitives::GeneratorPosition GeneratorPositionProperty(); + void GeneratorPositionProperty(Windows::UI::Xaml::Controls::Primitives::GeneratorPosition const& value); + Windows::UI::Xaml::Media::Matrix MatrixProperty(); + void MatrixProperty(Windows::UI::Xaml::Media::Matrix const& value); + Windows::UI::Xaml::Media::Animation::KeyTime KeyTimeProperty(); + void KeyTimeProperty(Windows::UI::Xaml::Media::Animation::KeyTime const& value); + Windows::UI::Xaml::Media::Animation::RepeatBehavior RepeatBehaviorProperty(); + void RepeatBehaviorProperty(Windows::UI::Xaml::Media::Animation::RepeatBehavior const& value); + Windows::UI::Xaml::Media::Media3D::Matrix3D Matrix3DProperty(); + void Matrix3DProperty(Windows::UI::Xaml::Media::Media3D::Matrix3D const& value); Windows::Foundation::IReference GetPointReference(); Windows::Foundation::TimeSpan TimeSpanProperty(); void TimeSpanProperty(Windows::Foundation::TimeSpan const& value); diff --git a/TestComponentCSharp/TestComponentCSharp.idl b/TestComponentCSharp/TestComponentCSharp.idl index 14328893d..c52854770 100644 --- a/TestComponentCSharp/TestComponentCSharp.idl +++ b/TestComponentCSharp/TestComponentCSharp.idl @@ -247,10 +247,19 @@ namespace TestComponentCSharp // Type mappings // "Simple" structs (blittable with changes to add properties/functions/constructors/etc.) Windows.Foundation.Point PointProperty; + Windows.Foundation.IReference GetPointReference(); Windows.Foundation.Rect RectProperty; Windows.Foundation.Size SizeProperty; Windows.UI.Color ColorProperty; - Windows.Foundation.IReference GetPointReference(); + Windows.UI.Xaml.CornerRadius CornerRadiusProperty; + Windows.UI.Xaml.Duration DurationProperty; + Windows.UI.Xaml.GridLength GridLengthProperty; + Windows.UI.Xaml.Thickness ThicknessProperty; + Windows.UI.Xaml.Controls.Primitives.GeneratorPosition GeneratorPositionProperty; + Windows.UI.Xaml.Media.Matrix MatrixProperty; + Windows.UI.Xaml.Media.Animation.KeyTime KeyTimeProperty; + Windows.UI.Xaml.Media.Animation.RepeatBehavior RepeatBehaviorProperty; + Windows.UI.Xaml.Media.Media3D.Matrix3D Matrix3DProperty; // Structs mapped to equivalent ones in the System namespace Windows.Foundation.TimeSpan TimeSpanProperty; Windows.Foundation.IReference GetTimeSpanReference(); diff --git a/UnitTest/TestComponentCSharp_Tests.cs b/UnitTest/TestComponentCSharp_Tests.cs index 47272673f..be2f9e32b 100644 --- a/UnitTest/TestComponentCSharp_Tests.cs +++ b/UnitTest/TestComponentCSharp_Tests.cs @@ -9,15 +9,18 @@ using Xunit; using WinRT; -using WF = Windows.Foundation; -using WFC = Windows.Foundation.Collections; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Interop; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Media.Animation; +using Windows.UI.Xaml.Media.Media3D; using TestComponentCSharp; using System.Collections.Generic; -using Windows.UI.Xaml.Interop; using System.Collections; namespace UnitTest @@ -1057,6 +1060,122 @@ public void TestColorTypeMapping() Assert.True(TestObject.ColorProperty == color); } + [Fact] + public void TestCornerRadiusTypeMapping() + { + var cornerRadius = new CornerRadius { TopLeft = 1, TopRight = 2, BottomRight = 3, BottomLeft = 4 }; + TestObject.CornerRadiusProperty = cornerRadius; + Assert.Equal(cornerRadius.TopLeft, TestObject.CornerRadiusProperty.TopLeft); + Assert.Equal(cornerRadius.TopRight, TestObject.CornerRadiusProperty.TopRight); + Assert.Equal(cornerRadius.BottomRight, TestObject.CornerRadiusProperty.BottomRight); + Assert.Equal(cornerRadius.BottomLeft, TestObject.CornerRadiusProperty.BottomLeft); + Assert.True(TestObject.CornerRadiusProperty == cornerRadius); + } + + [Fact] + public void TestDurationTypeMapping() + { + var duration = new Duration(TimeSpan.FromTicks(42)); + TestObject.DurationProperty = duration; + Assert.Equal(duration.TimeSpan, TestObject.DurationProperty.TimeSpan); + Assert.True(TestObject.DurationProperty == duration); + } + + [Fact] + public void TestGridLengthTypeMapping() + { + var gridLength = new GridLength( 42, GridUnitType.Pixel ); + TestObject.GridLengthProperty = gridLength; + Assert.Equal(gridLength.GridUnitType, TestObject.GridLengthProperty.GridUnitType); + Assert.Equal(gridLength.Value, TestObject.GridLengthProperty.Value); + Assert.True(TestObject.GridLengthProperty == gridLength); + } + + [Fact] + public void TestThicknessTypeMapping() + { + var thickness = new Thickness { Left = 1, Top = 2, Right = 3, Bottom = 4 }; + TestObject.ThicknessProperty = thickness; + Assert.Equal(thickness.Left, TestObject.ThicknessProperty.Left); + Assert.Equal(thickness.Top, TestObject.ThicknessProperty.Top); + Assert.Equal(thickness.Right, TestObject.ThicknessProperty.Right); + Assert.Equal(thickness.Bottom, TestObject.ThicknessProperty.Bottom); + Assert.True(TestObject.ThicknessProperty == thickness); + } + + [Fact] + public void TestGeneratorPositionTypeMapping() + { + var generatorPosition = new GeneratorPosition { Index = 1, Offset = 2 }; + TestObject.GeneratorPositionProperty = generatorPosition; + Assert.Equal(generatorPosition.Index, TestObject.GeneratorPositionProperty.Index); + Assert.Equal(generatorPosition.Offset, TestObject.GeneratorPositionProperty.Offset); + Assert.True(TestObject.GeneratorPositionProperty == generatorPosition); + } + + [Fact] + public void TestMatrixTypeMapping() + { + var matrix = new Matrix { M11 = 11, M12 = 12, M21 = 21, M22 = 22, OffsetX = 3, OffsetY = 4 }; + TestObject.MatrixProperty = matrix; + Assert.Equal(matrix.M11, TestObject.MatrixProperty.M11); + Assert.Equal(matrix.M12, TestObject.MatrixProperty.M12); + Assert.Equal(matrix.M21, TestObject.MatrixProperty.M21); + Assert.Equal(matrix.M22, TestObject.MatrixProperty.M22); + Assert.Equal(matrix.OffsetX, TestObject.MatrixProperty.OffsetX); + Assert.Equal(matrix.OffsetY, TestObject.MatrixProperty.OffsetY); + Assert.True(TestObject.MatrixProperty == matrix); + } + + [Fact] + public void TestKeyTimeTypeMapping() + { + var keyTime = KeyTime.FromTimeSpan(TimeSpan.FromTicks(42)); + TestObject.KeyTimeProperty = keyTime; + Assert.Equal(keyTime.TimeSpan, TestObject.KeyTimeProperty.TimeSpan); + Assert.True(TestObject.KeyTimeProperty == keyTime); + } + + [Fact] + public void TestRepeatBehaviorTypeMapping() + { + var repeatBehavior = new RepeatBehavior { + Count = 1, Duration = TimeSpan.FromTicks(42), Type = RepeatBehaviorType.Forever }; + TestObject.RepeatBehaviorProperty = repeatBehavior; + Assert.Equal(repeatBehavior.Count, TestObject.RepeatBehaviorProperty.Count); + Assert.Equal(repeatBehavior.Duration, TestObject.RepeatBehaviorProperty.Duration); + Assert.Equal(repeatBehavior.Type, TestObject.RepeatBehaviorProperty.Type); + Assert.True(TestObject.RepeatBehaviorProperty == repeatBehavior); + } + + [Fact] + public void TestMatrix3DTypeMapping() + { + var matrix3D = new Matrix3D { + M11 = 11, M12 = 12, M13 = 13, M14 = 14, + M21 = 21, M22 = 22, M23 = 23, M24 = 24, + M31 = 31, M32 = 32, M33 = 33, M34 = 34, + OffsetX = 41, OffsetY = 42, OffsetZ = 43,M44 = 44 }; + TestObject.Matrix3DProperty = matrix3D; + Assert.Equal(matrix3D.M11, TestObject.Matrix3DProperty.M11); + Assert.Equal(matrix3D.M12, TestObject.Matrix3DProperty.M12); + Assert.Equal(matrix3D.M13, TestObject.Matrix3DProperty.M13); + Assert.Equal(matrix3D.M14, TestObject.Matrix3DProperty.M14); + Assert.Equal(matrix3D.M21, TestObject.Matrix3DProperty.M21); + Assert.Equal(matrix3D.M22, TestObject.Matrix3DProperty.M22); + Assert.Equal(matrix3D.M23, TestObject.Matrix3DProperty.M23); + Assert.Equal(matrix3D.M24, TestObject.Matrix3DProperty.M24); + Assert.Equal(matrix3D.M31, TestObject.Matrix3DProperty.M31); + Assert.Equal(matrix3D.M32, TestObject.Matrix3DProperty.M32); + Assert.Equal(matrix3D.M33, TestObject.Matrix3DProperty.M33); + Assert.Equal(matrix3D.M34, TestObject.Matrix3DProperty.M34); + Assert.Equal(matrix3D.OffsetX, TestObject.Matrix3DProperty.OffsetX); + Assert.Equal(matrix3D.OffsetY, TestObject.Matrix3DProperty.OffsetY); + Assert.Equal(matrix3D.OffsetZ, TestObject.Matrix3DProperty.OffsetZ); + Assert.Equal(matrix3D.M44, TestObject.Matrix3DProperty.M44); + Assert.True(TestObject.Matrix3DProperty == matrix3D); + } + [Fact] public void TestTimeSpanMapping() { diff --git a/WinUI/WinUIProjection/WinUIProjection.csproj b/WinUI/WinUIProjection/WinUIProjection.csproj index 4fef69171..6688790b0 100644 --- a/WinUI/WinUIProjection/WinUIProjection.csproj +++ b/WinUI/WinUIProjection/WinUIProjection.csproj @@ -59,9 +59,6 @@ -include Windows.UI.Xaml.Media.Animation.ConditionallyIndependentlyAnimatableAttribute -include Windows.UI.Xaml.Media.Animation.IndependentlyAnimatableAttribute -include Windows.UI.Xaml.Media.Animation.ConditionallyIndependentlyAnimatableAttribute -# Because we pull in Windows.UI.Xaml attributes, the Duration addition is included, -# which in turn requires the DurationType projection --include Windows.UI.Xaml.DurationType diff --git a/cswinrt/cswinrt.vcxproj b/cswinrt/cswinrt.vcxproj index 043d55521..20a05a285 100644 --- a/cswinrt/cswinrt.vcxproj +++ b/cswinrt/cswinrt.vcxproj @@ -96,7 +96,12 @@ + + + + + diff --git a/cswinrt/cswinrt.vcxproj.filters b/cswinrt/cswinrt.vcxproj.filters index ec22b670f..84c57f2c8 100644 --- a/cswinrt/cswinrt.vcxproj.filters +++ b/cswinrt/cswinrt.vcxproj.filters @@ -42,6 +42,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -79,6 +113,18 @@ {8e05f8fe-6311-4726-998b-5cbe19398698} + + {b683f592-740c-4868-8ab3-67e3d7044588} + + + {e3fd55b6-0467-4d57-ba01-e2caa59dd767} + + + {335b6163-2c84-4616-944e-c45b4ffeaed3} + + + {369a6d8a-43e6-48af-82c1-bb2e555909a4} + @@ -184,5 +230,20 @@ strings\additions\Windows.UI + + strings\additions\Windows.UI.Xaml.Media.Media3D + + + strings\additions\Windows.UI.Xaml.Media.Animation + + + strings\additions\Windows.UI.Xaml.Media + + + strings\additions\Windows.UI.Xaml.Controls.Primitives + + + strings\additions\Windows.UI.Xaml + \ No newline at end of file diff --git a/cswinrt/helpers.h b/cswinrt/helpers.h index dd0812df1..bd67ae926 100644 --- a/cswinrt/helpers.h +++ b/cswinrt/helpers.h @@ -472,11 +472,40 @@ namespace cswinrt { "Windows.UI", { { "Color", "Windows.UI", "Color" }, + { "ColorHelper" }, + { "IColorHelper" }, + { "IColorHelperStatics" }, + { "IColorHelperStatics2" }, } }, { "Windows.UI.Xaml", { + { "CornerRadius", "Windows.UI.Xaml", "CornerRadius" }, + { "CornerRadiusHelper" }, { "Duration", "Windows.UI.Xaml", "Duration" }, + { "DurationHelper" }, + { "DurationType", "Windows.UI.Xaml", "DurationType" }, + { "GridLength", "Windows.UI.Xaml", "GridLength" }, + { "GridLengthHelper" }, + { "GridUnitType", "Windows.UI.Xaml", "GridUnitType" }, + { "ICornerRadiusHelper" }, + { "ICornerRadiusHelperStatics" }, + { "IDurationHelper" }, + { "IDurationHelperStatics" }, + { "IGridLengthHelper" }, + { "IGridLengthHelperStatics" }, + { "IThicknessHelper" }, + { "IThicknessHelperStatics" }, + { "Thickness", "Windows.UI.Xaml", "Thickness" }, + { "ThicknessHelper" }, + } + }, + { "Windows.UI.Xaml.Controls.Primitives", + { + { "GeneratorPosition", "Windows.UI.Xaml.Controls.Primitives", "GeneratorPosition" }, + { "GeneratorPositionHelper" }, + { "IGeneratorPositionHelper" }, + { "IGeneratorPositionHelperStatics" }, } }, { "Windows.UI.Xaml.Data", @@ -506,6 +535,35 @@ namespace cswinrt { "TypeKind", "Windows.UI.Xaml.Interop", "TypeKind", true }, { "TypeName", "System", "Type", true } } + }, + { "Windows.UI.Xaml.Media", + { + { "IMatrixHelper" }, + { "IMatrixHelperStatics" }, + { "Matrix", "Windows.UI.Xaml.Media", "Matrix" }, + { "MatrixHelper" }, + } + }, + { "Windows.UI.Xaml.Media.Animation", + { + { "IKeyTimeHelper" }, + { "IKeyTimeHelperStatics" }, + { "IRepeatBehaviorHelper" }, + { "IRepeatBehaviorHelperStatics" }, + { "KeyTime", "Windows.UI.Xaml.Media.Animation", "KeyTime" }, + { "KeyTimeHelper" }, + { "RepeatBehavior", "Windows.UI.Xaml.Media.Animation", "RepeatBehavior" }, + { "RepeatBehaviorHelper" }, + { "RepeatBehaviorType", "Windows.UI.Xaml.Media.Animation", "RepeatBehaviorType" } + } + }, + { "Windows.UI.Xaml.Media.Media3D", + { + { "IMatrix3DHelper" }, + { "IMatrix3DHelperStatics" }, + { "Matrix3D", "Windows.UI.Xaml.Media.Media3D", "Matrix3D" }, + { "Matrix3DHelper" }, + } } }; diff --git a/cswinrt/main.cpp b/cswinrt/main.cpp index 4a30148b4..56bfe5d22 100644 --- a/cswinrt/main.cpp +++ b/cswinrt/main.cpp @@ -153,7 +153,11 @@ Where is one or more of: for (auto&& [name, type] : members.types) { if (!settings.filter.includes(type)) { continue; } - if (get_mapped_type(ns, name)) continue; + if (get_mapped_type(ns, name)) + { + written = true; + continue; + } auto guard{ w.push_generic_params(type.GenericParam()) }; bool type_requires_abi = true; diff --git a/cswinrt/strings/additions/Windows.UI.Xaml.Controls.Primitives/Windows.UI.Xaml.Controls.Primitives.cs b/cswinrt/strings/additions/Windows.UI.Xaml.Controls.Primitives/Windows.UI.Xaml.Controls.Primitives.cs new file mode 100644 index 000000000..fa80afbf2 --- /dev/null +++ b/cswinrt/strings/additions/Windows.UI.Xaml.Controls.Primitives/Windows.UI.Xaml.Controls.Primitives.cs @@ -0,0 +1,61 @@ + +namespace Windows.UI.Xaml.Controls.Primitives +{ + using Windows.Foundation; + + [StructLayout(LayoutKind.Sequential)] + public struct GeneratorPosition + { + private int _index; + private int _offset; + + public int Index { get { return _index; } set { _index = value; } } + public int Offset { get { return _offset; } set { _offset = value; } } + + public GeneratorPosition(int index, int offset) + { + _index = index; + _offset = offset; + } + + public override int GetHashCode() + { + return _index.GetHashCode() + _offset.GetHashCode(); + } + + public override string ToString() + { + return string.Concat("GeneratorPosition (", _index.ToString(System.Globalization.CultureInfo.InvariantCulture), ",", _offset.ToString(System.Globalization.CultureInfo.InvariantCulture), ")"); + } + + public override bool Equals(object o) + { + if (o is GeneratorPosition) + { + GeneratorPosition that = (GeneratorPosition)o; + return _index == that._index && + _offset == that._offset; + } + return false; + } + + public static bool operator ==(GeneratorPosition gp1, GeneratorPosition gp2) + { + return gp1._index == gp2._index && + gp1._offset == gp2._offset; + } + + public static bool operator !=(GeneratorPosition gp1, GeneratorPosition gp2) + { + return !(gp1 == gp2); + } + } +} + +namespace ABI.Windows.UI.Xaml.Controls.Primitives +{ + public static class GeneratorPosition + { + public static string GetGuidSignature() => $"struct(Windows.UI.Xaml.Controls.Primitives.GeneratorPosition;i4;i4)"; + } +} diff --git a/cswinrt/strings/additions/Windows.UI.Xaml.Media.Animation/Windows.UI.Xaml.Media.Animation.cs b/cswinrt/strings/additions/Windows.UI.Xaml.Media.Animation/Windows.UI.Xaml.Media.Animation.cs new file mode 100644 index 000000000..1d6f7ac4b --- /dev/null +++ b/cswinrt/strings/additions/Windows.UI.Xaml.Media.Animation/Windows.UI.Xaml.Media.Animation.cs @@ -0,0 +1,287 @@ + +namespace Windows.UI.Xaml.Media.Animation +{ + using Windows.Foundation; + + [StructLayout(LayoutKind.Sequential)] + public struct KeyTime + { + private TimeSpan _timeSpan; + + public static KeyTime FromTimeSpan(TimeSpan timeSpan) + { + if (timeSpan < TimeSpan.Zero) + { + throw new ArgumentOutOfRangeException(nameof(timeSpan)); + } + + KeyTime keyTime = default; + + keyTime._timeSpan = timeSpan; + + return keyTime; + } + + public static bool Equals(KeyTime keyTime1, KeyTime keyTime2) + { + return (keyTime1._timeSpan == keyTime2._timeSpan); + } + + public static bool operator ==(KeyTime keyTime1, KeyTime keyTime2) + { + return KeyTime.Equals(keyTime1, keyTime2); + } + + public static bool operator !=(KeyTime keyTime1, KeyTime keyTime2) + { + return !KeyTime.Equals(keyTime1, keyTime2); + } + + public bool Equals(KeyTime value) + { + return KeyTime.Equals(this, value); + } + + public override bool Equals(object value) + { + return value is KeyTime && this == (KeyTime)value; + } + + public override int GetHashCode() + { + return _timeSpan.GetHashCode(); + } + + public override string ToString() + { + return _timeSpan.ToString(); + } + + public static implicit operator KeyTime(TimeSpan timeSpan) + { + return KeyTime.FromTimeSpan(timeSpan); + } + + public TimeSpan TimeSpan + { + get + { + return _timeSpan; + } + } + } + + public enum RepeatBehaviorType + { + Count, + Duration, + Forever + } + + [StructLayout(LayoutKind.Sequential)] + public struct RepeatBehavior : IFormattable + { + private double _Count; + private TimeSpan _Duration; + private RepeatBehaviorType _Type; + + internal static bool IsFinite(double value) + { + return !(double.IsNaN(value) || double.IsInfinity(value)); + } + + public RepeatBehavior(double count) + { + if (!IsFinite(count) || count < 0.0) + { + throw new ArgumentOutOfRangeException(nameof(count)); + } + + _Duration = new TimeSpan(0); + _Count = count; + _Type = RepeatBehaviorType.Count; + } + + public RepeatBehavior(TimeSpan duration) + { + if (duration < new TimeSpan(0)) + { + throw new ArgumentOutOfRangeException(nameof(duration)); + } + + _Duration = duration; + _Count = 0.0; + _Type = RepeatBehaviorType.Duration; + } + + public static RepeatBehavior Forever + { + get + { + RepeatBehavior forever = default; + forever.Type = RepeatBehaviorType.Forever; + + return forever; + } + } + + public bool HasCount + { + get + { + return Type == RepeatBehaviorType.Count; + } + } + + public bool HasDuration + { + get + { + return Type == RepeatBehaviorType.Duration; + } + } + + public double Count + { + get { return _Count; } + set { _Count = value; } + } + + public TimeSpan Duration + { + get { return _Duration; } + set { _Duration = value; } + } + + public RepeatBehaviorType Type + { + get { return _Type; } + set { _Type = value; } + } + + public override string ToString() + { + return InternalToString(null, null); + } + + public string ToString(IFormatProvider formatProvider) + { + return InternalToString(null, formatProvider); + } + + string IFormattable.ToString(string format, IFormatProvider formatProvider) + { + return InternalToString(format, formatProvider); + } + + internal string InternalToString(string format, IFormatProvider formatProvider) + { + switch (_Type) + { + case RepeatBehaviorType.Forever: + + return "Forever"; + + case RepeatBehaviorType.Count: + + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + + sb.AppendFormat( + formatProvider, + "{0:" + format + "}x", + _Count); + + return sb.ToString(); + + case RepeatBehaviorType.Duration: + + return _Duration.ToString(); + + default: + return string.Empty; + } + } + + public override bool Equals(object value) + { + if (value is RepeatBehavior) + { + return this.Equals((RepeatBehavior)value); + } + else + { + return false; + } + } + + public bool Equals(RepeatBehavior repeatBehavior) + { + if (_Type == repeatBehavior._Type) + { + return _Type switch + { + RepeatBehaviorType.Forever => true, + RepeatBehaviorType.Count => _Count == repeatBehavior._Count, + RepeatBehaviorType.Duration => _Duration == repeatBehavior._Duration, + _ => false, + }; + } + else + { + return false; + } + } + + public static bool Equals(RepeatBehavior repeatBehavior1, RepeatBehavior repeatBehavior2) + { + return repeatBehavior1.Equals(repeatBehavior2); + } + + public override int GetHashCode() + { + return _Type switch + { + RepeatBehaviorType.Count => _Count.GetHashCode(), + RepeatBehaviorType.Duration => _Duration.GetHashCode(), + + // We try to choose an unlikely hash code value for Forever. + // All Forevers need to return the same hash code value. + RepeatBehaviorType.Forever => int.MaxValue - 42, + + _ => base.GetHashCode(), + }; + } + + public static bool operator ==(RepeatBehavior repeatBehavior1, RepeatBehavior repeatBehavior2) + { + return repeatBehavior1.Equals(repeatBehavior2); + } + + public static bool operator !=(RepeatBehavior repeatBehavior1, RepeatBehavior repeatBehavior2) + { + return !repeatBehavior1.Equals(repeatBehavior2); + } + } +} + +namespace ABI.Windows.UI.Xaml.Media.Animation +{ + public static class KeyTime + { + public static string GetGuidSignature() + { + string timeSpanSignature = global::WinRT.GuidGenerator.GetSignature(typeof(global::System.TimeSpan)); + return $"struct(Windows.UI.Xaml.Media.Animation.KeyTime;{timeSpanSignature})"; + } + } + + public static class RepeatBehavior + { + public static string GetGuidSignature() => "enum(Windows.UI.Xaml.Media.Animation.RepeatBehavior;i4)"; + } + + public static class RepeatBehaviorType + { + public static string GetGuidSignature() => "enum(Windows.UI.Xaml.Media.Animation.RepeatBehaviorType;i4)"; + } +} diff --git a/cswinrt/strings/additions/Windows.UI.Xaml.Media.Media3D/Windows.UI.Xaml.Media.Media3D.cs b/cswinrt/strings/additions/Windows.UI.Xaml.Media.Media3D/Windows.UI.Xaml.Media.Media3D.cs new file mode 100644 index 000000000..4ed107631 --- /dev/null +++ b/cswinrt/strings/additions/Windows.UI.Xaml.Media.Media3D/Windows.UI.Xaml.Media.Media3D.cs @@ -0,0 +1,699 @@ + +namespace Windows.UI.Xaml.Media.Media3D +{ + using Windows.Foundation; + + [StructLayout(LayoutKind.Sequential)] + public struct Matrix3D : IFormattable + { + // Assuming this matrix has fourth column of 0,0,0,1 and isn't identity this function: + // Returns false if HasInverse is false, otherwise inverts the matrix. + private bool NormalizedAffineInvert() + { + double z20 = _m12 * _m23 - _m22 * _m13; + double z10 = _m32 * _m13 - _m12 * _m33; + double z00 = _m22 * _m33 - _m32 * _m23; + double det = _m31 * z20 + _m21 * z10 + _m11 * z00; + + if (IsZero(det)) + { + return false; + } + + // Compute 3x3 non-zero cofactors for the 2nd column + double z21 = _m21 * _m13 - _m11 * _m23; + double z11 = _m11 * _m33 - _m31 * _m13; + double z01 = _m31 * _m23 - _m21 * _m33; + + // Compute all six 2x2 determinants of 1st two columns + double y01 = _m11 * _m22 - _m21 * _m12; + double y02 = _m11 * _m32 - _m31 * _m12; + double y03 = _m11 * _offsetY - _offsetX * _m12; + double y12 = _m21 * _m32 - _m31 * _m22; + double y13 = _m21 * _offsetY - _offsetX * _m22; + double y23 = _m31 * _offsetY - _offsetX * _m32; + + // Compute all non-zero and non-one 3x3 cofactors for 2nd + // two columns + double z23 = _m23 * y03 - _offsetZ * y01 - _m13 * y13; + double z13 = _m13 * y23 - _m33 * y03 + _offsetZ * y02; + double z03 = _m33 * y13 - _offsetZ * y12 - _m23 * y23; + double z22 = y01; + double z12 = -y02; + double z02 = y12; + + double rcp = 1.0 / det; + + // Multiply all 3x3 cofactors by reciprocal & transpose + _m11 = (z00 * rcp); + _m12 = (z10 * rcp); + _m13 = (z20 * rcp); + + _m21 = (z01 * rcp); + _m22 = (z11 * rcp); + _m23 = (z21 * rcp); + + _m31 = (z02 * rcp); + _m32 = (z12 * rcp); + _m33 = (z22 * rcp); + + _offsetX = (z03 * rcp); + _offsetY = (z13 * rcp); + _offsetZ = (z23 * rcp); + + return true; + } + + // RETURNS true if has inverse & invert was done. Otherwise returns false & leaves matrix unchanged. + private bool InvertCore() + { + if (IsAffine) + { + return NormalizedAffineInvert(); + } + + // compute all six 2x2 determinants of 2nd two columns + double y01 = _m13 * _m24 - _m23 * _m14; + double y02 = _m13 * _m34 - _m33 * _m14; + double y03 = _m13 * _m44 - _offsetZ * _m14; + double y12 = _m23 * _m34 - _m33 * _m24; + double y13 = _m23 * _m44 - _offsetZ * _m24; + double y23 = _m33 * _m44 - _offsetZ * _m34; + + // Compute 3x3 cofactors for 1st the column + double z30 = _m22 * y02 - _m32 * y01 - _m12 * y12; + double z20 = _m12 * y13 - _m22 * y03 + _offsetY * y01; + double z10 = _m32 * y03 - _offsetY * y02 - _m12 * y23; + double z00 = _m22 * y23 - _m32 * y13 + _offsetY * y12; + + // Compute 4x4 determinant + double det = _offsetX * z30 + _m31 * z20 + _m21 * z10 + _m11 * z00; + + if (IsZero(det)) + { + return false; + } + + // Compute 3x3 cofactors for the 2nd column + double z31 = _m11 * y12 - _m21 * y02 + _m31 * y01; + double z21 = _m21 * y03 - _offsetX * y01 - _m11 * y13; + double z11 = _m11 * y23 - _m31 * y03 + _offsetX * y02; + double z01 = _m31 * y13 - _offsetX * y12 - _m21 * y23; + + // Compute all six 2x2 determinants of 1st two columns + y01 = _m11 * _m22 - _m21 * _m12; + y02 = _m11 * _m32 - _m31 * _m12; + y03 = _m11 * _offsetY - _offsetX * _m12; + y12 = _m21 * _m32 - _m31 * _m22; + y13 = _m21 * _offsetY - _offsetX * _m22; + y23 = _m31 * _offsetY - _offsetX * _m32; + + // Compute all 3x3 cofactors for 2nd two columns + double z33 = _m13 * y12 - _m23 * y02 + _m33 * y01; + double z23 = _m23 * y03 - _offsetZ * y01 - _m13 * y13; + double z13 = _m13 * y23 - _m33 * y03 + _offsetZ * y02; + double z03 = _m33 * y13 - _offsetZ * y12 - _m23 * y23; + double z32 = _m24 * y02 - _m34 * y01 - _m14 * y12; + double z22 = _m14 * y13 - _m24 * y03 + _m44 * y01; + double z12 = _m34 * y03 - _m44 * y02 - _m14 * y23; + double z02 = _m24 * y23 - _m34 * y13 + _m44 * y12; + + double rcp = 1.0 / det; + + // Multiply all 3x3 cofactors by reciprocal & transpose + _m11 = (z00 * rcp); + _m12 = (z10 * rcp); + _m13 = (z20 * rcp); + _m14 = (z30 * rcp); + + _m21 = (z01 * rcp); + _m22 = (z11 * rcp); + _m23 = (z21 * rcp); + _m24 = (z31 * rcp); + + _m31 = (z02 * rcp); + _m32 = (z12 * rcp); + _m33 = (z22 * rcp); + _m34 = (z32 * rcp); + + _offsetX = (z03 * rcp); + _offsetY = (z13 * rcp); + _offsetZ = (z23 * rcp); + _m44 = (z33 * rcp); + + return true; + } + + public Matrix3D(double m11, double m12, double m13, double m14, + double m21, double m22, double m23, double m24, + double m31, double m32, double m33, double m34, + double offsetX, double offsetY, double offsetZ, double m44) + { + _m11 = m11; + _m12 = m12; + _m13 = m13; + _m14 = m14; + _m21 = m21; + _m22 = m22; + _m23 = m23; + _m24 = m24; + _m31 = m31; + _m32 = m32; + _m33 = m33; + _m34 = m34; + _offsetX = offsetX; + _offsetY = offsetY; + _offsetZ = offsetZ; + _m44 = m44; + } + + // the transform is identity by default + // Actually fill in the fields - some (internal) code uses the fields directly for perf. + private static Matrix3D s_identity = CreateIdentity(); + + public double M11 + { + get + { + return _m11; + } + set + { + _m11 = value; + } + } + + public double M12 + { + get + { + return _m12; + } + set + { + _m12 = value; + } + } + + public double M13 + { + get + { + return _m13; + } + set + { + _m13 = value; + } + } + + public double M14 + { + get + { + return _m14; + } + set + { + _m14 = value; + } + } + + public double M21 + { + get + { + return _m21; + } + set + { + _m21 = value; + } + } + + public double M22 + { + get + { + return _m22; + } + set + { + _m22 = value; + } + } + + public double M23 + { + get + { + return _m23; + } + set + { + _m23 = value; + } + } + + public double M24 + { + get + { + return _m24; + } + set + { + _m24 = value; + } + } + + public double M31 + { + get + { + return _m31; + } + set + { + _m31 = value; + } + } + + public double M32 + { + get + { + return _m32; + } + set + { + _m32 = value; + } + } + + public double M33 + { + get + { + return _m33; + } + set + { + _m33 = value; + } + } + + public double M34 + { + get + { + return _m34; + } + set + { + _m34 = value; + } + } + + public double OffsetX + { + get + { + return _offsetX; + } + set + { + _offsetX = value; + } + } + + public double OffsetY + { + get + { + return _offsetY; + } + set + { + _offsetY = value; + } + } + + public double OffsetZ + { + get + { + return _offsetZ; + } + set + { + _offsetZ = value; + } + } + + public double M44 + { + get + { + return _m44; + } + set + { + _m44 = value; + } + } + + public static Matrix3D Identity + { + get + { + return s_identity; + } + } + + public bool IsIdentity + { + get + { + return (_m11 == 1 && _m12 == 0 && _m13 == 0 && _m14 == 0 && + _m21 == 0 && _m22 == 1 && _m23 == 0 && _m24 == 0 && + _m31 == 0 && _m32 == 0 && _m33 == 1 && _m34 == 0 && + _offsetX == 0 && _offsetY == 0 && _offsetZ == 0 && _m44 == 1); + } + } + + public override string ToString() + { + // Delegate to the internal method which implements all ToString calls. + return ConvertToString(null /* format string */, null /* format provider */); + } + + public string ToString(IFormatProvider provider) + { + // Delegate to the internal method which implements all ToString calls. + return ConvertToString(null /* format string */, provider); + } + + string IFormattable.ToString(string format, IFormatProvider provider) + { + // Delegate to the internal method which implements all ToString calls. + return ConvertToString(format, provider); + } + + private string ConvertToString(string format, IFormatProvider provider) + { + if (IsIdentity) + { + return "Identity"; + } + + // Helper to get the numeric list separator for a given culture. + char separator = TokenizerHelper.GetNumericListSeparator(provider); + return string.Format(provider, + "{1:" + format + "}{0}{2:" + format + "}{0}{3:" + format + "}{0}{4:" + format + "}{0}{5:" + format + + "}{0}{6:" + format + "}{0}{7:" + format + "}{0}{8:" + format + "}{0}{9:" + format + "}{0}{10:" + format + + "}{0}{11:" + format + "}{0}{12:" + format + "}{0}{13:" + format + "}{0}{14:" + format + "}{0}{15:" + format + "}{0}{16:" + format + "}", + separator, + _m11, _m12, _m13, _m14, + _m21, _m22, _m23, _m24, + _m31, _m32, _m33, _m34, + _offsetX, _offsetY, _offsetZ, _m44); + } + + public override int GetHashCode() + { + // Perform field-by-field XOR of HashCodes + return M11.GetHashCode() ^ + M12.GetHashCode() ^ + M13.GetHashCode() ^ + M14.GetHashCode() ^ + M21.GetHashCode() ^ + M22.GetHashCode() ^ + M23.GetHashCode() ^ + M24.GetHashCode() ^ + M31.GetHashCode() ^ + M32.GetHashCode() ^ + M33.GetHashCode() ^ + M34.GetHashCode() ^ + OffsetX.GetHashCode() ^ + OffsetY.GetHashCode() ^ + OffsetZ.GetHashCode() ^ + M44.GetHashCode(); + } + + public override bool Equals(object o) + { + return o is Matrix3D && Matrix3D.Equals(this, (Matrix3D)o); + } + + public bool Equals(Matrix3D value) + { + return Matrix3D.Equals(this, value); + } + + public static bool operator ==(Matrix3D matrix1, Matrix3D matrix2) + { + return matrix1.M11 == matrix2.M11 && + matrix1.M12 == matrix2.M12 && + matrix1.M13 == matrix2.M13 && + matrix1.M14 == matrix2.M14 && + matrix1.M21 == matrix2.M21 && + matrix1.M22 == matrix2.M22 && + matrix1.M23 == matrix2.M23 && + matrix1.M24 == matrix2.M24 && + matrix1.M31 == matrix2.M31 && + matrix1.M32 == matrix2.M32 && + matrix1.M33 == matrix2.M33 && + matrix1.M34 == matrix2.M34 && + matrix1.OffsetX == matrix2.OffsetX && + matrix1.OffsetY == matrix2.OffsetY && + matrix1.OffsetZ == matrix2.OffsetZ && + matrix1.M44 == matrix2.M44; + } + + public static bool operator !=(Matrix3D matrix1, Matrix3D matrix2) + { + return !(matrix1 == matrix2); + } + + public static Matrix3D operator *(Matrix3D matrix1, Matrix3D matrix2) + { + Matrix3D matrix3D = default; + + matrix3D.M11 = matrix1.M11 * matrix2.M11 + + matrix1.M12 * matrix2.M21 + + matrix1.M13 * matrix2.M31 + + matrix1.M14 * matrix2.OffsetX; + matrix3D.M12 = matrix1.M11 * matrix2.M12 + + matrix1.M12 * matrix2.M22 + + matrix1.M13 * matrix2.M32 + + matrix1.M14 * matrix2.OffsetY; + matrix3D.M13 = matrix1.M11 * matrix2.M13 + + matrix1.M12 * matrix2.M23 + + matrix1.M13 * matrix2.M33 + + matrix1.M14 * matrix2.OffsetZ; + matrix3D.M14 = matrix1.M11 * matrix2.M14 + + matrix1.M12 * matrix2.M24 + + matrix1.M13 * matrix2.M34 + + matrix1.M14 * matrix2.M44; + matrix3D.M21 = matrix1.M21 * matrix2.M11 + + matrix1.M22 * matrix2.M21 + + matrix1.M23 * matrix2.M31 + + matrix1.M24 * matrix2.OffsetX; + matrix3D.M22 = matrix1.M21 * matrix2.M12 + + matrix1.M22 * matrix2.M22 + + matrix1.M23 * matrix2.M32 + + matrix1.M24 * matrix2.OffsetY; + matrix3D.M23 = matrix1.M21 * matrix2.M13 + + matrix1.M22 * matrix2.M23 + + matrix1.M23 * matrix2.M33 + + matrix1.M24 * matrix2.OffsetZ; + matrix3D.M24 = matrix1.M21 * matrix2.M14 + + matrix1.M22 * matrix2.M24 + + matrix1.M23 * matrix2.M34 + + matrix1.M24 * matrix2.M44; + matrix3D.M31 = matrix1.M31 * matrix2.M11 + + matrix1.M32 * matrix2.M21 + + matrix1.M33 * matrix2.M31 + + matrix1.M34 * matrix2.OffsetX; + matrix3D.M32 = matrix1.M31 * matrix2.M12 + + matrix1.M32 * matrix2.M22 + + matrix1.M33 * matrix2.M32 + + matrix1.M34 * matrix2.OffsetY; + matrix3D.M33 = matrix1.M31 * matrix2.M13 + + matrix1.M32 * matrix2.M23 + + matrix1.M33 * matrix2.M33 + + matrix1.M34 * matrix2.OffsetZ; + matrix3D.M34 = matrix1.M31 * matrix2.M14 + + matrix1.M32 * matrix2.M24 + + matrix1.M33 * matrix2.M34 + + matrix1.M34 * matrix2.M44; + matrix3D.OffsetX = matrix1.OffsetX * matrix2.M11 + + matrix1.OffsetY * matrix2.M21 + + matrix1.OffsetZ * matrix2.M31 + + matrix1.M44 * matrix2.OffsetX; + matrix3D.OffsetY = matrix1.OffsetX * matrix2.M12 + + matrix1.OffsetY * matrix2.M22 + + matrix1.OffsetZ * matrix2.M32 + + matrix1.M44 * matrix2.OffsetY; + matrix3D.OffsetZ = matrix1.OffsetX * matrix2.M13 + + matrix1.OffsetY * matrix2.M23 + + matrix1.OffsetZ * matrix2.M33 + + matrix1.M44 * matrix2.OffsetZ; + matrix3D.M44 = matrix1.OffsetX * matrix2.M14 + + matrix1.OffsetY * matrix2.M24 + + matrix1.OffsetZ * matrix2.M34 + + matrix1.M44 * matrix2.M44; + + // matrix3D._type is not set. + + return matrix3D; + } + + public bool HasInverse + { + get + { + return !IsZero(Determinant); + } + } + + public void Invert() + { + if (!InvertCore()) + { + throw new InvalidOperationException(); + } + } + + private static Matrix3D CreateIdentity() + { + Matrix3D matrix3D = default; + matrix3D.SetMatrix(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + return matrix3D; + } + + private void SetMatrix(double m11, double m12, double m13, double m14, + double m21, double m22, double m23, double m24, + double m31, double m32, double m33, double m34, + double offsetX, double offsetY, double offsetZ, double m44) + { + _m11 = m11; + _m12 = m12; + _m13 = m13; + _m14 = m14; + _m21 = m21; + _m22 = m22; + _m23 = m23; + _m24 = m24; + _m31 = m31; + _m32 = m32; + _m33 = m33; + _m34 = m34; + _offsetX = offsetX; + _offsetY = offsetY; + _offsetZ = offsetZ; + _m44 = m44; + } + + private static bool Equals(Matrix3D matrix1, Matrix3D matrix2) + { + return matrix1.M11.Equals(matrix2.M11) && + matrix1.M12.Equals(matrix2.M12) && + matrix1.M13.Equals(matrix2.M13) && + matrix1.M14.Equals(matrix2.M14) && + matrix1.M21.Equals(matrix2.M21) && + matrix1.M22.Equals(matrix2.M22) && + matrix1.M23.Equals(matrix2.M23) && + matrix1.M24.Equals(matrix2.M24) && + matrix1.M31.Equals(matrix2.M31) && + matrix1.M32.Equals(matrix2.M32) && + matrix1.M33.Equals(matrix2.M33) && + matrix1.M34.Equals(matrix2.M34) && + matrix1.OffsetX.Equals(matrix2.OffsetX) && + matrix1.OffsetY.Equals(matrix2.OffsetY) && + matrix1.OffsetZ.Equals(matrix2.OffsetZ) && + matrix1.M44.Equals(matrix2.M44); + } + + private double GetNormalizedAffineDeterminant() + { + double z20 = _m12 * _m23 - _m22 * _m13; + double z10 = _m32 * _m13 - _m12 * _m33; + double z00 = _m22 * _m33 - _m32 * _m23; + + return _m31 * z20 + _m21 * z10 + _m11 * z00; + } + + private bool IsAffine + { + get + { + return (_m14 == 0.0 && _m24 == 0.0 && _m34 == 0.0 && _m44 == 1.0); + } + } + + private double Determinant + { + get + { + if (IsAffine) + { + return GetNormalizedAffineDeterminant(); + } + + // compute all six 2x2 determinants of 2nd two columns + double y01 = _m13 * _m24 - _m23 * _m14; + double y02 = _m13 * _m34 - _m33 * _m14; + double y03 = _m13 * _m44 - _offsetZ * _m14; + double y12 = _m23 * _m34 - _m33 * _m24; + double y13 = _m23 * _m44 - _offsetZ * _m24; + double y23 = _m33 * _m44 - _offsetZ * _m34; + + // Compute 3x3 cofactors for 1st the column + double z30 = _m22 * y02 - _m32 * y01 - _m12 * y12; + double z20 = _m12 * y13 - _m22 * y03 + _offsetY * y01; + double z10 = _m32 * y03 - _offsetY * y02 - _m12 * y23; + double z00 = _m22 * y23 - _m32 * y13 + _offsetY * y12; + + return _offsetX * z30 + _m31 * z20 + _m21 * z10 + _m11 * z00; + } + } + + private static bool IsZero(double value) + { + return Math.Abs(value) < 10.0 * DBL_EPSILON_RELATIVE_1; + } + + private const double DBL_EPSILON_RELATIVE_1 = 1.1102230246251567e-016; /* smallest such that 1.0+DBL_EPSILON != 1.0 */ + + private double _m11; + private double _m12; + private double _m13; + private double _m14; + private double _m21; + private double _m22; + private double _m23; + private double _m24; + private double _m31; + private double _m32; + private double _m33; + private double _m34; + private double _offsetX; + private double _offsetY; + private double _offsetZ; + private double _m44; + } +} + +namespace ABI.Windows.UI.Xaml.Media.Media3D +{ + public static class Matrix3D + { + public static string GetGuidSignature() => + $"struct(Windows.UI.Xaml.Media.Media3D.Matrix3D;f8;f8;f8;f8;f8;f8;f8;f8;f8;f8;f8;f8;f8;f8;f8;f8)"; + } +} diff --git a/cswinrt/strings/additions/Windows.UI.Xaml.Media/Windows.UI.Xaml.Media.cs b/cswinrt/strings/additions/Windows.UI.Xaml.Media/Windows.UI.Xaml.Media.cs new file mode 100644 index 000000000..a81774194 --- /dev/null +++ b/cswinrt/strings/additions/Windows.UI.Xaml.Media/Windows.UI.Xaml.Media.cs @@ -0,0 +1,251 @@ + +namespace Windows.UI.Xaml.Media +{ + using Windows.Foundation; + + [StructLayout(LayoutKind.Sequential)] + public struct Matrix : IFormattable + { + public Matrix(double m11, double m12, + double m21, double m22, + double offsetX, double offsetY) + { + _m11 = m11; + _m12 = m12; + _m21 = m21; + _m22 = m22; + _offsetX = offsetX; + _offsetY = offsetY; + } + + // the transform is identity by default + private static Matrix s_identity = CreateIdentity(); + + public double M11 + { + get + { + return _m11; + } + set + { + _m11 = value; + } + } + + public double M12 + { + get + { + return _m12; + } + set + { + _m12 = value; + } + } + + public double M21 + { + get + { + return _m21; + } + set + { + _m21 = value; + } + } + + public double M22 + { + get + { + return _m22; + } + set + { + _m22 = value; + } + } + + public double OffsetX + { + get + { + return _offsetX; + } + set + { + _offsetX = value; + } + } + + public double OffsetY + { + get + { + return _offsetY; + } + set + { + _offsetY = value; + } + } + + public static Matrix Identity + { + get + { + return s_identity; + } + } + + public bool IsIdentity + { + get + { + return (_m11 == 1 && _m12 == 0 && _m21 == 0 && _m22 == 1 && _offsetX == 0 && _offsetY == 0); + } + } + + public override string ToString() + { + // Delegate to the internal method which implements all ToString calls. + return ConvertToString(null /* format string */, null /* format provider */); + } + + public string ToString(IFormatProvider provider) + { + // Delegate to the internal method which implements all ToString calls. + return ConvertToString(null /* format string */, provider); + } + + string IFormattable.ToString(string format, IFormatProvider provider) + { + // Delegate to the internal method which implements all ToString calls. + return ConvertToString(format, provider); + } + + private string ConvertToString(string format, IFormatProvider provider) + { + if (IsIdentity) + { + return "Identity"; + } + + // Helper to get the numeric list separator for a given culture. + char separator = TokenizerHelper.GetNumericListSeparator(provider); + return string.Format(provider, + "{1:" + format + "}{0}{2:" + format + "}{0}{3:" + format + "}{0}{4:" + format + "}{0}{5:" + format + "}{0}{6:" + format + "}", + separator, + _m11, + _m12, + _m21, + _m22, + _offsetX, + _offsetY); + } + + public Point Transform(Point point) + { + float x = (float)point.X; + float y = (float)point.Y; + this.MultiplyPoint(ref x, ref y); + Point point2 = new Point(x, y); + return point2; + } + + public override int GetHashCode() + { + // Perform field-by-field XOR of HashCodes + return M11.GetHashCode() ^ + M12.GetHashCode() ^ + M21.GetHashCode() ^ + M22.GetHashCode() ^ + OffsetX.GetHashCode() ^ + OffsetY.GetHashCode(); + } + + public override bool Equals(object o) + { + return o is Matrix && Matrix.Equals(this, (Matrix)o); + } + + public bool Equals(Matrix value) + { + return Matrix.Equals(this, value); + } + + public static bool operator ==(Matrix matrix1, Matrix matrix2) + { + return matrix1.M11 == matrix2.M11 && + matrix1.M12 == matrix2.M12 && + matrix1.M21 == matrix2.M21 && + matrix1.M22 == matrix2.M22 && + matrix1.OffsetX == matrix2.OffsetX && + matrix1.OffsetY == matrix2.OffsetY; + } + + public static bool operator !=(Matrix matrix1, Matrix matrix2) + { + return !(matrix1 == matrix2); + } + + private static Matrix CreateIdentity() + { + Matrix matrix = default; + matrix.SetMatrix(1, 0, + 0, 1, + 0, 0); + return matrix; + } + + private void SetMatrix(double m11, double m12, + double m21, double m22, + double offsetX, double offsetY) + { + _m11 = m11; + _m12 = m12; + _m21 = m21; + _m22 = m22; + _offsetX = offsetX; + _offsetY = offsetY; + } + + private void MultiplyPoint(ref float x, ref float y) + { + double num = (y * _m21) + _offsetX; + double num2 = (x * _m12) + _offsetY; + x *= (float)_m11; + x += (float)num; + y *= (float)_m22; + y += (float)num2; + } + + private static bool Equals(Matrix matrix1, Matrix matrix2) + { + return matrix1.M11.Equals(matrix2.M11) && + matrix1.M12.Equals(matrix2.M12) && + matrix1.M21.Equals(matrix2.M21) && + matrix1.M22.Equals(matrix2.M22) && + matrix1.OffsetX.Equals(matrix2.OffsetX) && + matrix1.OffsetY.Equals(matrix2.OffsetY); + } + + private double _m11; + private double _m12; + private double _m21; + private double _m22; + private double _offsetX; + private double _offsetY; + } +} + +namespace ABI.Windows.UI.Xaml.Media +{ + public static class Matrix + { + public static string GetGuidSignature() => $"struct(Windows.UI.Xaml.Media.Matrix;f8;f8;f8;f8;f8;f8)"; + } +} diff --git a/cswinrt/strings/additions/Windows.UI.Xaml/Windows.UI.Xaml.SR.cs b/cswinrt/strings/additions/Windows.UI.Xaml/Windows.UI.Xaml.SR.cs new file mode 100644 index 000000000..dafa4f8df --- /dev/null +++ b/cswinrt/strings/additions/Windows.UI.Xaml/Windows.UI.Xaml.SR.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Windows.UI.Xaml +{ + class SR + { + public static string DirectUI_CornerRadius_InvalidMember = "Invalid value for {0} property on CornerRadius."; + public static string DirectUI_InvalidArgument = "Invalid argument."; + public static string ElementNotAvailable_Default = "The element is not available."; + public static string ElementNotEnabled_Default = "The element is not enabled."; + public static string XamlParse_Default = "XAML parsing failed."; + public static string LayoutCycle_Default = "A cycle occurred while laying out the GUI."; + public static string PlatformNotSupported_WindowsRuntime = "Windows Runtime (WinRT) is not supported on this platform."; + } +} diff --git a/cswinrt/strings/additions/Windows.UI.Xaml/Windows.UI.Xaml.cs b/cswinrt/strings/additions/Windows.UI.Xaml/Windows.UI.Xaml.cs index 0c79139a6..dd118d272 100644 --- a/cswinrt/strings/additions/Windows.UI.Xaml/Windows.UI.Xaml.cs +++ b/cswinrt/strings/additions/Windows.UI.Xaml/Windows.UI.Xaml.cs @@ -3,6 +3,379 @@ namespace Windows.UI.Xaml { using Windows.Foundation; + [StructLayout(LayoutKind.Sequential)] + public struct CornerRadius + { + private double _TopLeft; + private double _TopRight; + private double _BottomRight; + private double _BottomLeft; + + public CornerRadius(double uniformRadius) + { + Validate(uniformRadius, uniformRadius, uniformRadius, uniformRadius); + _TopLeft = _TopRight = _BottomRight = _BottomLeft = uniformRadius; + } + + public CornerRadius(double topLeft, double topRight, double bottomRight, double bottomLeft) + { + Validate(topLeft, topRight, bottomRight, bottomLeft); + + _TopLeft = topLeft; + _TopRight = topRight; + _BottomRight = bottomRight; + _BottomLeft = bottomLeft; + } + + private static void Validate(double topLeft, double topRight, double bottomRight, double bottomLeft) + { + if (topLeft < 0.0 || double.IsNaN(topLeft)) + throw new ArgumentException(string.Format(SR.DirectUI_CornerRadius_InvalidMember, "TopLeft")); + + if (topRight < 0.0 || double.IsNaN(topRight)) + throw new ArgumentException(string.Format(SR.DirectUI_CornerRadius_InvalidMember, "TopRight")); + + if (bottomRight < 0.0 || double.IsNaN(bottomRight)) + throw new ArgumentException(string.Format(SR.DirectUI_CornerRadius_InvalidMember, "BottomRight")); + + if (bottomLeft < 0.0 || double.IsNaN(bottomLeft)) + throw new ArgumentException(string.Format(SR.DirectUI_CornerRadius_InvalidMember, "BottomLeft")); + } + + public override string ToString() + { + return ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal string ToString(System.Globalization.CultureInfo cultureInfo) + { + char listSeparator = TokenizerHelper.GetNumericListSeparator(cultureInfo); + + // Initial capacity [64] is an estimate based on a sum of: + // 48 = 4x double (twelve digits is generous for the range of values likely) + // 8 = 4x Unit Type string (approx two characters) + // 4 = 4x separator characters + System.Text.StringBuilder sb = new System.Text.StringBuilder(64); + + sb.Append(InternalToString(_TopLeft, cultureInfo)); + sb.Append(listSeparator); + sb.Append(InternalToString(_TopRight, cultureInfo)); + sb.Append(listSeparator); + sb.Append(InternalToString(_BottomRight, cultureInfo)); + sb.Append(listSeparator); + sb.Append(InternalToString(_BottomLeft, cultureInfo)); + return sb.ToString(); + } + + internal string InternalToString(double l, System.Globalization.CultureInfo cultureInfo) + { + if (double.IsNaN(l)) return "Auto"; + return Convert.ToString(l, cultureInfo); + } + + public override bool Equals(object obj) + { + if (obj is CornerRadius) + { + CornerRadius otherObj = (CornerRadius)obj; + return (this == otherObj); + } + return (false); + } + + public bool Equals(CornerRadius cornerRadius) + { + return (this == cornerRadius); + } + + public override int GetHashCode() + { + return _TopLeft.GetHashCode() ^ _TopRight.GetHashCode() ^ _BottomLeft.GetHashCode() ^ _BottomRight.GetHashCode(); + } + + public static bool operator ==(CornerRadius cr1, CornerRadius cr2) + { + return cr1._TopLeft == cr2._TopLeft && cr1._TopRight == cr2._TopRight && cr1._BottomRight == cr2._BottomRight && cr1._BottomLeft == cr2._BottomLeft; + } + + public static bool operator !=(CornerRadius cr1, CornerRadius cr2) + { + return (!(cr1 == cr2)); + } + + public double TopLeft + { + get { return _TopLeft; } + set + { + Validate(value, 0, 0, 0); + _TopLeft = value; + } + } + + public double TopRight + { + get { return _TopRight; } + set + { + Validate(0, value, 0, 0); + _TopRight = value; + } + } + + public double BottomRight + { + get { return _BottomRight; } + set + { + Validate(0, 0, value, 0); + _BottomRight = value; + } + } + + public double BottomLeft + { + get { return _BottomLeft; } + set + { + Validate(0, 0, 0, value); + _BottomLeft = value; + } + } + } + + public enum GridUnitType + { + Auto = 0, + Pixel, + Star, + } + + [StructLayout(LayoutKind.Sequential)] + public struct GridLength + { + private readonly double _unitValue; + private readonly GridUnitType _unitType; + + private const double Default = 1.0; + private static readonly GridLength s_auto = new GridLength(Default, GridUnitType.Auto); + + public GridLength(double pixels) + : this(pixels, GridUnitType.Pixel) + { + } + + internal static bool IsFinite(double value) + { + return !(double.IsNaN(value) || double.IsInfinity(value)); + } + + public GridLength(double value, GridUnitType type) + { + if (!IsFinite(value) || value < 0.0) + { + throw new ArgumentException(SR.DirectUI_InvalidArgument, nameof(value)); + } + if (type != GridUnitType.Auto && type != GridUnitType.Pixel && type != GridUnitType.Star) + { + throw new ArgumentException(SR.DirectUI_InvalidArgument, nameof(type)); + } + + _unitValue = (type == GridUnitType.Auto) ? Default : value; + _unitType = type; + } + + + public double Value { get { return ((_unitType == GridUnitType.Auto) ? s_auto._unitValue : _unitValue); } } + public GridUnitType GridUnitType { get { return (_unitType); } } + + + public bool IsAbsolute { get { return (_unitType == GridUnitType.Pixel); } } + public bool IsAuto { get { return (_unitType == GridUnitType.Auto); } } + public bool IsStar { get { return (_unitType == GridUnitType.Star); } } + + public static GridLength Auto + { + get { return (s_auto); } + } + + + public static bool operator ==(GridLength gl1, GridLength gl2) + { + return (gl1.GridUnitType == gl2.GridUnitType + && gl1.Value == gl2.Value); + } + + public static bool operator !=(GridLength gl1, GridLength gl2) + { + return (gl1.GridUnitType != gl2.GridUnitType + || gl1.Value != gl2.Value); + } + + public override bool Equals(object oCompare) + { + if (oCompare is GridLength) + { + GridLength l = (GridLength)oCompare; + return (this == l); + } + else + return false; + } + + public bool Equals(GridLength gridLength) + { + return (this == gridLength); + } + + public override int GetHashCode() + { + return ((int)_unitValue + (int)_unitType); + } + + public override string ToString() + { + return this.ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal string ToString(System.Globalization.CultureInfo cultureInfo) + { + char listSeparator = TokenizerHelper.GetNumericListSeparator(cultureInfo); + + // Initial capacity [64] is an estimate based on a sum of: + // 12 = 1x double (twelve digits is generous for the range of values likely) + // 8 = 4x Unit Type string (approx two characters) + // 2 = 2x separator characters + + if (_unitType == GridUnitType.Auto) + { + return "Auto"; + } + else if (_unitType == GridUnitType.Pixel) + { + return Convert.ToString(_unitValue, cultureInfo); + } + else + { + return Convert.ToString(_unitValue, cultureInfo) + "*"; + } + } + } + + [StructLayout(LayoutKind.Sequential)] + public struct Thickness + { + private double _Left; + private double _Top; + private double _Right; + private double _Bottom; + + public Thickness(double uniformLength) + { + _Left = _Top = _Right = _Bottom = uniformLength; + } + + public Thickness(double left, double top, double right, double bottom) + { + _Left = left; + _Top = top; + _Right = right; + _Bottom = bottom; + } + + public double Left + { + get { return _Left; } + set { _Left = value; } + } + + public double Top + { + get { return _Top; } + set { _Top = value; } + } + + public double Right + { + get { return _Right; } + set { _Right = value; } + } + + public double Bottom + { + get { return _Bottom; } + set { _Bottom = value; } + } + + public override string ToString() + { + return ToString(System.Globalization.CultureInfo.InvariantCulture); + } + + internal string ToString(System.Globalization.CultureInfo cultureInfo) + { + char listSeparator = TokenizerHelper.GetNumericListSeparator(cultureInfo); + + // Initial capacity [64] is an estimate based on a sum of: + // 48 = 4x double (twelve digits is generous for the range of values likely) + // 8 = 4x Unit Type string (approx two characters) + // 4 = 4x separator characters + System.Text.StringBuilder sb = new System.Text.StringBuilder(64); + + sb.Append(InternalToString(_Left, cultureInfo)); + sb.Append(listSeparator); + sb.Append(InternalToString(_Top, cultureInfo)); + sb.Append(listSeparator); + sb.Append(InternalToString(_Right, cultureInfo)); + sb.Append(listSeparator); + sb.Append(InternalToString(_Bottom, cultureInfo)); + return sb.ToString(); + } + + internal string InternalToString(double l, System.Globalization.CultureInfo cultureInfo) + { + if (double.IsNaN(l)) return "Auto"; + return Convert.ToString(l, cultureInfo); + } + + public override bool Equals(object obj) + { + if (obj is Thickness) + { + Thickness otherObj = (Thickness)obj; + return (this == otherObj); + } + return (false); + } + + public bool Equals(Thickness thickness) + { + return (this == thickness); + } + + public override int GetHashCode() + { + return _Left.GetHashCode() ^ _Top.GetHashCode() ^ _Right.GetHashCode() ^ _Bottom.GetHashCode(); + } + + public static bool operator ==(Thickness t1, Thickness t2) + { + return t1._Left == t2._Left && t1._Top == t2._Top && t1._Right == t2._Right && t1._Bottom == t2._Bottom; + } + + public static bool operator !=(Thickness t1, Thickness t2) + { + return (!(t1 == t2)); + } + } + + public enum DurationType + { + Automatic, + TimeSpan, + Forever + } + [StructLayout(LayoutKind.Sequential)] public struct Duration { @@ -20,7 +393,7 @@ public static implicit operator Duration(TimeSpan timeSpan) return new Duration(timeSpan); } - public static Duration operator+(Duration t1, Duration t2) + public static Duration operator +(Duration t1, Duration t2) { if (t1.HasTimeSpan && t2.HasTimeSpan) { @@ -37,7 +410,7 @@ public static implicit operator Duration(TimeSpan timeSpan) } } - public static Duration operator-(Duration t1, Duration t2) + public static Duration operator -(Duration t1, Duration t2) { if (t1.HasTimeSpan && t2.HasTimeSpan) { @@ -53,17 +426,17 @@ public static implicit operator Duration(TimeSpan timeSpan) } } - public static bool operator==(Duration t1, Duration t2) + public static bool operator ==(Duration t1, Duration t2) { return t1.Equals(t2); } - public static bool operator!=(Duration t1, Duration t2) + public static bool operator !=(Duration t1, Duration t2) { return !(t1.Equals(t2)); } - public static bool operator>(Duration t1, Duration t2) + public static bool operator >(Duration t1, Duration t2) { if (t1.HasTimeSpan && t2.HasTimeSpan) { @@ -83,7 +456,7 @@ public static implicit operator Duration(TimeSpan timeSpan) } } - public static bool operator>=(Duration t1, Duration t2) + public static bool operator >=(Duration t1, Duration t2) { if (t1._durationType == DurationType.Automatic && t2._durationType == DurationType.Automatic) { @@ -99,7 +472,7 @@ public static implicit operator Duration(TimeSpan timeSpan) } } - public static bool operator<(Duration t1, Duration t2) + public static bool operator <(Duration t1, Duration t2) { if (t1.HasTimeSpan && t2.HasTimeSpan) { @@ -119,7 +492,7 @@ public static implicit operator Duration(TimeSpan timeSpan) } } - public static bool operator<=(Duration t1, Duration t2) + public static bool operator <=(Duration t1, Duration t2) { if (t1._durationType == DurationType.Automatic && t2._durationType == DurationType.Automatic) { @@ -169,7 +542,7 @@ public static int Compare(Duration t1, Duration t2) } } - public static Duration operator+(Duration duration) + public static Duration operator +(Duration duration) { return duration; } @@ -289,7 +662,12 @@ public override string ToString() } namespace ABI.Windows.UI.Xaml -{ +{ + public static class CornerRadius + { + public static string GetGuidSignature() => $"struct(Windows.UI.Xaml.CornerRadius;f8;f8;f8;f8)"; + } + public static class Duration { public static string GetGuidSignature() @@ -299,4 +677,28 @@ public static string GetGuidSignature() return $"struct(Windows.UI.Xaml.Duration;{timeSpanSignature};{durationTypeSignature})"; } } + + public static class DurationType + { + public static string GetGuidSignature() => "enum(Windows.UI.Xaml.DurationType;i4)"; + } + + public static class GridLength + { + public static string GetGuidSignature() + { + string unitTypeSignature = global::WinRT.GuidGenerator.GetSignature(typeof(global::Windows.UI.Xaml.GridUnitType)); + return $"struct(Windows.UI.Xaml.GridLength;f8;{unitTypeSignature})"; + } + } + + public static class GridUnitType + { + public static string GetGuidSignature() => "enum(Windows.UI.Xaml.GridUnitType;i4)"; + } + + public static class Thickness + { + public static string GetGuidSignature() => $"struct(Windows.UI.Xaml.Thickness;f8;f8;f8;f8)"; + } } diff --git a/cswinrt/strings/additions/Windows.UI/Windows.UI.cs b/cswinrt/strings/additions/Windows.UI/Windows.UI.cs index 4fe88e072..dd096f09e 100644 --- a/cswinrt/strings/additions/Windows.UI/Windows.UI.cs +++ b/cswinrt/strings/additions/Windows.UI/Windows.UI.cs @@ -54,19 +54,19 @@ public override string ToString() return ConvertToString(null, null); } - public string ToString(IFormatProvider? provider) + public string ToString(IFormatProvider provider) { // Delegate to the internal method which implements all ToString calls. return ConvertToString(null, provider); } - string IFormattable.ToString(string? format, IFormatProvider? provider) + string IFormattable.ToString(string format, IFormatProvider provider) { // Delegate to the internal method which implements all ToString calls. return ConvertToString(format, provider); } - internal string ConvertToString(string? format, IFormatProvider? provider) + internal string ConvertToString(string format, IFormatProvider provider) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); @@ -95,7 +95,7 @@ public override int GetHashCode() return _A.GetHashCode() ^ _R.GetHashCode() ^ _G.GetHashCode() ^ _B.GetHashCode(); } - public override bool Equals(object? o) + public override bool Equals(object o) { return o is Color && this == (Color)o; } @@ -118,7 +118,7 @@ public bool Equals(Color color) { return (!(color1 == color2)); } - } + } } namespace ABI.Windows.UI From 036747de42ad9ccb7bca357034b03713722c4ab5 Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Wed, 15 Apr 2020 11:52:35 -0700 Subject: [PATCH 2/3] VS cruft --- cswinrt/cswinrt.vcxproj.filters | 73 --------------------------------- 1 file changed, 73 deletions(-) diff --git a/cswinrt/cswinrt.vcxproj.filters b/cswinrt/cswinrt.vcxproj.filters index 84c57f2c8..89734bdb2 100644 --- a/cswinrt/cswinrt.vcxproj.filters +++ b/cswinrt/cswinrt.vcxproj.filters @@ -3,79 +3,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 6efc6f0dedcff69bf07c606106bfec4e15564e24 Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Wed, 15 Apr 2020 12:18:11 -0700 Subject: [PATCH 3/3] global:: prefix for System.* namespace ambiguities --- UnitTest/Directory.Build.targets | 22 +++++++++++++++---- .../Windows.UI.Xaml.Controls.Primitives.cs | 2 +- .../Windows.UI.Xaml.Media.Animation.cs | 2 +- .../Windows.UI.Xaml/Windows.UI.Xaml.cs | 20 ++++++++--------- .../additions/Windows.UI/Windows.UI.cs | 2 +- 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/UnitTest/Directory.Build.targets b/UnitTest/Directory.Build.targets index 843b21ee1..e64368daf 100644 --- a/UnitTest/Directory.Build.targets +++ b/UnitTest/Directory.Build.targets @@ -36,12 +36,26 @@ -in 10.0.18362.0 -in @(UnitTestWinMDs->'"%(FullPath)"', ' ') -out "$(ProjectDir)Generated Files" +-include TestComponentCSharp -include TestComponent --include TestComponentCSharp --include Windows.Foundation +-include Windows.Foundation -include Windows.UI.Color --include Windows.UI.IColor --exclude Windows.Foundation.Diagnostics +-exclude Windows.UI.Colors +-include Windows.UI.Xaml.CornerRadius +-include Windows.UI.Xaml.Duration +-include Windows.UI.Xaml.DurationType +-include Windows.UI.Xaml.GridLength +-include Windows.UI.Xaml.GridUnitType +-include Windows.UI.Xaml.Thickness +-include Windows.UI.Xaml.Controls.Primitives.GeneratorPosition +-include Windows.UI.Xaml.Media.Matrix +-exclude Windows.UI.Xaml.Media.MatrixTransform +-exclude Windows.UI.Xaml.Media.Matrix3DProjection +-include Windows.UI.Xaml.Media.Animation.KeyTime +-include Windows.UI.Xaml.Media.Animation.RepeatBehavior +-include Windows.UI.Xaml.Media.Animation.RepeatBehaviorType +-include Windows.UI.Xaml.Media.Media3D.Matrix3D +-exclude Windows.Foundation.Diagnostics