Exemple #1
0
        private static void AddMusicFile(int No, string path)
        {
            FileMusic fMusic = new FileMusic(path);

            fMusic.No = No;
            if (CutParenthesisTitle)
            {
                fMusic.CutParenthesis(CutParenthesisItem.Title);
            }
            if (CutParenthesisArtist)
            {
                fMusic.CutParenthesis(CutParenthesisItem.Artist);
            }

            FileLists.Add(fMusic);
        }
Exemple #2
0
        public static bool ConvertFileNameAt(int index)
        {
            string    newFileName = string.Empty;
            FileMusic muFile      = (FileMusic)FileLists.ElementAt(index);

            if (string.IsNullOrEmpty(muFile.Artist) && string.IsNullOrEmpty(muFile.Title))
            {
                newFileName = muFile.FileName;
            }
            else
            {
                newFileName = string.Concat("[", muFile.Artist, "]", muFile.Title, ".mp3");
            }

            if (SavePath.Equals(string.Empty))
            {
                return(false);
            }

            if (!Directory.Exists(@SavePath))
            {
                Directory.CreateDirectory(@SavePath);
            }

            try
            {
                var sourceFile = string.Concat(FileLists.ElementAt(index).FilePath, "\\", FileLists.ElementAt(index).FileName);

                File.Copy(sourceFile, string.Concat(@SavePath, "//", newFileName), true);
                File.Delete(sourceFile);
            }
            catch (Exception ex)
            {
            }

            return(true);
        }