From 30a659f4d205df22462cff4a215b54b818ed185a Mon Sep 17 00:00:00 2001 From: genteure Date: Sat, 2 Apr 2022 18:49:23 +0800 Subject: [PATCH] Update to .NET 6 --- BililiveRecorder.Cli/BililiveRecorder.Cli.csproj | 6 +++--- BililiveRecorder.Core/BililiveRecorder.Core.csproj | 4 ++-- BililiveRecorder.Flv/BililiveRecorder.Flv.csproj | 4 ++-- BililiveRecorder.ToolBox/BililiveRecorder.ToolBox.csproj | 2 +- BililiveRecorder.ToolBox/Tool/Export/ExportHandler.cs | 9 ++++++++- BililiveRecorder.ToolBox/Tool/Fix/FixHandler.cs | 9 ++++++++- BililiveRecorder.WPF/BililiveRecorder.WPF.csproj | 6 +++--- global.json | 2 +- .../BililiveRecorder.Core.UnitTests.csproj | 4 ++-- .../BililiveRecorder.Flv.Tests.csproj | 7 +++---- test/BililiveRecorder.Flv.Tests/TestTagsExtensions.cs | 9 ++++++++- 11 files changed, 41 insertions(+), 21 deletions(-) diff --git a/BililiveRecorder.Cli/BililiveRecorder.Cli.csproj b/BililiveRecorder.Cli/BililiveRecorder.Cli.csproj index ce058c9..3a253d1 100644 --- a/BililiveRecorder.Cli/BililiveRecorder.Cli.csproj +++ b/BililiveRecorder.Cli/BililiveRecorder.Cli.csproj @@ -2,7 +2,7 @@ Exe - net5.0 + net6.0 BililiveRecorder.Cli.Program win-x64;osx-x64;osx.10.11-x64;linux-arm64;linux-arm;linux-x64 @@ -19,8 +19,8 @@ - - + + diff --git a/BililiveRecorder.Core/BililiveRecorder.Core.csproj b/BililiveRecorder.Core/BililiveRecorder.Core.csproj index 7a797c1..3a54e3f 100644 --- a/BililiveRecorder.Core/BililiveRecorder.Core.csproj +++ b/BililiveRecorder.Core/BililiveRecorder.Core.csproj @@ -10,7 +10,7 @@ - + @@ -18,7 +18,7 @@ - + diff --git a/BililiveRecorder.Flv/BililiveRecorder.Flv.csproj b/BililiveRecorder.Flv/BililiveRecorder.Flv.csproj index c2deeae..90f24d4 100644 --- a/BililiveRecorder.Flv/BililiveRecorder.Flv.csproj +++ b/BililiveRecorder.Flv/BililiveRecorder.Flv.csproj @@ -11,7 +11,7 @@ - + all @@ -19,7 +19,7 @@ - + diff --git a/BililiveRecorder.ToolBox/BililiveRecorder.ToolBox.csproj b/BililiveRecorder.ToolBox/BililiveRecorder.ToolBox.csproj index 6806680..8ddbfce 100644 --- a/BililiveRecorder.ToolBox/BililiveRecorder.ToolBox.csproj +++ b/BililiveRecorder.ToolBox/BililiveRecorder.ToolBox.csproj @@ -5,7 +5,7 @@ - + diff --git a/BililiveRecorder.ToolBox/Tool/Export/ExportHandler.cs b/BililiveRecorder.ToolBox/Tool/Export/ExportHandler.cs index ad29d24..8fc6091 100644 --- a/BililiveRecorder.ToolBox/Tool/Export/ExportHandler.cs +++ b/BililiveRecorder.ToolBox/Tool/Export/ExportHandler.cs @@ -3,8 +3,10 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.IO.Pipelines; +using System.Text; using System.Threading; using System.Threading.Tasks; +using System.Xml; using BililiveRecorder.Flv; using BililiveRecorder.Flv.Parser; using BililiveRecorder.Flv.Xml; @@ -91,7 +93,12 @@ namespace BililiveRecorder.ToolBox.Tool.Export 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 { Tags = tags, diff --git a/BililiveRecorder.ToolBox/Tool/Fix/FixHandler.cs b/BililiveRecorder.ToolBox/Tool/Fix/FixHandler.cs index 35194f4..da6c7f4 100644 --- a/BililiveRecorder.ToolBox/Tool/Fix/FixHandler.cs +++ b/BililiveRecorder.ToolBox/Tool/Fix/FixHandler.cs @@ -4,8 +4,10 @@ using System.IO; using System.IO.Compression; using System.IO.Pipelines; using System.Linq; +using System.Text; using System.Threading; using System.Threading.Tasks; +using System.Xml; using BililiveRecorder.Flv; using BililiveRecorder.Flv.Grouping; 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"); 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] }); } diff --git a/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj b/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj index 6e280b4..bd27933 100644 --- a/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj +++ b/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj @@ -338,10 +338,10 @@ 1.1.0 - 5.0.2 + 6.0.0 - 5.0.0 + 6.0.0 0.9.4 @@ -350,7 +350,7 @@ 13.0.1 - 5.9.1 + 6.0.0 runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/global.json b/global.json index 22ddf7c..126149e 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.100", + "version": "6.0.100", "rollForward": "latestMajor" } } diff --git a/test/BililiveRecorder.Core.UnitTests/BililiveRecorder.Core.UnitTests.csproj b/test/BililiveRecorder.Core.UnitTests/BililiveRecorder.Core.UnitTests.csproj index ae1f965..f067eae 100644 --- a/test/BililiveRecorder.Core.UnitTests/BililiveRecorder.Core.UnitTests.csproj +++ b/test/BililiveRecorder.Core.UnitTests/BililiveRecorder.Core.UnitTests.csproj @@ -1,14 +1,14 @@ - net5.0 + net6.0 9.0 enable false - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/BililiveRecorder.Flv.Tests/BililiveRecorder.Flv.Tests.csproj b/test/BililiveRecorder.Flv.Tests/BililiveRecorder.Flv.Tests.csproj index 4209d37..f8822fe 100644 --- a/test/BililiveRecorder.Flv.Tests/BililiveRecorder.Flv.Tests.csproj +++ b/test/BililiveRecorder.Flv.Tests/BililiveRecorder.Flv.Tests.csproj @@ -1,16 +1,15 @@ - net5.0 - + net6.0 false - + - + diff --git a/test/BililiveRecorder.Flv.Tests/TestTagsExtensions.cs b/test/BililiveRecorder.Flv.Tests/TestTagsExtensions.cs index 34ffce2..2fdf94a 100644 --- a/test/BililiveRecorder.Flv.Tests/TestTagsExtensions.cs +++ b/test/BililiveRecorder.Flv.Tests/TestTagsExtensions.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.IO; +using System.Xml; using BililiveRecorder.Flv.Xml; namespace BililiveRecorder.Flv.Tests @@ -9,7 +10,13 @@ namespace BililiveRecorder.Flv.Tests public static string SerializeXml(this List tags) { 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(); } }