public LyricWin(MusicFile mf) { InitializeComponent(); lrcTemp = @"D:\Program Files (x86)\Netease\CloudMusic\Netease\CloudMusic\Temp"; fsw.Path = lrcTemp; fsw.Created += Fsw_Created; loadMF(mf); checkBox.Checked += checkedChanged; checkBox.Unchecked += checkedChanged; checkedChanged(null, null); }
public static async Task<int> AddMusicFile(string directoryName) { return await Task.Run(() => { var files = new DirectoryInfo(directoryName).GetFiles("*.flac", SearchOption.AllDirectories); foreach (var f in files) { using (var tag = TagLib.File.Create(f.FullName)) { var mf = new MusicFile() { Album = tag.Tag.Album, Artist = string.Join(",", tag.Tag.Performers), FileSize_MB = (double)f.Length / 1048576, FullName = f.FullName, Title = tag.Tag.Title, Name = f.Name, }; MDModel.Model.MusicFile.Add(mf); } } return MDModel.Model.SaveChanges(); }); }
public TagWin(ListFiles lf) { InitializeComponent(); mf = lf.MusicFile; DataContext = mf; }
public static bool ExportLrc(MusicFile mf, bool overwrite = false) { if (string.IsNullOrWhiteSpace(mf.Lyric)) return false; var name = mf.FullName.Substring(0, mf.FullName.LastIndexOf('.')) + ".lrc"; if ((!overwrite) && File.Exists(name)) return false; File.WriteAllText(name, mf.Lyric, Encoding.UTF8); return true; }
private void loadMF(MusicFile mf) { this.mf = mf; Title = mf.DisplayName; tbLrc.Text = mf.Lyric; }
public static void ShowWindow(MusicFile mf) { if (mf == null) return; if (win == null) win = new LyricWin(mf); else win.loadMF(mf); win.Show(); win.checkedChanged(null, null); }