V1 Fixes #3541. Checking if clipboard is available on windows. (#3658)

* V1 Fixes #3541. Checking if clipboard is available on windows.

* Fix nuget packages with vulnerabilities.
This commit is contained in:
BDisp
2024-08-12 13:44:09 +01:00
committed by Tig
parent 8d71a9f942
commit 565793b85c
3 changed files with 18 additions and 4 deletions

View File

@@ -1970,7 +1970,21 @@ namespace Terminal.Gui {
class WindowsClipboard : ClipboardBase {
public WindowsClipboard ()
{
IsSupported = IsClipboardFormatAvailable (cfUnicodeText);
IsSupported = CheckClipboardIsAvailable ();
}
private static bool CheckClipboardIsAvailable ()
{
// Attempt to open the clipboard
if (OpenClipboard (IntPtr.Zero)) {
// Clipboard is available
// Close the clipboard after use
CloseClipboard ();
return true;
}
// Clipboard is not available
return false;
}
public override bool IsSupported { get; }

View File

@@ -21,7 +21,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="CsvHelper" Version="33.0.1" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
</ItemGroup>

View File

@@ -19,10 +19,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="ReportGenerator" Version="5.3.7" />
<PackageReference Include="ReportGenerator" Version="5.3.8" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>