整理代码

yangw
nodyang@aliyun.com 2 months ago
parent 6f72742434
commit 66869df649

@ -32,13 +32,13 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Chloe"> <PackageReference Include="Chloe">
<Version>5.33.0</Version> <Version>5.38.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Chloe.Extension"> <PackageReference Include="Chloe.Extension">
<Version>5.33.0</Version> <Version>5.38.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Chloe.PostgreSQL"> <PackageReference Include="Chloe.PostgreSQL">
<Version>5.33.0</Version> <Version>5.38.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces"> <PackageReference Include="Microsoft.Bcl.AsyncInterfaces">
<Version>8.0.0</Version> <Version>8.0.0</Version>
@ -47,13 +47,13 @@
<Version>1.1.1</Version> <Version>1.1.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions"> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions">
<Version>8.0.0</Version> <Version>8.0.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions"> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions">
<Version>8.0.0</Version> <Version>8.0.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Npgsql"> <PackageReference Include="Npgsql">
<Version>8.0.3</Version> <Version>8.0.4</Version>
</PackageReference> </PackageReference>
<Reference Include="System" /> <Reference Include="System" />
<PackageReference Include="System.Buffers"> <PackageReference Include="System.Buffers">
@ -64,7 +64,7 @@
</PackageReference> </PackageReference>
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<PackageReference Include="System.Diagnostics.DiagnosticSource"> <PackageReference Include="System.Diagnostics.DiagnosticSource">
<Version>8.0.0</Version> <Version>8.0.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="System.Memory"> <PackageReference Include="System.Memory">
<Version>4.5.5</Version> <Version>4.5.5</Version>
@ -80,7 +80,7 @@
<Version>8.0.0</Version> <Version>8.0.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="System.Text.Json"> <PackageReference Include="System.Text.Json">
<Version>8.0.0</Version> <Version>8.0.4</Version>
</PackageReference> </PackageReference>
<PackageReference Include="System.Threading.Channels"> <PackageReference Include="System.Threading.Channels">
<Version>8.0.0</Version> <Version>8.0.0</Version>

@ -1,4 +1,6 @@
using System; using HslCommunication.LogNet;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@ -14,11 +16,26 @@ namespace RfidWeb
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
private ILogNet logNet = ILogNetFactory.GetLogNet;
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
logNet.ConsoleOutput = true;
logNet.WriteInfo("nihao");
// 如果所有的日志在记录之前需要在控制台显示出来
logNet.BeforeSaveToFile += (object sender, HslEventArgs e) =>
{
Console.WriteLine(e.HslMessage.ToString());
};
} }
} }
} }

@ -33,15 +33,15 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Chloe, Version=5.33.0.0, Culture=neutral, processorArchitecture=MSIL"> <PackageReference Include="Chloe">
<HintPath>..\packages\Chloe.5.33.0\lib\net46\Chloe.dll</HintPath> <Version>5.38.0</Version>
</Reference> </PackageReference>
<Reference Include="Chloe.Extension, Version=5.33.0.0, Culture=neutral, processorArchitecture=MSIL"> <PackageReference Include="Chloe.Extension">
<HintPath>..\packages\Chloe.Extension.5.33.0\lib\net46\Chloe.Extension.dll</HintPath> <Version>5.38.0</Version>
</Reference> </PackageReference>
<Reference Include="Chloe.PostgreSQL, Version=5.33.0.0, Culture=neutral, processorArchitecture=MSIL"> <PackageReference Include="Chloe.PostgreSQL">
<HintPath>..\packages\Chloe.PostgreSQL.5.33.0\lib\net46\Chloe.PostgreSQL.dll</HintPath> <Version>5.38.0</Version>
</Reference> </PackageReference>
<Reference Include="HslCommunication, Version=12.1.0.0, Culture=neutral, PublicKeyToken=3d72ad3b6b5ec0e3, processorArchitecture=MSIL"> <Reference Include="HslCommunication, Version=12.1.0.0, Culture=neutral, PublicKeyToken=3d72ad3b6b5ec0e3, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\Src\HslCommunication.dll</HintPath> <HintPath>..\Src\HslCommunication.dll</HintPath>
@ -49,66 +49,63 @@
<Reference Include="HslControls"> <Reference Include="HslControls">
<HintPath>..\Src\HslControls.dll</HintPath> <HintPath>..\Src\HslControls.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <PackageReference Include="Microsoft.Bcl.AsyncInterfaces">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath> <Version>8.0.0</Version>
</Reference> </PackageReference>
<Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <PackageReference Include="Microsoft.Bcl.HashCode">
<HintPath>..\packages\Microsoft.Bcl.HashCode.1.1.1\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath> <Version>1.1.1</Version>
</Reference> </PackageReference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath> <Version>8.0.1</Version>
</Reference> </PackageReference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath> <Version>8.0.1</Version>
</Reference> </PackageReference>
<Reference Include="Microsoft.VisualBasic" /> <Reference Include="Microsoft.VisualBasic" />
<Reference Include="NewLife.Core, Version=10.10.2024.902, Culture=neutral, PublicKeyToken=8343210f0b524456, processorArchitecture=MSIL"> <PackageReference Include="Newtonsoft.Json">
<HintPath>..\packages\NewLife.Core.10.10.2024.902\lib\net461\NewLife.Core.dll</HintPath> <Version>13.0.3</Version>
</Reference> </PackageReference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <PackageReference Include="Npgsql">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> <Version>8.0.4</Version>
</Reference> </PackageReference>
<Reference Include="Npgsql, Version=8.0.3.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL">
<HintPath>..\packages\Npgsql.8.0.3\lib\netstandard2.0\Npgsql.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <PackageReference Include="System.Buffers">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath> <Version>4.5.1</Version>
</Reference> </PackageReference>
<Reference Include="System.Collections.Immutable, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <PackageReference Include="System.Collections.Immutable">
<HintPath>..\packages\System.Collections.Immutable.8.0.0\lib\net462\System.Collections.Immutable.dll</HintPath> <Version>8.0.0</Version>
</Reference> </PackageReference>
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <PackageReference Include="System.Diagnostics.DiagnosticSource">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.0\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath> <Version>8.0.1</Version>
</Reference> </PackageReference>
<Reference Include="System.IO.Compression" /> <Reference Include="System.IO.Compression" />
<Reference Include="System.Management" /> <Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <PackageReference Include="System.Memory">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath> <Version>4.5.5</Version>
</Reference> </PackageReference>
<Reference Include="System.Numerics" /> <Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <PackageReference Include="System.Numerics.Vectors">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath> <Version>4.5.0</Version>
</Reference> </PackageReference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <PackageReference Include="System.Runtime.CompilerServices.Unsafe">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath> <Version>6.0.0</Version>
</Reference> </PackageReference>
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <PackageReference Include="System.Text.Encodings.Web">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath> <Version>8.0.0</Version>
</Reference> </PackageReference>
<Reference Include="System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <PackageReference Include="System.Text.Json">
<HintPath>..\packages\System.Text.Json.8.0.0\lib\net462\System.Text.Json.dll</HintPath> <Version>8.0.4</Version>
</Reference> </PackageReference>
<Reference Include="System.Threading.Channels, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <PackageReference Include="System.Threading.Channels">
<HintPath>..\packages\System.Threading.Channels.8.0.0\lib\net462\System.Threading.Channels.dll</HintPath> <Version>8.0.0</Version>
</Reference> </PackageReference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <PackageReference Include="System.Threading.Tasks.Extensions">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath> <Version>4.5.4</Version>
</Reference> </PackageReference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <PackageReference Include="System.ValueTuple">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath> <Version>4.5.0</Version>
</Reference> </PackageReference>
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
@ -142,7 +139,6 @@
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Chloe" version="5.33.0" targetFramework="net48" />
<package id="Chloe.Extension" version="5.33.0" targetFramework="net48" />
<package id="Chloe.PostgreSQL" version="5.33.0" targetFramework="net48" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net48" />
<package id="Microsoft.Bcl.HashCode" version="1.1.1" targetFramework="net48" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.0" targetFramework="net48" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.0" targetFramework="net48" />
<package id="NewLife.Core" version="10.10.2024.902" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
<package id="Npgsql" version="8.0.3" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Collections.Immutable" version="8.0.0" targetFramework="net48" />
<package id="System.Diagnostics.DiagnosticSource" version="8.0.0" targetFramework="net48" />
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net48" />
<package id="System.Text.Json" version="8.0.0" targetFramework="net48" />
<package id="System.Threading.Channels" version="8.0.0" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
</packages>

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HslCommunication.LogNet;
namespace Tool
{
public static class ILogNetFactory
{
public static ILogNet GetLogNet { get; }=new LogNetFileSize("D:\\Logs", 2 * 1024 * 1024*20);
}
}

@ -37,10 +37,10 @@
</Reference> </Reference>
<Reference Include="Microsoft.VisualBasic" /> <Reference Include="Microsoft.VisualBasic" />
<PackageReference Include="NewLife.Core"> <PackageReference Include="NewLife.Core">
<Version>10.10.2024.902</Version> <Version>11.0.2024.1001</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Newtonsoft.Json"> <PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version> <Version>13.0.3</Version>
</PackageReference> </PackageReference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -60,6 +60,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="HttpHelper.cs" /> <Compile Include="HttpHelper.cs" />
<Compile Include="ILogNetFactory.cs" />
<Compile Include="RfidSetting.cs" /> <Compile Include="RfidSetting.cs" />
<Compile Include="PlcConnect.cs" /> <Compile Include="PlcConnect.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

Loading…
Cancel
Save