.Net Core 3.1 Upgrade
This commit is contained in:
parent
1c8a4b1c8a
commit
7342aee296
|
@ -10,7 +10,7 @@
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "VS build PTMagic",
|
"preLaunchTask": "VS build PTMagic",
|
||||||
// If you have changed target frameworks, make sure to update the program path.
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
"program": "${workspaceFolder}/PTMagic/bin/Debug/netcoreapp2.1/PTMagic.dll",
|
"program": "${workspaceFolder}/PTMagic/bin/Debug/netcoreapp3.1/PTMagic.dll",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}/PTMagic",
|
"cwd": "${workspaceFolder}/PTMagic",
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "VS build Monitor",
|
"preLaunchTask": "VS build Monitor",
|
||||||
// If you have changed target frameworks, make sure to update the program path.
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
"program": "${workspaceFolder}/Monitor/bin/Debug/netcoreapp2.1/Monitor.dll",
|
"program": "${workspaceFolder}/Monitor/bin/Debug/netcoreapp3.1/Monitor.dll",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}/Monitor",
|
"cwd": "${workspaceFolder}/Monitor",
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="NLog" Version="4.5.10" />
|
<PackageReference Include="NLog" Version="4.6.8" />
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="1.3.0" />
|
<PackageReference Include="NLog.Extensions.Logging" Version="1.6.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="3.1.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.0" />
|
||||||
<PackageReference Include="SharpZipLib" Version="*" />
|
<PackageReference Include="SharpZipLib" Version="*" />
|
||||||
<PackageReference Include="Telegram.Bot" Version="*" />
|
<PackageReference Include="Telegram.Bot" Version="*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -36,7 +36,6 @@ namespace Core.Main
|
||||||
private DateTime _lastSettingFileCheck = Constants.confMinDate;
|
private DateTime _lastSettingFileCheck = Constants.confMinDate;
|
||||||
private DateTime _lastVersionCheck = Constants.confMinDate;
|
private DateTime _lastVersionCheck = Constants.confMinDate;
|
||||||
private DateTime _lastFiatCurrencyCheck = Constants.confMinDate;
|
private DateTime _lastFiatCurrencyCheck = Constants.confMinDate;
|
||||||
private string _lastSetting = "";
|
|
||||||
private string _activeSettingName = "";
|
private string _activeSettingName = "";
|
||||||
private GlobalSetting _activeSetting = null;
|
private GlobalSetting _activeSetting = null;
|
||||||
private string _defaultSettingName = "";
|
private string _defaultSettingName = "";
|
||||||
|
|
|
@ -26,13 +26,14 @@ namespace Core.MarketAnalyzer
|
||||||
request.ContentType = "application/json";
|
request.ContentType = "application/json";
|
||||||
request.UserAgent = "PTMagic.Import";
|
request.UserAgent = "PTMagic.Import";
|
||||||
request.KeepAlive = true;
|
request.KeepAlive = true;
|
||||||
request.Timeout = 60000;
|
request.Timeout = 10000;
|
||||||
|
|
||||||
HttpWebResponse httpResponse = null;
|
HttpWebResponse httpResponse = null;
|
||||||
string jsonString = string.Empty;
|
string jsonString = string.Empty;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
log.DoLogInfo("Calling URL: " + url);
|
||||||
httpResponse = (HttpWebResponse)request.GetResponse();
|
httpResponse = (HttpWebResponse)request.GetResponse();
|
||||||
|
|
||||||
using (StreamReader jsonReader = new StreamReader(httpResponse.GetResponseStream()))
|
using (StreamReader jsonReader = new StreamReader(httpResponse.GetResponseStream()))
|
||||||
|
@ -73,6 +74,11 @@ namespace Core.MarketAnalyzer
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// Do any necessary clean up.
|
||||||
|
if (httpResponse != null) httpResponse.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Newtonsoft.Json.Linq.JObject GetSimpleJsonObjectFromURL(string url, LogHelper log, bool swallowException)
|
public static Newtonsoft.Json.Linq.JObject GetSimpleJsonObjectFromURL(string url, LogHelper log, bool swallowException)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<!--<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>-->
|
<!--<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>-->
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -23,10 +23,8 @@
|
||||||
<None Include="nlog.config" CopyToOutputDirectory="Always" />
|
<None Include="nlog.config" CopyToOutputDirectory="Always" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.5.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.7" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.1.3" />
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Core\Core.csproj" />
|
<ProjectReference Include="..\Core\Core.csproj" />
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Core.Main;
|
using Core.Main;
|
||||||
using Core.Main.DataObjects;
|
using Core.Main.DataObjects;
|
||||||
using Core.Main.DataObjects.PTMagicData;
|
|
||||||
using Core.MarketAnalyzer;
|
|
||||||
|
|
||||||
namespace Monitor.Pages {
|
namespace Monitor.Pages {
|
||||||
public class DashboardTopModel : _Internal.BasePageModelSecureAJAX {
|
public class DashboardTopModel : _Internal.BasePageModelSecureAJAX {
|
||||||
|
|
|
@ -4,8 +4,6 @@ using System.Security.Permissions;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Core.Main;
|
using Core.Main;
|
||||||
using Core.Helper;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
namespace Monitor
|
namespace Monitor
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,9 +3,9 @@ using System.IO;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Diagnostics;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
using Core.Main;
|
using Core.Main;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
@ -41,16 +41,9 @@ namespace Monitor
|
||||||
ptMagicBasePath += Path.DirectorySeparatorChar;
|
ptMagicBasePath += Path.DirectorySeparatorChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
systemConfiguration = new PTMagicConfiguration(ptMagicBasePath);
|
systemConfiguration = new PTMagicConfiguration(ptMagicBasePath);
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
|
|
||||||
services.AddMvc();
|
services.AddMvc(option => option.EnableEndpointRouting = false);
|
||||||
services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN");
|
services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN");
|
||||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||||
services.AddDistributedMemoryCache();
|
services.AddDistributedMemoryCache();
|
||||||
|
@ -60,13 +53,18 @@ namespace Monitor
|
||||||
options.Cookie.HttpOnly = true;
|
options.Cookie.HttpOnly = true;
|
||||||
options.Cookie.Name = "PTMagicMonitor" + systemConfiguration.GeneralSettings.Monitor.Port.ToString();
|
options.Cookie.Name = "PTMagicMonitor" + systemConfiguration.GeneralSettings.Monitor.Port.ToString();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
services.Configure<KestrelServerOptions>(options =>
|
||||||
|
{
|
||||||
|
options.AllowSynchronousIO = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
// Register global exception handler
|
// Register global exception handler
|
||||||
if (env.IsDevelopment())
|
if (env.EnvironmentName == "Development")
|
||||||
{
|
{
|
||||||
app.UseBrowserLink();
|
app.UseBrowserLink();
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
|
@ -79,7 +77,7 @@ namespace Monitor
|
||||||
// Configure request pipeline
|
// Configure request pipeline
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.UseSession();
|
app.UseSession();
|
||||||
app.UseMvc();
|
app.UseMvcWithDefaultRoute();
|
||||||
|
|
||||||
// Open the browser
|
// Open the browser
|
||||||
if (systemConfiguration.GeneralSettings.Monitor.OpenBrowserOnStart) OpenBrowser("http://localhost:" + systemConfiguration.GeneralSettings.Monitor.Port.ToString());
|
if (systemConfiguration.GeneralSettings.Monitor.OpenBrowserOnStart) OpenBrowser("http://localhost:" + systemConfiguration.GeneralSettings.Monitor.Port.ToString());
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
@ -5,7 +5,7 @@ using System.Security.Permissions;
|
||||||
using Core.Helper;
|
using Core.Helper;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("2.2.10")]
|
[assembly: AssemblyVersion("3.0.0")]
|
||||||
[assembly: AssemblyProduct("PT Magic")]
|
[assembly: AssemblyProduct("PT Magic")]
|
||||||
|
|
||||||
namespace PTMagic
|
namespace PTMagic
|
||||||
|
|
Loading…
Reference in New Issue