Skip to content

Commit

Permalink
解决没有图片时错误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Mapaler committed Mar 31, 2022
1 parent d520a0d commit 5cb47ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Audi MMI MP3 Cover Repair/Audi MMI MP3 Cover Repair.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ApplicationIcon>Properties\aodi.ico</ApplicationIcon>
<AssemblyVersion>1.0.1.0</AssemblyVersion>
<AssemblyVersion>1.0.2.0</AssemblyVersion>
<Authors>Mapaler</Authors>
<Description>修复奥迪汽车MP3歌曲封面 </Description>
</PropertyGroup>
Expand Down
12 changes: 10 additions & 2 deletions Audi MMI MP3 Cover Repair/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
}
}

uint currentIndex = 0;
foreach (var arg in args)
{
Debug.WriteLine("参数: {0}", arg);
currentIndex++;
Console.WriteLine(string.Format("Title: {0}/{1}", currentIndex, args.Length));

FileInfo musicFile = new(arg); //获取目标文件路径信息
if (!musicFile.Exists) //如果音乐文件不存在则跳过
Expand All @@ -32,9 +35,14 @@
continue;
}
ID3v2Tag id3v2 = new(musicFile.FullName);

Console.WriteLine(string.Format("Title: {0}", id3v2.Title));
Console.WriteLine(string.Format("Pictures: {0}", id3v2.PictureList.Count));

if (id3v2.PictureList.Count < 1)
{
Console.Error.WriteLine("错误:没有封面图片 {0}", musicFile.FullName);
continue;
}
IAttachedPicture attachedPicture = id3v2.PictureList[0];

#if DEBUG
Expand Down Expand Up @@ -101,6 +109,6 @@
else
{
Console.WriteLine("图片大小不需要调整");
continue;
}
Console.WriteLine();
}
2 changes: 1 addition & 1 deletion Audi MMI MP3 Cover Repair/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"Audi MMI MP3 Cover Repair": {
"commandName": "Project",
"commandLineArgs": "\"D:\\CTFX\\Documents\\GitHub\\Audi MMI MP3 Cover Repair\\あよ - 世紀末SOS.mp3\""
"commandLineArgs": "\"F:\\日系歌曲\\きゃりーぱみゅぱみゅ - インベーダーインベーダー.mp3\""
}
}
}

0 comments on commit 5cb47ca

Please sign in to comment.