2022-09-18

Change TagLib tag depending on string

I'm working on an audio tagger and one of its features is basically detecting if the checkbox with the tag name is checked and if the value in the textbox is changed.

This is the code I used so far:

if (chbAlbum.Checked == true && tbAlbum.Text != musFileTag.Album) { 
    fileStatus(3);
    tsbCloseFile.Enabled = false; 
} 
else {
    fileStatus(2); 
    tsbCloseFile.Enabled = true; 
}

now I'm switching to custom void:

void Checker(CheckBox chBox, TextBox tBox, String stringTag) {
    var musFileTag = TagLib.File.Create(musFileName).Tag;
    if (chBox.Checked == true && tBox.Text != musFileTag) { 
        return;
    }
}

how can I determine what tag it will be using from a string?

Normally to get an album tag I would use musFileTag.Album and for artist musFileTag.Performers but I need to determine the tag type from the string (something like musFileTag.{stringTag})



No comments:

Post a Comment