private void UpdateTagInfo(string mp3File, string mp3MusicRootPath, bool useDirInfo, ref OperationResult op)
        {
            OperationResult _op = new OperationResult();

            try
            {
                bool            badfile = false;
                MP3FileDataType mp3     = BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmtWithDirInfo(mp3File,
                                                                                                     mp3MusicRootPath, ref _op);
                if (!_op.Success)
                {
                    badfile = true;
                }

                if (_op.Success)
                {
                    BCHMP3Utilities.SaveMp3IdInfo(mp3, ref _op);
                }

                if (!_op.Success && !badfile)
                {
                    badfile = true;
                }
            }
            catch (Exception ex)
            {
                _op.AddException(ex);
            }
            op.AddOperationResult(ref _op);
        }
Ejemplo n.º 2
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);
            }
        }
        public List <string> EditMP3Tags(List <string> mp3Files, string mp3MusicRootPath, bool useFileInfo, ref OperationResult op)
        {
            OperationResult _op        = new OperationResult();
            int             cnt        = 0;
            bool            badfile    = false;
            List <string>   badMp3List = new List <string>();

            foreach (string mp3File in mp3Files)
            {
                badfile = false;
                cnt++;
                if (ProgressUpdate != null)
                {
                    ProgressUpdate(cnt);
                }
                try
                {
                    MP3FileDataType mp3 = BCHMP3Utilities.ConvertFileNameToMP3InfoBCHFrmtWithDirInfo(mp3File,
                                                                                                     mp3MusicRootPath, ref _op);
                    if (!_op.Success)
                    {
                        badMp3List.Add(mp3File);
                        badfile = true;
                    }

                    if (_op.Success)
                    {
                        SaveMp3IdInfo(mp3, ref _op);
                    }

                    if (!_op.Success && !badfile)
                    {
                        badfile = true;
                        badMp3List.Add(mp3File);
                    }
                }
                catch (Exception ex)
                {
                    _op.AddException(ex);
                    if (!badfile)
                    {
                        badfile = true;
                        badMp3List.Add(mp3File);
                    }
                }
            }

            op.AddOperationResult(ref _op);

            return(badMp3List);
        }
Ejemplo n.º 4
0
        private void InsertMP3s(List <string> mp3List, ref OperationResult op)
        {
            try
            {
                int cnt = 0;

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

                    OperationResult _op = new OperationResult();
                    if (!mp3Item.EndsWith(".mp3"))
                    {
                        continue;
                    }
                    MP3FileDataType mp3 = BCHMP3Utilities.UseFileTagsToGetInfo(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
        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);
            }
        }