From ea5ef54f1c0116d229dd1bb5acada015ece93f79 Mon Sep 17 00:00:00 2001 From: Aelyo Softworks Date: Fri, 22 Mar 2024 18:57:18 +0100 Subject: [PATCH] Updated DirectN nuget package. --- Wice.DevTools/Wice.DevTools.csproj | 2 +- .../Wice.Samples.Gallery.csproj | 4 +-- Wice.Tests/Wice.Tests.csproj | 4 +-- Wice/Interop/ICompositorInterop.cs | 25 ------------------- Wice/Properties/AssemblyVersionInfo.cs | 6 ++--- Wice/Utilities/WinRTUtilities.cs | 18 +++++++++++++ Wice/Wice.csproj | 5 ++-- Wice/Window.cs | 4 +-- .../WiceCore.Samples.Gallery.csproj | 2 +- WiceCore.Tests/WiceCore.Tests.csproj | 2 +- WiceCore/WiceCore.csproj | 3 +-- 11 files changed, 33 insertions(+), 42 deletions(-) delete mode 100644 Wice/Interop/ICompositorInterop.cs diff --git a/Wice.DevTools/Wice.DevTools.csproj b/Wice.DevTools/Wice.DevTools.csproj index 482ec3d..e2d58fa 100644 --- a/Wice.DevTools/Wice.DevTools.csproj +++ b/Wice.DevTools/Wice.DevTools.csproj @@ -60,7 +60,7 @@ - 1.15.0.2 + 1.16.0 diff --git a/Wice.Samples.Gallery/Wice.Samples.Gallery.csproj b/Wice.Samples.Gallery/Wice.Samples.Gallery.csproj index ed2d44e..f5ab716 100644 --- a/Wice.Samples.Gallery/Wice.Samples.Gallery.csproj +++ b/Wice.Samples.Gallery/Wice.Samples.Gallery.csproj @@ -205,10 +205,10 @@ - 1.15.0.2 + 1.16.0 - 10.0.22621.2428 + 10.0.22621.3233 diff --git a/Wice.Tests/Wice.Tests.csproj b/Wice.Tests/Wice.Tests.csproj index 27fcce2..5fcc00f 100644 --- a/Wice.Tests/Wice.Tests.csproj +++ b/Wice.Tests/Wice.Tests.csproj @@ -96,10 +96,10 @@ - 1.15.0.2 + 1.16.0 - 10.0.22621.2428 + 10.0.22621.3233 diff --git a/Wice/Interop/ICompositorInterop.cs b/Wice/Interop/ICompositorInterop.cs deleted file mode 100644 index 6be927f..0000000 --- a/Wice/Interop/ICompositorInterop.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using DirectN; -using Windows.UI.Composition; - -namespace Wice.Interop -{ - [ComImport, Guid("25297D5C-3AD4-4C9C-B5CF-E36A38512330"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - public interface ICompositorInterop - { - [PreserveSig] - HRESULT CreateCompositionSurfaceForHandle(IntPtr swapChain, out ICompositionSurface result); - - [PreserveSig] - HRESULT CreateCompositionSurfaceForSwapChain([MarshalAs(UnmanagedType.IUnknown)] object swapChain, out ICompositionSurface result); - -#if NET - [PreserveSig] - HRESULT CreateGraphicsDevice([MarshalAs(UnmanagedType.IUnknown)] object renderingDevice, [MarshalAs(UnmanagedType.IUnknown)] out object result); -#else - [PreserveSig] - HRESULT CreateGraphicsDevice([MarshalAs(UnmanagedType.IUnknown)] object renderingDevice, out CompositionGraphicsDevice result); -#endif - } -} diff --git a/Wice/Properties/AssemblyVersionInfo.cs b/Wice/Properties/AssemblyVersionInfo.cs index 7e25f5c..065b438 100644 --- a/Wice/Properties/AssemblyVersionInfo.cs +++ b/Wice/Properties/AssemblyVersionInfo.cs @@ -1,5 +1,5 @@ using System.Reflection; -[assembly: AssemblyVersion("1.2.0.0")] -[assembly: AssemblyFileVersion("1.2.0.0")] -[assembly: AssemblyInformationalVersion("1.2.0.0")] +[assembly: AssemblyVersion("1.2.1.0")] +[assembly: AssemblyFileVersion("1.2.1.0")] +[assembly: AssemblyInformationalVersion("1.2.1.0")] diff --git a/Wice/Utilities/WinRTUtilities.cs b/Wice/Utilities/WinRTUtilities.cs index e56ed3c..ebe94dd 100644 --- a/Wice/Utilities/WinRTUtilities.cs +++ b/Wice/Utilities/WinRTUtilities.cs @@ -73,6 +73,24 @@ public static T WinRTCast(this object obj, bool throwOnError = true) where T #endif } + public static T WinRTCast(this IntPtr unk, bool throwOnError = true) where T : class + { + if (unk == IntPtr.Zero) + return default; + + if (throwOnError) + return WinRTCast(Marshal.GetObjectForIUnknown(unk), throwOnError); + + try + { + return WinRTCast(Marshal.GetObjectForIUnknown(unk), false); + } + catch + { + return default; + } + } + public static T ComCast(this object obj, bool throwOnError = true) where T : class { if (obj == null) diff --git a/Wice/Wice.csproj b/Wice/Wice.csproj index f21b3ec..8a2ef10 100644 --- a/Wice/Wice.csproj +++ b/Wice/Wice.csproj @@ -82,7 +82,6 @@ - @@ -370,10 +369,10 @@ - 1.15.0.2 + 1.16.0 - 10.0.22621.2428 + 10.0.22621.3233 4.5.0 diff --git a/Wice/Window.cs b/Wice/Window.cs index 92c9b2d..cc259a2 100644 --- a/Wice/Window.cs +++ b/Wice/Window.cs @@ -1007,8 +1007,8 @@ protected virtual CompositionGraphicsDevice CreateCompositionDevice() { var interop = CompositorController.Compositor.ComCast(); var d2d1 = _d2D1Device.Value; - var hr = interop.CreateGraphicsDevice(d2d1.Object, out var obj); - var dev = obj.WinRTCast(); + var hr = interop.CreateGraphicsDevice(d2d1.Object, out var unk); + var dev = unk.WinRTCast(); if (hr.Value < 0) { try diff --git a/WiceCore.Samples.Gallery/WiceCore.Samples.Gallery.csproj b/WiceCore.Samples.Gallery/WiceCore.Samples.Gallery.csproj index 21cb385..94f1542 100644 --- a/WiceCore.Samples.Gallery/WiceCore.Samples.Gallery.csproj +++ b/WiceCore.Samples.Gallery/WiceCore.Samples.Gallery.csproj @@ -159,7 +159,7 @@ - + diff --git a/WiceCore.Tests/WiceCore.Tests.csproj b/WiceCore.Tests/WiceCore.Tests.csproj index 4b5a95a..71338d5 100644 --- a/WiceCore.Tests/WiceCore.Tests.csproj +++ b/WiceCore.Tests/WiceCore.Tests.csproj @@ -37,6 +37,6 @@ - + \ No newline at end of file diff --git a/WiceCore/WiceCore.csproj b/WiceCore/WiceCore.csproj index e0806fd..82d2774 100644 --- a/WiceCore/WiceCore.csproj +++ b/WiceCore/WiceCore.csproj @@ -320,7 +320,6 @@ - @@ -332,6 +331,6 @@ - + \ No newline at end of file