public void Store(Song song, string outputDirectory)
        {
            if (!Directory.Exists(outputDirectory))
            {
                Directory.CreateDirectory(outputDirectory);
            }
            var songInfoJson = JsonConvert.SerializeObject(song.SongInfo);

            File.WriteAllText(
                Path.Combine(outputDirectory, SongInfoFileName),
                songInfoJson);
            foreach (var difficultyLevel in song.DifficultyLevels)
            {
                StoreDifficultyLevel(difficultyLevel.Value, difficultyLevel.Key, outputDirectory);
            }

            if (!File.Exists(Path.Combine(outputDirectory, SongPath)))
            {
                if (Path.GetExtension(song.AudioPath).ToLowerInvariant() == ".ogg")
                {
                    File.Copy(song.AudioPath, Path.Combine(outputDirectory, SongPath), overwrite: true);
                }
                else
                {
                    audioToOggConverter.Convert(song.AudioPath, Path.Combine(outputDirectory, SongPath));
                }
            }
            File.Copy(song.CoverPath, Path.Combine(outputDirectory, CoverImagePath), overwrite: true);
        }
Beispiel #2
0
        public void ConversionTest()
        {
            var sut            = new AudioToOggConverter();
            var inputFilePath  = @"C:\Users\Jan\Music\Dimitri Vegas - Ocarina.mp3";
            var outputFilePath = @"C:\Users\Jan\Music\Dimitri Vegas - Ocarina.ogg";

            sut.Convert(inputFilePath, outputFilePath);
        }