예제 #1
0
        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);
        }
예제 #2
0
파일: Methods.cs 프로젝트: Satroki/MusicWPF
 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();
     });
 }
예제 #3
0
 public TagWin(ListFiles lf)
 {
     InitializeComponent();
     mf = lf.MusicFile;
     DataContext = mf;
 }
예제 #4
0
파일: Methods.cs 프로젝트: Satroki/MusicWPF
 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;
 }
예제 #5
0
 private void loadMF(MusicFile mf)
 {
     this.mf = mf;
     Title = mf.DisplayName;
     tbLrc.Text = mf.Lyric;
 }
예제 #6
0
 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);
 }