@@ -68,6 +68,16 @@ public class AudioFile : TagLib.NonContainer.File
68
68
#endregion
69
69
70
70
71
+ #region Private Static Fields
72
+
73
+ /// <summary>
74
+ /// Specifies whether or not to create ID3v1 and
75
+ /// ID3v2 tags when they don't exist..
76
+ /// </summary>
77
+ private static bool create_id3_tags = true ;
78
+
79
+ #endregion
80
+
71
81
72
82
#region Constructors
73
83
@@ -154,6 +164,33 @@ public AudioFile (IFileAbstraction abstraction)
154
164
#endregion
155
165
156
166
167
+ #region Public Static Properties
168
+
169
+ /// <summary>
170
+ /// Gets and sets whether or not to create ID3v1 and
171
+ /// ID3v2 tags automatically when they are not existing.
172
+ /// </summary>
173
+ /// <value>
174
+ /// <see langword="true" /> if tags to be created automatically.
175
+ /// Otherwise, <see langword="false" />.
176
+ /// </value>
177
+ /// <remarks>
178
+ /// <para>Sometimes a MP3 file should only contain ID3v1 and no
179
+ /// ID3v2 Tags. Or instead of ID3v2 Tags APE Tags should be used.
180
+ /// By setting this property to <see langword="false" />,
181
+ /// no ID3v1 and Id3v2 Tags will be created when creating the file,
182
+ /// if they don't exist.
183
+ /// They need to be created explicitly if needed.</para>
184
+ /// <para>The default is <see langword="true" /> which means that
185
+ /// ID3v1 and Id3v2 tags are created when they don't exist.</para>
186
+ /// </remarks>
187
+ public static bool CreateID3Tags {
188
+ get { return create_id3_tags ; }
189
+ set { create_id3_tags = value ; }
190
+ }
191
+
192
+ #endregion
193
+
157
194
158
195
#region Public Methods
159
196
@@ -252,9 +289,9 @@ protected override void ReadStart (long start, ReadStyle propertiesStyle)
252
289
/// </param>
253
290
protected override void ReadEnd ( long end , ReadStyle propertiesStyle )
254
291
{
255
- // Make sure we have ID3v1 and ID3v2 tags.
256
- GetTag ( TagTypes . Id3v1 , true ) ;
257
- GetTag ( TagTypes . Id3v2 , true ) ;
292
+ // Creation of ID3v1 and ID3v2 tags based on CreateID3Tags property
293
+ GetTag ( TagTypes . Id3v1 , create_id3_tags ) ;
294
+ GetTag ( TagTypes . Id3v2 , create_id3_tags ) ;
258
295
}
259
296
260
297
/// <summary>
0 commit comments