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 dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# IDE0051: Remove unused private member # IDE0051: Remove unused private member
dotnet_diagnostic.IDE0051.severity = silent dotnet_diagnostic.IDE0051.severity = silent
dotnet_diagnostic.WFO1000.severity = none
# Xml project files # Xml project files
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] [*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]

View File

@ -39,7 +39,6 @@ using System.Reflection;
using System.Resources; using System.Resources;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Security.Permissions;
using System.Security.Principal; using System.Security.Principal;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -817,24 +816,6 @@ namespace ShareX.HelpersLib
return result; 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() public static bool IsTabletMode()
{ {
//int state = NativeMethods.GetSystemMetrics(SystemMetric.SM_CONVERTIBLESLATEMODE); //int state = NativeMethods.GetSystemMetrics(SystemMetric.SM_CONVERTIBLESLATEMODE);

View File

@ -48,7 +48,7 @@ namespace ShareX.HelpersLib
}; };
client = new HttpClient(clientHandler); 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() client.DefaultRequestHeaders.CacheControl = new CacheControlHeaderValue()
{ {
NoCache = true NoCache = true

View File

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

View File

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

View File

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

View File

@ -8,8 +8,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <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>
<ItemGroup> <ItemGroup>
<COMReference Include="IWshRuntimeLibrary"> <COMReference Include="IWshRuntimeLibrary">

View File

@ -100,8 +100,10 @@ namespace ShareX.HelpersLib
pipeSecurity.AddAccessRule(new PipeAccessRule(identity.User, PipeAccessRights.ReadWrite, AccessControlType.Allow)); 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; namedPipeServerCreated = true;
await namedPipeServer.WaitForConnectionAsync(cts.Token).ConfigureAwait(false); await namedPipeServer.WaitForConnectionAsync(cts.Token).ConfigureAwait(false);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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