Logo Search packages:      
Sourcecode: taglib-sharp version File versions

static CommentsFrame TagLib::Id3v2::CommentsFrame::Get ( Tag  tag,
string  description,
string  language,
bool  create 
) [inline, static]

Gets a specified comments frame from the specified tag, optionally creating it if it does not exist.

Parameters:
tag A Tag object to search in.
description A string specifying the description to match.
language A string specifying the ISO-639-2 language code to match.
create A bool specifying whether or not to create and add a new frame to the tag if a match is not found.
Returns:
A CommentsFrame object containing the matching frame, or if a match wasn't found and create is .

Definition at line 330 of file CommentsFrame.cs.

References Description, and Language.

            {
                  CommentsFrame comm;
                  foreach (Frame frame in tag.GetFrames (FrameType.COMM)) {
                        comm = frame as CommentsFrame;
                        
                        if (comm == null)
                              continue;
                        
                        if (comm.Description != description)
                              continue;
                        
                        if (language != null && language != comm.Language)
                              continue;
                        
                        return comm;
                  }
                  
                  if (!create)
                        return null;
                  
                  comm = new CommentsFrame (description, language);
                  tag.AddFrame (comm);
                  return comm;
            }


Generated by  Doxygen 1.6.0   Back to index