diff --git a/ScreenCapture.NET/DirectX/DX11CompatibilityExtensions.cs b/ScreenCapture.NET.DX11/DX11CompatibilityExtensions.cs similarity index 100% rename from ScreenCapture.NET/DirectX/DX11CompatibilityExtensions.cs rename to ScreenCapture.NET.DX11/DX11CompatibilityExtensions.cs diff --git a/ScreenCapture.NET/DirectX/DX11ScreenCapture.cs b/ScreenCapture.NET.DX11/DX11ScreenCapture.cs similarity index 100% rename from ScreenCapture.NET/DirectX/DX11ScreenCapture.cs rename to ScreenCapture.NET.DX11/DX11ScreenCapture.cs diff --git a/ScreenCapture.NET/DirectX/DX11ScreenCaptureService.cs b/ScreenCapture.NET.DX11/DX11ScreenCaptureService.cs similarity index 88% rename from ScreenCapture.NET/DirectX/DX11ScreenCaptureService.cs rename to ScreenCapture.NET.DX11/DX11ScreenCaptureService.cs index 28d0fce..40363a8 100644 --- a/ScreenCapture.NET/DirectX/DX11ScreenCaptureService.cs +++ b/ScreenCapture.NET.DX11/DX11ScreenCaptureService.cs @@ -12,9 +12,10 @@ public class DX11ScreenCaptureService : IScreenCaptureService #region Properties & Fields private readonly IDXGIFactory1 _factory; - private readonly Dictionary _screenCaptures = new(); + private bool _isDisposed; + #endregion #region Constructors @@ -27,6 +28,8 @@ public class DX11ScreenCaptureService : IScreenCaptureService DXGI.CreateDXGIFactory1(out _factory!).CheckError(); } + ~DX11ScreenCaptureService() => Dispose(); + #endregion #region Methods @@ -34,6 +37,8 @@ public class DX11ScreenCaptureService : IScreenCaptureService /// public IEnumerable GetGraphicsCards() { + if (_isDisposed) throw new ObjectDisposedException(GetType().FullName); + int i = 0; while (_factory.EnumAdapters1(i, out IDXGIAdapter1 adapter).Success) { @@ -46,6 +51,8 @@ public class DX11ScreenCaptureService : IScreenCaptureService /// public IEnumerable GetDisplays(GraphicsCard graphicsCard) { + if (_isDisposed) throw new ObjectDisposedException(GetType().FullName); + using IDXGIAdapter1? adapter = _factory.GetAdapter1(graphicsCard.Index); int i = 0; @@ -71,6 +78,8 @@ public class DX11ScreenCaptureService : IScreenCaptureService IScreenCapture IScreenCaptureService.GetScreenCapture(Display display) => GetScreenCapture(display); public DX11ScreenCapture GetScreenCapture(Display display) { + if (_isDisposed) throw new ObjectDisposedException(GetType().FullName); + if (!_screenCaptures.TryGetValue(display, out DX11ScreenCapture? screenCapture)) _screenCaptures.Add(display, screenCapture = new DX11ScreenCapture(_factory, display)); return screenCapture; @@ -79,6 +88,8 @@ public class DX11ScreenCaptureService : IScreenCaptureService /// public void Dispose() { + if (_isDisposed) return; + foreach (DX11ScreenCapture screenCapture in _screenCaptures.Values) screenCapture.Dispose(); _screenCaptures.Clear(); @@ -86,6 +97,8 @@ public class DX11ScreenCaptureService : IScreenCaptureService _factory.Dispose(); GC.SuppressFinalize(this); + + _isDisposed = true; } #endregion diff --git a/ScreenCapture.NET/Helper/DPIAwareness.cs b/ScreenCapture.NET.DX11/Helper/DPIAwareness.cs similarity index 100% rename from ScreenCapture.NET/Helper/DPIAwareness.cs rename to ScreenCapture.NET.DX11/Helper/DPIAwareness.cs diff --git a/ScreenCapture.NET.DX11/Resources/icon.png b/ScreenCapture.NET.DX11/Resources/icon.png new file mode 100644 index 0000000..46c5033 Binary files /dev/null and b/ScreenCapture.NET.DX11/Resources/icon.png differ diff --git a/ScreenCapture.NET.DX11/ScreenCapture.NET.DX11.csproj b/ScreenCapture.NET.DX11/ScreenCapture.NET.DX11.csproj new file mode 100644 index 0000000..4e46d07 --- /dev/null +++ b/ScreenCapture.NET.DX11/ScreenCapture.NET.DX11.csproj @@ -0,0 +1,73 @@ + + + net7.0-windows;net6.0-windows + latest + enable + true + + Darth Affe + Wyrez + en-US + en-US + ScreenCapture.NET.DX11 + ScreenCapture.NET.DX11 + ScreenCapture.NET.DX11 + ScreenCapture.NET.DX11 + ScreenCapture.NET + Vortice based Screen-Capturing + Vortice based Screen-Capturing using Desktop Duplication + Copyright © Darth Affe 2023 + Copyright © Darth Affe 2023 + icon.png + https://github.com/DarthAffe/ScreenCapture.NET + LGPL-2.1-only + Github + https://github.com/DarthAffe/ScreenCapture.NET + True + + + The downscale-level is now automatically limited if it would scale the image below a size of 1x1 px. + This is change that can potentially break existing behavior but should only affect cases that are expected to crash with earlier versions. + + + 1.3.2 + 1.3.2 + 1.3.2 + + ..\bin\ + true + True + True + snupkg + + + + $(DefineConstants);TRACE;DEBUG + true + full + false + + + + portable + true + $(NoWarn);CS1591;CS1572;CS1573 + $(DefineConstants);RELEASE + + + + + True + + + + + + + + + + + + + diff --git a/ScreenCapture.NET.DX11/ScreenCapture.NET.DX11.csproj.DotSettings b/ScreenCapture.NET.DX11/ScreenCapture.NET.DX11.csproj.DotSettings new file mode 100644 index 0000000..bdcca3e --- /dev/null +++ b/ScreenCapture.NET.DX11/ScreenCapture.NET.DX11.csproj.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/ScreenCapture.NET.sln b/ScreenCapture.NET.sln index 3888c2c..5691b86 100644 --- a/ScreenCapture.NET.sln +++ b/ScreenCapture.NET.sln @@ -1,9 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31025.194 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScreenCapture.NET", "ScreenCapture.NET\ScreenCapture.NET.csproj", "{90596344-E012-4534-A933-3BD1B55469DC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScreenCapture.NET", "ScreenCapture.NET\ScreenCapture.NET.csproj", "{90596344-E012-4534-A933-3BD1B55469DC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScreenCapture.NET.DX11", "..\..\..\..\DarthAffe\Source\Repos\ScreenCapture.NET\ScreenCapture.NET.DX11\ScreenCapture.NET.DX11.csproj", "{58A09AD8-D66F-492E-8BC7-62BDB85E57EC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +17,10 @@ Global {90596344-E012-4534-A933-3BD1B55469DC}.Debug|Any CPU.Build.0 = Debug|Any CPU {90596344-E012-4534-A933-3BD1B55469DC}.Release|Any CPU.ActiveCfg = Release|Any CPU {90596344-E012-4534-A933-3BD1B55469DC}.Release|Any CPU.Build.0 = Release|Any CPU + {58A09AD8-D66F-492E-8BC7-62BDB85E57EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58A09AD8-D66F-492E-8BC7-62BDB85E57EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58A09AD8-D66F-492E-8BC7-62BDB85E57EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58A09AD8-D66F-492E-8BC7-62BDB85E57EC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ScreenCapture.NET/ScreenCapture.NET.csproj b/ScreenCapture.NET/ScreenCapture.NET.csproj index 49dfad2..63094cd 100644 --- a/ScreenCapture.NET/ScreenCapture.NET.csproj +++ b/ScreenCapture.NET/ScreenCapture.NET.csproj @@ -14,8 +14,8 @@ ScreenCapture.NET ScreenCapture.NET ScreenCapture.NET - Vortice based Screen-Capturing - Vortice based Screen-Capturing using Desktop Duplication + Core functionality for Screen-Capturing + Base package for ScreenCapture.NET projects Copyright © Darth Affe 2023 Copyright © Darth Affe 2023 icon.png @@ -62,8 +62,4 @@ - - - -