public void Add(PlaylistItemSave item)
 {
     items.Add(item);
 }
예제 #2
0
        /// <summary>
        /// N.B. PcmReader.StreamBeginも参照(へぼい)。
        /// MenuItemFileOpen_Clickも参照。
        /// </summary>
        /// <returns>エラーの発生回数を戻す</returns>
        private int ReadFileHeader1(string path, ReadHeaderMode mode, PlaylistTrackInfo plti, PlaylistItemSave plis)
        {
            mPlaylistTrackMeta = plti;
            mPlis = plis;

            int errCount = 0;
            var ext = System.IO.Path.GetExtension(path).ToUpperInvariant();

            try {
                switch (ext) {
                case ".PPWPL":
                    if (mode != ReadHeaderMode.OnlyConcreteFile) {
                        // PPWプレイリストを読み込み
                        errCount += ReadPpwPlaylist(path);
                    }
                    break;
                case ".CUE":
                case ".M3U":
                case ".M3U8":
                    if (mode != ReadHeaderMode.OnlyConcreteFile) {
                        // CUEシートかM3U8再生リストを読み込み。
                        errCount += ReadCueSheet(path);
                    }
                    break;
                case ".FLAC":
                    if (mode != ReadHeaderMode.OnlyMetaFile) {
                        errCount += !ReadFlacFileHeader(path, mode) ? 1 : 0;
                    }
                    break;
                case ".AIF":
                case ".AIFF":
                case ".AIFC":
                case ".AIFFC":
                    if (mode != ReadHeaderMode.OnlyMetaFile) {
                        errCount += !ReadAiffFileHeader(path) ? 1 : 0;
                    }
                    break;
                case ".WAV":
                case ".WAVE":
                    if (mode != ReadHeaderMode.OnlyMetaFile) {
                        errCount += !ReadWavFileHeader(path) ? 1 : 0;
                    }
                    break;
                case ".DSF":
                    if (mode != ReadHeaderMode.OnlyMetaFile) {
                        errCount += !ReadDsfFileHeader(path) ? 1 : 0;
                    }
                    break;
                case ".DFF":
                    if (mode != ReadHeaderMode.OnlyMetaFile) {
                        errCount += !ReadDsdiffFileHeader(path) ? 1 : 0;
                    }
                    break;
                case ".JPG":
                case ".JPEG":
                case ".PNG":
                case ".BMP":
                    // 読まないで無視する。
                    break;
                default:
                    LoadErrorMessageAdd(string.Format(CultureInfo.InvariantCulture, "{0}: {1}{2}",
                            Properties.Resources.NotSupportedFileFormat, path, Environment.NewLine));
                    ++errCount;
                    break;
                }
            } catch (IOException ex) {
                HandleFileReadException(path, ex);
                ++errCount;
            } catch (ArgumentException ex) {
                HandleFileReadException(path, ex);
                ++errCount;
            } catch (UnauthorizedAccessException ex) {
                HandleFileReadException(path, ex);
                ++errCount;
            } catch (Exception ex) {
                // 未知のエラー。
                HandleFileReadException(path, ex);
                ++errCount;
            }

            return errCount;
        }
예제 #3
0
 public void Add(PlaylistItemSave item)
 {
     items.Add(item);
 }
예제 #4
0
        /// <summary>
        /// N.B. PcmReader.StreamBeginも参照(へぼい)。
        /// MenuItemFileOpen_Clickも参照。
        /// </summary>
        /// <returns>エラーの発生回数を戻す</returns>
        private int ReadFileHeader1(string path, ReadHeaderMode mode, PlaylistTrackInfo plti, PlaylistItemSave plis)
        {
            mPlaylistTrackMeta = plti;
            mPlis = plis;

            int errCount = 0;
            var ext      = System.IO.Path.GetExtension(path).ToUpperInvariant();

            try {
                switch (ext)
                {
                case ".PPWPL":
                    if (mode != ReadHeaderMode.OnlyConcreteFile)
                    {
                        // PPWプレイリストを読み込み
                        errCount += ReadPpwPlaylist(path);
                    }
                    break;

                case ".CUE":
                case ".M3U":
                case ".M3U8":
                    if (mode != ReadHeaderMode.OnlyConcreteFile)
                    {
                        // CUEシートかM3U8再生リストを読み込み。
                        errCount += ReadCueSheet(path);
                    }
                    break;

                case ".FLAC":
                    if (mode != ReadHeaderMode.OnlyMetaFile)
                    {
                        errCount += !ReadFlacFileHeader(path, mode) ? 1 : 0;
                    }
                    break;

                case ".AIF":
                case ".AIFF":
                case ".AIFC":
                case ".AIFFC":
                    if (mode != ReadHeaderMode.OnlyMetaFile)
                    {
                        errCount += !ReadAiffFileHeader(path) ? 1 : 0;
                    }
                    break;

                case ".WAV":
                case ".WAVE":
                    if (mode != ReadHeaderMode.OnlyMetaFile)
                    {
                        errCount += !ReadWavFileHeader(path) ? 1 : 0;
                    }
                    break;

                case ".DSF":
                    if (mode != ReadHeaderMode.OnlyMetaFile)
                    {
                        errCount += !ReadDsfFileHeader(path) ? 1 : 0;
                    }
                    break;

                case ".DFF":
                    if (mode != ReadHeaderMode.OnlyMetaFile)
                    {
                        errCount += !ReadDsdiffFileHeader(path) ? 1 : 0;
                    }
                    break;

                case ".JPG":
                case ".JPEG":
                case ".PNG":
                case ".BMP":
                    // 読まないで無視する。
                    break;

                default:
                    LoadErrorMessageAdd(string.Format(CultureInfo.InvariantCulture, "{0}: {1}{2}",
                                                      Properties.Resources.NotSupportedFileFormat, path, Environment.NewLine));
                    ++errCount;
                    break;
                }
            } catch (IOException ex) {
                HandleFileReadException(path, ex);
                ++errCount;
            } catch (ArgumentException ex) {
                HandleFileReadException(path, ex);
                ++errCount;
            } catch (UnauthorizedAccessException ex) {
                HandleFileReadException(path, ex);
                ++errCount;
            } catch (Exception ex) {
                // 未知のエラー。
                HandleFileReadException(path, ex);
                ++errCount;
            }

            return(errCount);
        }