2 // Tag.cs : Uniform interface for all audio tag types. It handles the most common
3 // fields used in music files.
6 // Raphaël Slinckx <raf.raf@wol.be>
8 // Copyright 2004 (C) Raphaël Slinckx
12 // Permission is hereby granted, free of charge, to any person obtaining a
13 // copy of this software and associated documentation files (the "Software"),
14 // to deal in the Software without restriction, including without limitation
15 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 // and/or sell copies of the Software, and to permit persons to whom the
17 // Software is furnished to do so, subject to the following conditions:
19 // The above copyright notice and this permission notice shall be included in
20 // all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28 // DEALINGS IN THE SOFTWARE.
34 using System
.Collections
;
36 namespace Beagle
.Util
.AudioUtil
{
40 protected Hashtable fields
;
44 fields
= new Hashtable ();
47 fields
["ARTIST"] = "";
51 fields
["COMMENT"] = "";
52 fields
["VENDOR"] = "";
57 return (string) fields
["TITLE"];
62 fields
["TITLE"] = value;
68 return (string) fields
["ALBUM"];
73 fields
["ALBUM"] = value;
78 public string Artist
{
80 return (string) fields
["ARTIST"];
84 fields
["ARTIST"] = "";
85 fields
["ARTIST"] = value;
92 return (string) fields
["GENRE"];
97 fields
["GENRE"] = value;
101 public string Track
{
103 return (string) fields
["TRACK"];
107 fields
["TRACK"] = "";
108 fields
["TRACK"] = value;
114 return (string) fields
["YEAR"];
119 fields
["YEAR"] = value;
123 public string Comment
{
125 return (string) fields
["COMMENT"];
129 fields
["COMMENT"] = "";
130 fields
["COMMENT"] = value;
134 public string Vendor
{
136 return (string) fields
["VENDOR"];
140 fields
["VENDOR"] = "";
141 fields
["VENDOR"] = value;
145 public override string ToString ()
147 string s
= "Tag content:\n";
148 foreach (DictionaryEntry en
in fields
) {
155 return s
.Substring (0, s
.Length
-1);
158 public void Merge (Tag tag
)
160 if( Title
.Trim () == "")
162 if( Artist
.Trim () == "")
164 if( Album
.Trim () == "")
166 if( Year
.Trim () == "")
168 if( Comment
.Trim () == "")
169 Comment
= tag
.Comment
;
170 if( Track
.Trim () == "")
172 if( Genre
.Trim () == "")