public static void Generate_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; Object[] arguments = e.Argument as Object[]; LyricItem item = arguments[0] as LyricItem; String fileName = arguments[1] as String; worker.ReportProgress(0, item.Provider.Name); LyricContent lyricContent = item.Provider.Retrieve(item); switch (Path.GetExtension(fileName)) { case ".txt": TextLyricWriter writer = new TextLyricWriter(lyricContent); writer.WriteTo(fileName); break; default: break; } e.Result = fileName; }
public TextLyricWriter(LyricContent lyricContent) { this.LyricContent = lyricContent; this.Encoding = Encoding.UTF8; this.WriteAdditionalInformation = true; }