.Net Core 3.1 Upgrade

This commit is contained in:
djbadders 2019-12-09 23:21:27 +00:00
parent 1c8a4b1c8a
commit 7342aee296
10 changed files with 34 additions and 43 deletions

4
.vscode/launch.json vendored
View File

@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "VS build PTMagic",
// 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": [],
"cwd": "${workspaceFolder}/PTMagic",
"stopAtEntry": false,
@ -28,7 +28,7 @@
"request": "launch",
"preLaunchTask": "VS build Monitor",
// 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": [],
"cwd": "${workspaceFolder}/Monitor",
"stopAtEntry": false,

View File

@ -1,23 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NLog" Version="4.5.10" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.3.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NLog" Version="4.6.8" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.6.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.0" />
<PackageReference Include="SharpZipLib" Version="*" />
<PackageReference Include="Telegram.Bot" Version="*" />
</ItemGroup>
<ItemGroup>
</ItemGroup>
</Project>

View File

@ -36,7 +36,6 @@ namespace Core.Main
private DateTime _lastSettingFileCheck = Constants.confMinDate;
private DateTime _lastVersionCheck = Constants.confMinDate;
private DateTime _lastFiatCurrencyCheck = Constants.confMinDate;
private string _lastSetting = "";
private string _activeSettingName = "";
private GlobalSetting _activeSetting = null;
private string _defaultSettingName = "";

View File

@ -26,13 +26,14 @@ namespace Core.MarketAnalyzer
request.ContentType = "application/json";
request.UserAgent = "PTMagic.Import";
request.KeepAlive = true;
request.Timeout = 60000;
request.Timeout = 10000;
HttpWebResponse httpResponse = null;
string jsonString = string.Empty;
try
{
log.DoLogInfo("Calling URL: " + url);
httpResponse = (HttpWebResponse)request.GetResponse();
using (StreamReader jsonReader = new StreamReader(httpResponse.GetResponseStream()))
@ -73,6 +74,11 @@ namespace Core.MarketAnalyzer
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)

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<!--<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>-->
</PropertyGroup>
<ItemGroup>
@ -23,10 +23,8 @@
<None Include="nlog.config" CopyToOutputDirectory="Always" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.5.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.1.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj" />

View File

@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Core.Main;
using Core.Main.DataObjects;
using Core.Main.DataObjects.PTMagicData;
using Core.MarketAnalyzer;
namespace Monitor.Pages {
public class DashboardTopModel : _Internal.BasePageModelSecureAJAX {

View File

@ -4,8 +4,6 @@ using System.Security.Permissions;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Core.Main;
using Core.Helper;
using Microsoft.Extensions.DependencyInjection;
namespace Monitor
{

View File

@ -3,9 +3,9 @@ using System.IO;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Core.Main;
using System.Runtime.InteropServices;
using System.Diagnostics;
@ -41,16 +41,9 @@ namespace Monitor
ptMagicBasePath += Path.DirectorySeparatorChar;
}
try
{
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.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddDistributedMemoryCache();
@ -60,13 +53,18 @@ namespace Monitor
options.Cookie.HttpOnly = true;
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.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// Register global exception handler
if (env.IsDevelopment())
if (env.EnvironmentName == "Development")
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
@ -79,7 +77,7 @@ namespace Monitor
// Configure request pipeline
app.UseStaticFiles();
app.UseSession();
app.UseMvc();
app.UseMvcWithDefaultRoute();
// Open the browser
if (systemConfiguration.GeneralSettings.Monitor.OpenBrowserOnStart) OpenBrowser("http://localhost:" + systemConfiguration.GeneralSettings.Monitor.Port.ToString());

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<PropertyGroup>

View File

@ -5,7 +5,7 @@ using System.Security.Permissions;
using Core.Helper;
using Microsoft.Extensions.DependencyInjection;
[assembly: AssemblyVersion("2.2.10")]
[assembly: AssemblyVersion("3.0.0")]
[assembly: AssemblyProduct("PT Magic")]
namespace PTMagic