Example #1
0
        public override Frame Clone()
        {
            UnsynchronisedLyricsFrame frame =
                new UnsynchronisedLyricsFrame(description,
                                              language, encoding);

            frame.text = text;
            return(frame);
        }
Example #2
0
        public static UnsynchronisedLyricsFrame GetPreferred(Tag tag, string description, string language)
        {
            // This is weird, so bear with me. The best thing we can have is
            // something straightforward and in our own language. If it has a
            // description, then it is probably used for something other than
            // an actual comment. If that doesn't work, we'd still rather have
            // something in our language than something in another. After that
            // all we have left are things in other languages, so we'd rather
            // have one with actual content, so we try to get one with no
            // description first.

            int best_value = -1;
            UnsynchronisedLyricsFrame best_frame = null;

            foreach (Frame f in tag.GetFrames(FrameType.USLT))
            {
                UnsynchronisedLyricsFrame cf = f as UnsynchronisedLyricsFrame;
                if (cf == null)
                {
                    continue;
                }

                bool same_name = cf.Description == description;
                bool same_lang = cf.Language == language;

                if (same_name && same_lang)
                {
                    return(cf);
                }

                int value = same_lang ? 2 : same_name ? 1 : 0;

                if (value <= best_value)
                {
                    continue;
                }

                best_value = value;
                best_frame = cf;
            }

            return(best_frame);
        }
Example #3
0
        public static UnsynchronisedLyricsFrame Get(Tag tag, string description, string language, bool create)
        {
            foreach (Frame f in tag.GetFrames(FrameType.USLT))
            {
                UnsynchronisedLyricsFrame cf = f as UnsynchronisedLyricsFrame;

                if (cf != null && cf.Description == description && (language == null || language == cf.Language))
                {
                    return(cf);
                }
            }

            if (!create)
            {
                return(null);
            }

            UnsynchronisedLyricsFrame frame = new UnsynchronisedLyricsFrame(description, language);

            tag.AddFrame(frame);
            return(frame);
        }
		public override Frame Clone ()
		{
			UnsynchronisedLyricsFrame frame =
				new UnsynchronisedLyricsFrame (description,
					language, encoding);
			frame.text = text;
			return frame;
		}
 public static UnsynchronisedLyricsFrame Get (Tag tag, string description, string language, bool create)
 {
    foreach (Frame f in tag.GetFrames (FrameType.USLT))
    {
       UnsynchronisedLyricsFrame cf = f as UnsynchronisedLyricsFrame;
       
       if (cf != null && cf.Description == description && (language == null || language == cf.Language))
          return cf;
    }
    
    if (!create)
       return null;
    
    UnsynchronisedLyricsFrame frame = new UnsynchronisedLyricsFrame (description, language);
    tag.AddFrame (frame);
    return frame;
 }