diff --git a/src/ZonyLrcTools.Cli/Commands/UtilityCommand.cs b/src/ZonyLrcTools.Cli/Commands/UtilityCommand.cs index c3b0996..1a38ee4 100644 --- a/src/ZonyLrcTools.Cli/Commands/UtilityCommand.cs +++ b/src/ZonyLrcTools.Cli/Commands/UtilityCommand.cs @@ -87,10 +87,12 @@ namespace ZonyLrcTools.Cli.Commands var buffer = new Memory(new byte[2048]); while (await file.ReadAsync(buffer) > 0) { + // TODO: Large Object Issue!!!!! await memoryStream.WriteAsync(buffer); } } + // TODO: Large Object Issue!!!!! var result = await _musicDecryptor.ConvertMusic(memoryStream.ToArray()); var newFileName = Path.Combine(Path.GetDirectoryName(filePath), $"{Path.GetFileNameWithoutExtension(filePath)}.{((JObject) result.ExtensionObjects["JSON"]).SelectToken("$.format").Value()}"); diff --git a/src/ZonyLrcTools.Cli/Infrastructure/MusicInfo.cs b/src/ZonyLrcTools.Cli/Infrastructure/MusicInfo.cs index 04a9bd7..12cf680 100644 --- a/src/ZonyLrcTools.Cli/Infrastructure/MusicInfo.cs +++ b/src/ZonyLrcTools.Cli/Infrastructure/MusicInfo.cs @@ -13,12 +13,12 @@ namespace ZonyLrcTools.Cli.Infrastructure /// /// 歌曲的名称。 /// - public string Name { get; } + public string Name { get; set; } /// /// 歌曲的作者。 /// - public string Artist { get; } + public string Artist { get; set; } /// /// 构建一个新的 对象。 diff --git a/src/ZonyLrcTools.Cli/Infrastructure/Tag/DefaultTagLoader.cs b/src/ZonyLrcTools.Cli/Infrastructure/Tag/DefaultTagLoader.cs index ee7466f..bf3ce61 100644 --- a/src/ZonyLrcTools.Cli/Infrastructure/Tag/DefaultTagLoader.cs +++ b/src/ZonyLrcTools.Cli/Infrastructure/Tag/DefaultTagLoader.cs @@ -1,6 +1,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.Extensions.Options; +using ZonyLrcTools.Cli.Config; using ZonyLrcTools.Cli.Infrastructure.DependencyInject; using ZonyLrcTools.Cli.Infrastructure.Exceptions; @@ -12,10 +14,16 @@ namespace ZonyLrcTools.Cli.Infrastructure.Tag public class DefaultTagLoader : ITagLoader, ITransientDependency { protected readonly IEnumerable TagInfoProviders; + protected readonly IBlockWordDictionary BlockWordDictionary; + protected ToolOptions Options; - public DefaultTagLoader(IEnumerable tagInfoProviders) + public DefaultTagLoader(IEnumerable tagInfoProviders, + IBlockWordDictionary blockWordDictionary, + IOptions options) { TagInfoProviders = tagInfoProviders; + BlockWordDictionary = blockWordDictionary; + Options = options.Value; } public virtual async ValueTask LoadTagAsync(string filePath) @@ -30,11 +38,21 @@ namespace ZonyLrcTools.Cli.Infrastructure.Tag var info = await provider.LoadAsync(filePath); if (info != null) { + HandleBlockWord(info); return info; } } return null; } + + protected void HandleBlockWord(MusicInfo info) + { + if (Options.BlockWordOptions.IsEnable) + { + info.Name = BlockWordDictionary.GetValue(info.Name) ?? info.Name; + info.Artist = BlockWordDictionary.GetValue(info.Name) ?? info.Artist; + } + } } } \ No newline at end of file