diff --git a/AssFontSubset.Console/Program.cs b/AssFontSubset.Console/Program.cs index 761762b..090d870 100644 --- a/AssFontSubset.Console/Program.cs +++ b/AssFontSubset.Console/Program.cs @@ -46,7 +46,13 @@ static void Subset(FileInfo[] path, DirectoryInfo? fontPath, DirectoryInfo? outp { // \u001b[31m => Red(ANSI Escape Code) // \u001b[0m => Reset - var escapeSequence = info.LogLevel >= LogLevel.Error? "\u001b[31m" : "\u001b[0m"; + var escapeSequence = info.LogLevel switch + { + LogLevel.Warning => "\u001b[33m", + > LogLevel.Warning => "\u001b[31m", + _ => "\u001b[0m", + }; + template.Format(escapeSequence, info.Timestamp, info.LogLevel); }); diff --git a/AssFontSubset.Core/AssFontSubset.Core.csproj b/AssFontSubset.Core/AssFontSubset.Core.csproj index 291f346..082e474 100644 --- a/AssFontSubset.Core/AssFontSubset.Core.csproj +++ b/AssFontSubset.Core/AssFontSubset.Core.csproj @@ -6,7 +6,7 @@ - + diff --git a/AssFontSubset.Core/src/AssFont.cs b/AssFontSubset.Core/src/AssFont.cs index 9c43d63..f992b5c 100644 --- a/AssFontSubset.Core/src/AssFont.cs +++ b/AssFontSubset.Core/src/AssFont.cs @@ -1,4 +1,5 @@ -using Mobsub.SubtitleParse; +using Microsoft.Extensions.Logging; +using Mobsub.SubtitleParse; using Mobsub.SubtitleParse.AssTypes; using System.Text; @@ -6,9 +7,9 @@ namespace AssFontSubset.Core; public class AssFont { - public static Dictionary> GetAssFonts(string file, out AssData ass) + public static Dictionary> GetAssFonts(string file, out AssData ass, ILogger? logger = null) { - ass = new AssData(); + ass = new AssData(logger); ass.ReadAssFile(file); var usedStyles = GetUsedStyles(ass.Events.Collection); diff --git a/AssFontSubset.Core/src/SubsetByPyFT.cs b/AssFontSubset.Core/src/SubsetByPyFT.cs index 72a36c3..9d7a081 100644 --- a/AssFontSubset.Core/src/SubsetByPyFT.cs +++ b/AssFontSubset.Core/src/SubsetByPyFT.cs @@ -131,9 +131,9 @@ Dictionary> GetAssFontInfoFromFiles(FileInfo[] assFiles, foreach (var assFile in assFiles) { - _logger?.ZLogInformation($"{assFile.FullName}"); + //_logger?.ZLogInformation($"{assFile.FullName}"); var assFileNew = Path.Combine(optDir, assFile.Name); - var assFonts = AssFont.GetAssFonts(assFile.FullName, out var ass); + var assFonts = AssFont.GetAssFonts(assFile.FullName, out var ass, _logger); foreach (var kv in assFonts) { diff --git a/AssFontSubset.sln b/AssFontSubset.sln index e06c4a5..9a420bd 100644 --- a/AssFontSubset.sln +++ b/AssFontSubset.sln @@ -9,7 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssFontSubset.Core", "AssFo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssFontSubset.Avalonia", "AssFontSubset.Avalonia\AssFontSubset.Avalonia.csproj", "{228541CF-C1A6-48C5-8B60-95538E049C25}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssFontSubset.Core.Tests", "AssFontSubset.CoreTests\AssFontSubset.Core.Tests.csproj", "{E003AA3B-7C95-4FA3-AB7D-529B71BBD85D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssFontSubset.Core.Tests", "AssFontSubset.CoreTests\AssFontSubset.Core.Tests.csproj", "{E003AA3B-7C95-4FA3-AB7D-529B71BBD85D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution