Browse Source

add .Net 4.7.2

pull/2833/head
MysticBoy 4 years ago
parent
commit
bc0e1bb9f7
3 changed files with 38 additions and 19 deletions
  1. +21
    -14
      shadowsocks-csharp/Program.cs
  2. +16
    -4
      shadowsocks-csharp/shadowsocks-csharp.csproj
  3. +1
    -1
      shadowsocks-windows.sln

+ 21
- 14
shadowsocks-csharp/Program.cs View File

@@ -19,6 +19,10 @@ namespace Shadowsocks
public static ShadowsocksController MainController { get; private set; }
public static MenuViewController MenuController { get; private set; }
public static string[] Args { get; private set; }
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
/// <summary>
/// 应用程序的主入口点。
/// </summary>
@@ -42,19 +46,22 @@ namespace Shadowsocks
"Shadowsocks Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
//// Check .NET Framework version
//if (!Utils.IsSupportedRuntimeVersion())
//{
// if (DialogResult.OK == MessageBox.Show(I18N.GetString("Unsupported .NET Framework, please update to {0} or later.", "4.7.2"),
// "Shadowsocks Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error))
// {
// //Process.Start("https://www.microsoft.com/download/details.aspx?id=53344"); // 4.6.2
// Process.Start("https://dotnet.microsoft.com/download/dotnet-framework/net472");
// }
// return;
//}
#if NET472
// Check .NET Framework version
if (!Utils.IsSupportedRuntimeVersion())
{
if (DialogResult.OK == MessageBox.Show(I18N.GetString("Unsupported .NET Framework, please update to {0} or later.", "4.7.2"),
"Shadowsocks Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error))
{
//Process.Start("https://www.microsoft.com/download/details.aspx?id=53344"); // 4.6.2
Process.Start("https://dotnet.microsoft.com/download/dotnet-framework/net472");
}
return;
}
if (Environment.OSVersion.Version.Major >= 6) SetProcessDPIAware();
#else
Application.SetHighDpiMode(HighDpiMode.SystemAware);
#endif
Utils.ReleaseMemory(true);
using (Mutex mutex = new Mutex(false, $"Global\\Shadowsocks_{Application.StartupPath.GetHashCode()}"))
{
@@ -67,7 +74,7 @@ namespace Shadowsocks
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.SetHighDpiMode(HighDpiMode.SystemAware);
AutoStartup.RegisterForRestart(true);
if (!mutex.WaitOne(0, false))


+ 16
- 4
shadowsocks-csharp/shadowsocks-csharp.csproj View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<RootNamespace>Shadowsocks</RootNamespace>
<UseWindowsForms>true</UseWindowsForms>
<Authors>clowwindy &amp; community 2020</Authors>
@@ -48,7 +48,19 @@
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
<PackageReference Include="GlobalHotKey" Version="1.1.0" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Web" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<PackageReference Include="System.Windows.Forms.DataVisualization" Version="1.0.0-prerelease.20110.1" />
<PackageReference Include="GlobalHotKeyCore" Version="1.2.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Caseless.Fody" Version="1.9.0" />
<PackageReference Include="Costura.Fody" Version="4.1.0" />
@@ -56,7 +68,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="GlobalHotKeyCore" Version="1.2.0" />
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NLog" Version="4.6.8" />
@@ -66,7 +78,7 @@
</PackageReference>
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
<PackageReference Include="System.Management" Version="4.7.0" />
<PackageReference Include="System.Windows.Forms.DataVisualization" Version="1.0.0-prerelease.20110.1" />
<PackageReference Include="ZXing.Net" Version="0.16.5" />
</ItemGroup>


+ 1
- 1
shadowsocks-windows.sln View File

@@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "shadowsocks-csharp", "shadowsocks-csharp\shadowsocks-csharp.csproj", "{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShadowsocksTest", "test\ShadowsocksTest.csproj", "{45913187-0685-4903-B250-DCEF0479CD86}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShadowsocksTest", "test\ShadowsocksTest.csproj", "{45913187-0685-4903-B250-DCEF0479CD86}"
ProjectSection(ProjectDependencies) = postProject
{8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062} = {8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062}
EndProjectSection


Loading…
Cancel
Save