Update to .NET 6

This commit is contained in:
genteure 2022-04-02 18:49:23 +08:00
parent 411e25f06d
commit 30a659f4d2
11 changed files with 41 additions and 21 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<StartupObject>BililiveRecorder.Cli.Program</StartupObject> <StartupObject>BililiveRecorder.Cli.Program</StartupObject>
<RuntimeIdentifiers>win-x64;osx-x64;osx.10.11-x64;linux-arm64;linux-arm;linux-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;osx-x64;osx.10.11-x64;linux-arm64;linux-arm;linux-x64</RuntimeIdentifiers>
<RuntimeIdentifier Condition=" '$(RuntimeIdentifier)' == 'any' "></RuntimeIdentifier> <RuntimeIdentifier Condition=" '$(RuntimeIdentifier)' == 'any' "></RuntimeIdentifier>
@ -19,8 +19,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Serilog" Version="2.10.0" /> <PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.2" /> <PackageReference Include="Serilog.Enrichers.Process" Version="2.0.2" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" /> <PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />

View File

@ -10,7 +10,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="JsonSubTypes" Version="1.8.0" /> <PackageReference Include="JsonSubTypes" Version="1.8.0" />
<PackageReference Include="HierarchicalPropertyDefault" Version="0.1.4-beta-g75fdf624b1" /> <PackageReference Include="HierarchicalPropertyDefault" Version="0.1.4-beta-g75fdf624b1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.0" /> <PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.0" />
<PackageReference Include="Nerdbank.Streams" Version="2.8.54" /> <PackageReference Include="Nerdbank.Streams" Version="2.8.54" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
@ -18,7 +18,7 @@
<PackageReference Include="Polly.Caching.Memory" Version="3.0.2" /> <PackageReference Include="Polly.Caching.Memory" Version="3.0.2" />
<PackageReference Include="Serilog" Version="2.10.0" /> <PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="StructLinq" Version="0.27.0" /> <PackageReference Include="StructLinq" Version="0.27.0" />
<PackageReference Include="System.IO.Pipelines" Version="5.0.1" /> <PackageReference Include="System.IO.Pipelines" Version="6.0.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -11,7 +11,7 @@
<PackageReference Include="FastHashes" Version="2.4.0" /> <PackageReference Include="FastHashes" Version="2.4.0" />
<PackageReference Include="JsonSubTypes" Version="1.8.0" /> <PackageReference Include="JsonSubTypes" Version="1.8.0" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" /> <PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Nullable" Version="1.3.0"> <PackageReference Include="Nullable" Version="1.3.0">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
@ -19,7 +19,7 @@
</PackageReference> </PackageReference>
<PackageReference Include="Serilog" Version="2.10.0" /> <PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="StructLinq" Version="0.27.0" /> <PackageReference Include="StructLinq" Version="0.27.0" />
<PackageReference Include="System.IO.Pipelines" Version="5.0.1" /> <PackageReference Include="System.IO.Pipelines" Version="6.0.2" />
<PackageReference Include="System.Memory" Version="4.5.4" /> <PackageReference Include="System.Memory" Version="4.5.4" />
</ItemGroup> </ItemGroup>

View File

@ -5,7 +5,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.0" /> <PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.0" />
<PackageReference Include="Spectre.Console" Version="0.43.0" /> <PackageReference Include="Spectre.Console" Version="0.43.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.21308.1" /> <PackageReference Include="System.CommandLine" Version="2.0.0-beta1.21308.1" />

View File

@ -3,8 +3,10 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml;
using BililiveRecorder.Flv; using BililiveRecorder.Flv;
using BililiveRecorder.Flv.Parser; using BililiveRecorder.Flv.Parser;
using BililiveRecorder.Flv.Xml; using BililiveRecorder.Flv.Xml;
@ -91,7 +93,12 @@ namespace BililiveRecorder.ToolBox.Tool.Export
await Task.Run(() => await Task.Run(() =>
{ {
using var writer = new StreamWriter(new GZipStream(outputStream, CompressionLevel.Optimal)); using var writer = XmlWriter.Create(new GZipStream(outputStream, CompressionLevel.Optimal), new()
{
Encoding = Encoding.UTF8,
Indent = true
});
XmlFlvFile.Serializer.Serialize(writer, new XmlFlvFile XmlFlvFile.Serializer.Serialize(writer, new XmlFlvFile
{ {
Tags = tags, Tags = tags,

View File

@ -4,8 +4,10 @@ using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml;
using BililiveRecorder.Flv; using BililiveRecorder.Flv;
using BililiveRecorder.Flv.Grouping; using BililiveRecorder.Flv.Grouping;
using BililiveRecorder.Flv.Parser; using BililiveRecorder.Flv.Parser;
@ -147,7 +149,12 @@ namespace BililiveRecorder.ToolBox.Tool.Fix
{ {
var path = Path.ChangeExtension(request.OutputBase, $"fix_p{i + 1:D3}.brec.xml"); var path = Path.ChangeExtension(request.OutputBase, $"fix_p{i + 1:D3}.brec.xml");
outputPaths.Add(path); outputPaths.Add(path);
using var file = new StreamWriter(File.Create(path));
using var file = XmlWriter.Create(File.Create(path), new()
{
Encoding = Encoding.UTF8,
Indent = true
});
XmlFlvFile.Serializer.Serialize(file, new XmlFlvFile { Tags = w.Files[i] }); XmlFlvFile.Serializer.Serialize(file, new XmlFlvFile { Tags = w.Files[i] });
} }

View File

@ -338,10 +338,10 @@
<Version>1.1.0</Version> <Version>1.1.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection"> <PackageReference Include="Microsoft.Extensions.DependencyInjection">
<Version>5.0.2</Version> <Version>6.0.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions"> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions">
<Version>5.0.0</Version> <Version>6.0.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="ModernWpfUI"> <PackageReference Include="ModernWpfUI">
<Version>0.9.4</Version> <Version>0.9.4</Version>
@ -350,7 +350,7 @@
<Version>13.0.1</Version> <Version>13.0.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="NuGet.CommandLine"> <PackageReference Include="NuGet.CommandLine">
<Version>5.9.1</Version> <Version>6.0.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>

View File

@ -1,6 +1,6 @@
{ {
"sdk": { "sdk": {
"version": "5.0.100", "version": "6.0.100",
"rollForward": "latestMajor" "rollForward": "latestMajor"
} }
} }

View File

@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@ -1,16 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" /> <PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.0" /> <PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="Spectre.Verify.Extensions" Version="0.5.0" /> <PackageReference Include="Spectre.Verify.Extensions" Version="0.5.0" />
<PackageReference Include="Verify.Xunit" Version="13.3.1" /> <PackageReference Include="Verify.Xunit" Version="13.3.1" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit" Version="2.4.1" />

View File

@ -1,5 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Xml;
using BililiveRecorder.Flv.Xml; using BililiveRecorder.Flv.Xml;
namespace BililiveRecorder.Flv.Tests namespace BililiveRecorder.Flv.Tests
@ -9,7 +10,13 @@ namespace BililiveRecorder.Flv.Tests
public static string SerializeXml(this List<Tag> tags) public static string SerializeXml(this List<Tag> tags)
{ {
using var sw = new StringWriter(); using var sw = new StringWriter();
XmlFlvFile.Serializer.Serialize(sw, new XmlFlvFile { Tags = tags }); using var writer = XmlWriter.Create(sw, new()
{
Indent = true
});
XmlFlvFile.Serializer.Serialize(writer, new XmlFlvFile { Tags = tags });
writer.Flush();
return sw.ToString(); return sw.ToString();
} }
} }