Skip to content

Commit 31de2e7

Browse files
committed
Touch up SetPictures program
1 parent 584607b commit 31de2e7

File tree

2 files changed

+31
-32
lines changed

2 files changed

+31
-32
lines changed

examples/SetPictures/Program.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using TagLib;
2+
3+
using File = TagLib.File;
4+
5+
namespace SetPictures;
6+
7+
public class Program
8+
{
9+
public static void Main (string[] args)
10+
{
11+
if (args.Length < 2) {
12+
Console.Error.WriteLine ("USAGE: mono SetPictures.exe AUDIO_PATH IMAGE_PATH_1[...IMAGE_PATH_N]");
13+
return;
14+
}
15+
16+
var file = File.Create (args[0]);
17+
Console.WriteLine ($"Current picture count: {file.Tag.Pictures.Length}");
18+
19+
var pictures = new Picture[args.Length - 1];
20+
21+
for (int i = 1; i < args.Length; i++) {
22+
var picture = new Picture (args[i]);
23+
pictures[i - 1] = picture;
24+
}
25+
26+
file.Tag.Pictures = pictures;
27+
file.Save ();
28+
29+
Console.WriteLine ($"New picture count: {file.Tag.Pictures.Length}");
30+
}
31+
}

examples/SetPictures/SetPictures.cs

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)