Ejemplo n.º 1
0
        private void TestMP3FileNameConverter()
        {
            OperationResult op = new OperationResult();

            MP3FileDataType me = BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmt(textBox1.Text, ref op);

            if (!op.Success)
            {
                MessageBox.Show(op.GetAllMessages("\n"), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            textBox2.Text = me.FileName + "; " + me.FilePath + "; ";
        }
Ejemplo n.º 2
0
        private void btnGetMusicInfo_Click(object sender, EventArgs e)
        {
            if (!Path.GetExtension(ddtbMp3File.ItemText).ToLower().EndsWith(".mp3"))
            {
                MessageBox.Show("Please enter a valid MP3 file", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            if (dddtbGetRootDir.ItemText.Trim().Length < 1)
            {
                MessageBox.Show("You must choose a music root folder!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            OperationResult op = new OperationResult();

            string mscRtDir     = dddtbGetRootDir.ItemText;
            string fileNamePath = ddtbMp3File.ItemText;

            try
            {
                MP3FileDataType me = ckbUseDirForInfo.Checked ? BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmtWithDirInfo(fileNamePath, mscRtDir, ref op)
                    : BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmt(fileNamePath, ref op);

                if (!op.Success)
                {
                    MessageBox.Show(op.GetAllMessages("\n"), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                tbCalcTrack.Text = me.Track != null?me.Track.ToString() : string.Empty;

                tbCalcTitle.Text   = me.SongTitleAndNumeration ?? string.Empty;
                tbCalcArtists.Text = me.ArtistsStrList ?? string.Empty;
                tbCalcAlbum.Text   = me.Album ?? string.Empty;
                tbcalcComment.Text = me.Comments ?? string.Empty;
                tbCalcGenre.Text   = me.Genre ?? string.Empty;
            }
            catch (Exception ex)
            {
                op.AddException(ex);

                MessageBox.Show(op.GetAllMessages("\n"), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Ejemplo n.º 3
0
        public void InsertMP3s(List <string> mp3List, string mp3RtDir, bool useFolderInfo, ref OperationResult op)
        {
            try
            {
                int cnt = 0;

                foreach (string mp3Item in mp3List)
                {
                    cnt++;
                    if (onCountChange != null)
                    {
                        onCountChange(cnt);
                    }

                    OperationResult _op = new OperationResult();
                    MP3FileDataType mp3 = useFolderInfo ?
                                          BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmtWithDirInfo(mp3Item, mp3RtDir, ref _op)
                        : BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmt(mp3Item, ref _op);

                    if (!_op.Success)
                    {
                        op.AddOperationResult(ref _op);
                        continue;
                    }


                    InsertMP3(mp3, ref _op);

                    if (!_op.Success)
                    {
                        op.AddOperationResult(ref _op);
                        continue;
                    }
                }
            }
            catch (Exception ex)
            {
                op.AddException(ex);
            }
        }
Ejemplo n.º 4
0
        private void InsertMP3s(List <string> mp3List, string mp3RtDir, bool useFolderInfo, ref OperationResult op)
        {
            try
            {
                int cnt = 0;

                foreach (string mp3Item in mp3List)
                {
                    cnt++;
                    SetCount(cnt);

                    OperationResult _op = new OperationResult();
                    MP3FileDataType mp3 = useFolderInfo ?
                                          BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmtWithDirInfo(mp3Item, mp3RtDir, ref _op)
                        : BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmt(mp3Item, ref _op);

                    if (!_op.Success)
                    {
                        op.AddOperationResult(ref _op);
                        return;
                    }

                    _mp3Repository.InsertMp3(mp3, ref op);

                    if (!_op.Success)
                    {
                        op.AddOperationResult(ref _op);
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                op.AddException(ex);
            }
        }
Ejemplo n.º 5
0
 protected override void ConvertFileNameToMP3Info(string fileNameAndPath, ref OperationResult op)
 {
     this.MP3FileData = BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmt(fileNameAndPath, ref op);
 }
Ejemplo n.º 6
0
        private void btnPopWithNameInfo_Click(object sender, EventArgs e)
        {
            OperationResult op = new OperationResult();

            if (!Path.GetExtension(ddtbMp3File.ItemText).ToLower().EndsWith(".mp3"))
            {
                MessageBox.Show("Please enter a valid MP3 file", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            MP3FileDataType me = ckbUseDirForInfo.Checked ? BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmtWithDirInfo(ddtbMp3File.ItemText,
                                                                                                                       dddtbGetRootDir.ItemText, ref op) : BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmt(ddtbMp3File.ItemText, ref op);

            if (!op.Success)
            {
                MessageBox.Show(op.GetAllMessages("\n"), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            tbTrack3v1.Text = me.Track != null?me.Track.ToString() : string.Empty;

            tbTitle3v1.Text   = me.SongTitleAndNumeration ?? string.Empty;
            tbArtist3v1.Text  = me.ArtistsStrList ?? string.Empty;
            tbAlbum3v1.Text   = me.Album ?? string.Empty;
            tbComment3v1.Text = me.Comments ?? string.Empty;
            string genre = me.Genre ?? string.Empty;

            genre = string.IsNullOrEmpty(genre) || !BCHMP3Utilities.GetGenre().Contains(genre.Trim(),
                                                                                        StringComparer.CurrentCultureIgnoreCase) ? "150" : genre;
            cbGenre3v1.Genre = genre;

            tbTrack3v2.Text = me.Track != null?me.Track.ToString() : string.Empty;

            tbTitle3v2.Text   = me.SongTitleAndNumeration ?? string.Empty;
            tbArtist3v2.Text  = me.ArtistsStrList ?? string.Empty;
            tbAlbum3v2.Text   = me.Album ?? string.Empty;
            tbComment3v2.Text = me.Comments ?? string.Empty;
            cbGenre3v2.Genre  = me.Genre ?? string.Empty;
        }