Projects compiles now

This commit is contained in:
Jaex 2025-06-20 12:50:42 +03:00
parent ce4f055add
commit 4af7ca26a6
21 changed files with 28 additions and 52 deletions

View File

@ -18,6 +18,7 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_m
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# IDE0051: Remove unused private member
dotnet_diagnostic.IDE0051.severity = silent
dotnet_diagnostic.WFO1000.severity = none
# Xml project files
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]

View File

@ -39,7 +39,6 @@ using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Security.Principal;
using System.Text;
using System.Text.RegularExpressions;
@ -817,24 +816,6 @@ namespace ShareX.HelpersLib
return result;
}
[ReflectionPermission(SecurityAction.Assert, MemberAccess = true)]
public static bool TryFixHandCursor()
{
try
{
// https://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/Cursors.cs,423
typeof(Cursors).GetField("hand", BindingFlags.NonPublic | BindingFlags.Static)
.SetValue(null, new Cursor(NativeMethods.LoadCursor(IntPtr.Zero, NativeConstants.IDC_HAND)));
return true;
}
catch
{
// If it fails, we'll just have to live with the old hand.
return false;
}
}
public static bool IsTabletMode()
{
//int state = NativeMethods.GetSystemMetrics(SystemMetric.SM_CONVERTIBLESLATEMODE);

View File

@ -48,7 +48,7 @@ namespace ShareX.HelpersLib
};
client = new HttpClient(clientHandler);
client.DefaultRequestHeaders.Headers["User-Agent"].ToString().ParseAdd(ShareXResources.Headers["User-Agent"].ToString());
client.DefaultRequestHeaders.UserAgent.ParseAdd(ShareXResources.UserAgent);
client.DefaultRequestHeaders.CacheControl = new CacheControlHeaderValue()
{
NoCache = true

View File

@ -29,7 +29,6 @@ using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
namespace ShareX.HelpersLib
{

View File

@ -27,7 +27,6 @@ using System;
using System.Drawing;
using System.Globalization;
using System.Runtime.InteropServices;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
namespace ShareX.HelpersLib
{

View File

@ -25,7 +25,6 @@
using Newtonsoft.Json.Serialization;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace ShareX.HelpersLib
{

View File

@ -8,8 +8,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.AspNetCore.SystemWebAdapters" Version="1.4.0" />
<PackageReference Include="Microsoft.AspNetCore.SystemWebAdapters.CoreServices" Version="1.4.0" />
</ItemGroup>
<ItemGroup>
<COMReference Include="IWshRuntimeLibrary">

View File

@ -100,8 +100,10 @@ namespace ShareX.HelpersLib
pipeSecurity.AddAccessRule(new PipeAccessRule(identity.User, PipeAccessRights.ReadWrite, AccessControlType.Allow));
}
using (NamedPipeServerStream namedPipeServer = new NamedPipeServerStream(PipeName, PipeDirection.InOut, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous, 0, 0, pipeSecurity))
using (NamedPipeServerStream namedPipeServer = new NamedPipeServerStream(PipeName, PipeDirection.InOut, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous, 0, 0))
{
namedPipeServer.SetAccessControl(pipeSecurity);
namedPipeServerCreated = true;
await namedPipeServer.WaitForConnectionAsync(cts.Token).ConfigureAwait(false);

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>

View File

@ -26,7 +26,6 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Management;
using System.Threading;
using System.Windows.Forms;
@ -211,6 +210,7 @@ namespace ShareX.Steam
// Workaround 1.
try
{
/*
using (ManagementClass managementClass = new ManagementClass("Win32_Process"))
{
ManagementClass processInfo = new ManagementClass("Win32_ProcessStartup");
@ -227,6 +227,7 @@ namespace ShareX.Steam
return;
}
}
*/
}
catch
{

View File

@ -80,7 +80,7 @@ namespace ShareX.UploadersLib.FileUploaders
Dictionary<string, string> arguments = new Dictionary<string, string>();
arguments.Add("e", email);
arguments.Add("p", password);
arguments.Add("z", ShareXResources.Headers["User-Agent"].ToString());
arguments.Add("z", ShareXResources.UserAgent);
// Successful: status,apikey,expire,usage
// Failed: status
@ -104,7 +104,7 @@ namespace ShareX.UploadersLib.FileUploaders
Dictionary<string, string> arguments = new Dictionary<string, string>();
arguments.Add("k", APIKey);
arguments.Add("i", id);
arguments.Add("z", ShareXResources.Headers["User-Agent"].ToString());
arguments.Add("z", ShareXResources.UserAgent);
// Successful: status\nlist of history items
// Failed: status
@ -127,7 +127,7 @@ namespace ShareX.UploadersLib.FileUploaders
{
Dictionary<string, string> arguments = new Dictionary<string, string>();
arguments.Add("k", APIKey);
arguments.Add("z", ShareXResources.Headers["User-Agent"].ToString());
arguments.Add("z", ShareXResources.UserAgent);
// Successful: status,url,id,usage
// Failed: status

View File

@ -49,7 +49,7 @@ namespace ShareX.UploadersLib
string accept = null;
string referer = null;
string userAgent = ShareXResources.Headers["User-Agent"].ToString();
string userAgent = ShareXResources.UserAgent;
if (headers != null)
{
@ -120,7 +120,7 @@ namespace ShareX.UploadersLib
IWebProxy proxy = HelpersOptions.CurrentProxy.GetWebProxy();
if (proxy != null) request.Proxy = proxy;
request.Referer = referer;
request.Headers["User-Agent"].ToString() = userAgent;
request.UserAgent = userAgent;
if (contentLength > 0)
{

View File

@ -1,16 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<OutputType>Library</OutputType>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentFTP" Version="52.0.0" />
<PackageReference Include="FluentFTP" Version="52.1.0" />
<PackageReference Include="MegaApiClient" Version="1.10.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SSH.NET" Version="2024.2.0" />
<PackageReference Include="Microsoft.AspNetCore.SystemWebAdapters" Version="1.4.0" />
<PackageReference Include="Microsoft.AspNetCore.SystemWebAdapters.CoreServices" Version="1.4.0" />
<PackageReference Include="SSH.NET" Version="2025.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ShareX.HelpersLib\ShareX.HelpersLib.csproj" />

View File

@ -353,7 +353,6 @@ namespace ShareX
UpdateManager = new ShareXUpdateManager();
LanguageHelper.ChangeLanguage(Settings.Language);
CleanupManager.CleanupAsync();
Helpers.TryFixHandCursor();
DebugHelper.WriteLine("MainForm init started.");
MainForm = new MainForm();

View File

@ -1,18 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows</TargetFramework>
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<OutputType>WinExe</OutputType>
<ApplicationIcon>ShareX_Icon.ico</ApplicationIcon>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Description>Screen capture, file sharing and productivity tool</Description>
<SupportedOSPlatformVersion>10.0.22621.0</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.26100.1742" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="ZXing.Net" Version="0.16.9" />
<PackageReference Include="Microsoft.AspNetCore.SystemWebAdapters" Version="1.4.0" />
<PackageReference Include="Microsoft.AspNetCore.SystemWebAdapters.CoreServices" Version="1.4.0" />
<PackageReference Include="ZXing.Net" Version="0.16.10" />
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.13" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ShareX.HistoryLib\ShareX.HistoryLib.csproj" />

View File

@ -46,7 +46,7 @@ using System.Windows.Forms;
using ZXing;
using ZXing.Common;
using ZXing.QrCode;
using ZXing.Rendering;
using ZXing.Windows.Compatibility;
namespace ShareX
{
@ -2286,7 +2286,7 @@ namespace ShareX
{
try
{
BarcodeWriter writer = new BarcodeWriter
BarcodeWriter writer = new BarcodeWriter()
{
Format = BarcodeFormat.QR_CODE,
Options = new QrCodeEncodingOptions
@ -2316,7 +2316,7 @@ namespace ShareX
{
try
{
BarcodeReader barcodeReader = new BarcodeReader
BarcodeReader barcodeReader = new BarcodeReader()
{
AutoRotate = true,
Options = new DecodingOptions