Skip to content

Commit

Permalink
Merge pull request #179 from p-kostov/master
Browse files Browse the repository at this point in the history
updated dependencies and .NET version
  • Loading branch information
o-ivanov committed Dec 22, 2022
2 parents eb4c643 + d6894e6 commit d1ce56b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 18 deletions.
10 changes: 5 additions & 5 deletions ErpNet.FP.Core/ErpNet.FP.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="System.IO.Ports" Version="5.0.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="System.IO.Ports" Version="7.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
</ItemGroup>

<ProjectExtensions><VisualStudio><UserProperties BuildVersion_StartDate="2000/1/1" /></VisualStudio></ProjectExtensions>
Expand Down
6 changes: 6 additions & 0 deletions ErpNet.FP.Core/Transports/ComTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ public void Write(byte[] data)
{
idleTimer.Change(-1, 0);
Open();

if (serialPort == null)
{
throw new FileNotFoundException("Can't write to an unavailable serial port!");
}

serialPort.DiscardInBuffer();
var bytesToWrite = data.Length;
while (bytesToWrite > 0)
Expand Down
7 changes: 6 additions & 1 deletion ErpNet.FP.Server/Configuration/WritableOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ public class WritableOptions<T> : IWritableOptions<T> where T : class, new()
}

public T Value => options.CurrentValue;
public T Get(string name) => options.Get(name);
public T Get(string? name) => options.Get(name);

public void Update(Action<T> applyChanges)
{
var fileProvider = environment.ContentRootFileProvider;
var fileInfo = fileProvider.GetFileInfo(file);
var physicalPath = fileInfo.PhysicalPath;

if (string.IsNullOrEmpty(physicalPath))
{
throw new IOException("Invalid file path.");
}

var jObject = JsonConvert.DeserializeObject<JObject>(File.ReadAllText(physicalPath));
if (jObject != null)
{
Expand Down
20 changes: 10 additions & 10 deletions ErpNet.FP.Server/ErpNet.FP.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<AssemblyName>ErpNet.FP.Server</AssemblyName>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ApplicationIcon>ErpNet.FP.ico</ApplicationIcon>
</PropertyGroup>

Expand Down Expand Up @@ -34,15 +34,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.5" Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="3.1.5" Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="3.1.5" Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="7.0.0" Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions ErpNet.FP.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ public class Program
options.AllowSynchronousIO = true;
options.Limits.MaxRequestBodySize = 500 * 1024;
})
.UseStartup<Startup>()
.UseSerilog();
.UseStartup<Startup>();
});

public static void EnsureAppSettingsJson(string pathToContentRoot)
Expand Down Expand Up @@ -163,6 +162,7 @@ public static int Main(string[] args)
var builder = CreateHostBuilder(
pathToContentRoot,
args.Where(arg => arg != "--console").ToArray());
builder.UseSerilog();

var host = builder.Build();

Expand Down

0 comments on commit d1ce56b

Please sign in to comment.