示例#1
0
        public void OpenFlacFileAndCreateMultipleCueSheets()
        {
            int    cueSheetCount = 0;
            string origFile      = @"Data\testfile4.flac";
            string newFile       = @"Data\testfile4_temp.flac";

            FileHelper.GetNewFile(origFile, newFile);

            try
            {
                using (FlacFile flac = new FlacFile(newFile))
                {
                    if (flac.CueSheet != null)
                    {
                        cueSheetCount = 1;
                    }

                    // Add a second (empty) cuesheet
                    CueSheet newCueSheet = new CueSheet();
                    newCueSheet.Tracks.Add(new CueSheetTrack()
                    {
                        TrackNumber = CueSheet.CUESHEET_LEADOUT_TRACK_NUMBER_CDDA
                    });
                    flac.Metadata.Add(newCueSheet);
                    // Add a third (empty) cuesheet
                    newCueSheet = new CueSheet();
                    newCueSheet.Tracks.Add(new CueSheetTrack()
                    {
                        TrackNumber = CueSheet.CUESHEET_LEADOUT_TRACK_NUMBER_CDDA
                    });
                    flac.Metadata.Add(newCueSheet);

                    cueSheetCount += 2;

                    flac.Save();
                }
                using (FlacFile flac = new FlacFile(newFile))
                {
                    Assert.AreEqual <int>(cueSheetCount, flac.GetAllCueSheets().Count());
                }
            }
            finally
            {
                if (File.Exists(newFile))
                {
                    File.Delete(newFile);
                }
            }
        }
示例#2
0
        public void OpenFlacFileAndCreateMultipleCueSheets()
        {
            int cueSheetCount = 0;
            string origFile = @"Data\testfile4.flac";
            string newFile = @"Data\testfile4_temp.flac";

            FileHelper.GetNewFile(origFile, newFile);

            try
            {
                using (FlacFile flac = new FlacFile(newFile))
                {
                    if (flac.CueSheet != null)
                    {
                        cueSheetCount = 1;
                    }

                    // Add a second (empty) cuesheet
                    CueSheet newCueSheet = new CueSheet();
                    newCueSheet.Tracks.Add(new CueSheetTrack() { TrackNumber = CueSheet.CUESHEET_LEADOUT_TRACK_NUMBER_CDDA });
                    flac.Metadata.Add(newCueSheet);
                    // Add a third (empty) cuesheet
                    newCueSheet = new CueSheet();
                    newCueSheet.Tracks.Add(new CueSheetTrack() { TrackNumber = CueSheet.CUESHEET_LEADOUT_TRACK_NUMBER_CDDA });
                    flac.Metadata.Add(newCueSheet);

                    cueSheetCount += 2;

                    flac.Save();
                }
                using (FlacFile flac = new FlacFile(newFile))
                {
                    Assert.AreEqual<int>(cueSheetCount, flac.GetAllCueSheets().Count());
                }
            }
            finally
            {
                if (File.Exists(newFile))
                {
                    File.Delete(newFile);
                }
            }
        }