v3.8.6.0 1、修改代码,降低.net框架版本为4.0,WIN XP系统最高支持.net 4.0。

This commit is contained in:
wisdomwei201804 2018-07-17 18:10:52 +08:00
parent e9de31c395
commit ed3c3db8c9
10 changed files with 82 additions and 38 deletions

View File

@ -122,9 +122,9 @@ namespace net.nutcore.aliddns
xmlDoc.Indent = true; xmlDoc.Indent = true;
XmlWriter xw = XmlWriter.Create(configFilePath, xmlDoc); XmlWriter xw = XmlWriter.Create(configFilePath, xmlDoc);
xElement.Save(xw);//写入文件 xElement.Save(xw);//写入文件
xw.Dispose(); //xw.Dispose();
//xw.Flush(); //xw.Flush();
//xw.Close(); xw.Close();
} }
/// <summary> /// <summary>

View File

@ -528,9 +528,9 @@ namespace net.nutcore.aliddns
} }
} }
private async void toolStripMenuItem_Quit_Click(object sender, EventArgs e) private void toolStripMenuItem_Quit_Click(object sender, EventArgs e)
{ {
await ngrok.Stop(); ngrok.Stop();
this.Dispose(); this.Dispose();
} }
@ -795,7 +795,7 @@ namespace net.nutcore.aliddns
MessageBox.Show("获取新版本信息失败!"); MessageBox.Show("获取新版本信息失败!");
} }
private async void checkBox_ngrok_CheckedChanged(object sender, EventArgs e) private void checkBox_ngrok_CheckedChanged(object sender, EventArgs e)
{ {
if (checkBox_ngrok.Checked == true) if (checkBox_ngrok.Checked == true)
@ -806,7 +806,7 @@ namespace net.nutcore.aliddns
if (ngrok.IsExists()) if (ngrok.IsExists())
{ {
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "Ngrok功能启用ngrok.exe将自动加载本机浏览器打开http://127.0.0.1:4040 查看运行状态。" + "\r\n"); textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "Ngrok功能启用ngrok.exe将自动加载本机浏览器打开http://127.0.0.1:4040 查看运行状态。" + "\r\n");
await ngrok.Start(); ngrok.Start();
} }
else else
{ {
@ -816,7 +816,7 @@ namespace net.nutcore.aliddns
else else
{ {
cfg.SaveAppSetting("ngrokauto", "Off"); cfg.SaveAppSetting("ngrokauto", "Off");
await ngrok.Stop(); ngrok.Stop();
button_ngrok.Enabled = true; button_ngrok.Enabled = true;
textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "Ngrok功能关闭再次启动将不会加载" + "\r\n"); textBox_log.AppendText(System.DateTime.Now.ToString() + " " + "Ngrok功能关闭再次启动将不会加载" + "\r\n");
} }

View File

@ -3,6 +3,7 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using YamlDotNet.Serialization; using YamlDotNet.Serialization;
@ -179,7 +180,7 @@ namespace net.nutcore.aliddns
File.WriteAllText(FileConfig, yaml); File.WriteAllText(FileConfig, yaml);
} }
public async Task Start(int code = 0) public void Start(int code = 0)
{ {
var exec = new ProcessStartInfo(); var exec = new ProcessStartInfo();
exec.WorkingDirectory = CurrentDirectory; exec.WorkingDirectory = CurrentDirectory;
@ -209,7 +210,7 @@ namespace net.nutcore.aliddns
try try
{ {
await Task.Run(() => Thread thread = new Thread(() =>
{ {
var proc = Process.Start(exec); var proc = Process.Start(exec);
proc.WaitForExit(); proc.WaitForExit();
@ -222,9 +223,9 @@ namespace net.nutcore.aliddns
} }
} }
public async Task Stop() public void Stop()
{ {
await Task.Run(() => Thread thread = new Thread(() =>
{ {
Process[] pList = Process.GetProcessesByName("Ngrok"); Process[] pList = Process.GetProcessesByName("Ngrok");
foreach (Process p in pList) foreach (Process p in pList)

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: : // 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.8.5.0")] [assembly: AssemblyVersion("3.8.6.0")]
[assembly: AssemblyFileVersion("3.8.5.0")] [assembly: AssemblyFileVersion("3.8.6.0")]

View File

@ -1,28 +1,24 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 此代码由工具生成。
// Runtime Version:4.0.30319.42000 // 运行时版本:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // 对此文件的更改可能会导致不正确的行为,并且如果
// the code is regenerated. // 重新生成代码,这些更改将会丢失。
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace net.nutcore.aliddns.Properties namespace net.nutcore.aliddns.Properties {
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default public static Settings Default {
{ get {
get
{
return defaultInstance; return defaultInstance;
} }
} }

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="2.2.29.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>net.nutcore.aliddns</RootNamespace> <RootNamespace>net.nutcore.aliddns</RootNamespace>
<AssemblyName>AliDDNS</AssemblyName> <AssemblyName>AliDDNS</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
@ -27,6 +27,7 @@
<ApplicationVersion>0.0.0.%2a</ApplicationVersion> <ApplicationVersion>0.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -60,7 +61,7 @@
<HintPath>aliyun-net-sdk-core.dll</HintPath> <HintPath>aliyun-net-sdk-core.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net40\Newtonsoft.Json.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
@ -69,21 +70,46 @@
<Reference Include="System.configuration" /> <Reference Include="System.configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.DirectoryServices" /> <Reference Include="System.DirectoryServices" />
<Reference Include="System.Xaml" /> <Reference Include="System.IO, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.IO.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.WebRequest, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Runtime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading.Tasks, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Threading.Tasks.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Deployment" /> <Reference Include="System.Deployment" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="UIAutomationProvider" /> <Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" /> <Reference Include="WindowsFormsIntegration" />
<Reference Include="YamlDotNet, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="YamlDotNet, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.4.3.2\lib\net45\YamlDotNet.dll</HintPath> <HintPath>..\packages\YamlDotNet.5.0.1\lib\net35\YamlDotNet.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
@ -130,6 +156,7 @@
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
@ -175,6 +202,11 @@
<PreBuildEvent> <PreBuildEvent>
</PreBuildEvent> </PreBuildEvent>
</PropertyGroup> </PropertyGroup>
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net452" /> <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net40" />
<package id="YamlDotNet" version="4.3.2" targetFramework="net452" /> <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net40" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net40" />
<package id="YamlDotNet" version="5.0.1" targetFramework="net40" />
</packages> </packages>