Пример #1
0
        private static FileInfo ConvertToWEM(FileInfo file)
        {
            DirectoryInfo dir;

            if (!Directory.Exists(@".\AUDIO_TEMP"))
            {
                dir            = Directory.CreateDirectory(@".\AUDIO_TEMP");
                dir.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
            }
            else
            {
                dir = new DirectoryInfo(@".\AUDIO_TEMP");
            }
            if (file.Extension.ToLower() == ".wav")
            {
                WAVFile wav = new WAVFile(file.FullName);
                WEMFile wem = wav.ConvertToWEM();

                string newWemPath = @".\AUDIO_TEMP\" + file.Name + ".wem";
                return(wem.SaveToFile(newWemPath));
            }
            else
            {
                // Guarantees the extension is wav.
                return(ConvertToWEM(FFmpegWrapper.ConvertToWaveFile(file.FullName, dir)));
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Drag n' drop a WEM or any audio file onto this EXE to convert it. WEM will be converted to WAV no matter what.");
                Console.WriteLine("Press any key to quit...");
                Console.ReadKey(true);
                return;
            }

            FileInfo file = new FileInfo(args[0]);

            if (file.Extension.ToLower() == ".wem")
            {
                Console.WriteLine("WARNING: WEM conversion is a bit busted right now! If your file is broken, sorry! A patch will be out ASAP.");
                WEMFile wem = new WEMFile(file.FullName);
                WAVFile wav = wem.ConvertToWAV();
                wav.SaveToFile(file.FullName + ".wav");
            }
            else
            {
                file = FFmpegWrapper.ConvertToWaveFile(file.FullName);
                WAVFile wav = new WAVFile(file.FullName);
                WEMFile wem = wav.ConvertToWEM();
                wem.SaveToFile(args[0] + ".wem");
            }
        }