Esempio n. 1
0
        public LameProcess(string lamePath, string inputFile, string outputFile, LameArguments arguments)
        {
            if (string.IsNullOrWhiteSpace(lamePath))
            {
                throw new ArgumentNullException(lamePath, Messages.Errors.LameEncoderPathNotSpecified);
            }
            if (string.IsNullOrWhiteSpace(inputFile))
            {
                throw new ArgumentNullException(inputFile, Messages.Errors.InputFileNotSpecified);
            }
            if (string.IsNullOrWhiteSpace(outputFile))
            {
                throw new ArgumentNullException(outputFile, Messages.Errors.OutputFileNotSpecified);
            }

            FileInfo outputFileInfo;

            try {
                outputFileInfo = new FileInfo(outputFile);
            } catch {
                throw new UriFormatException(Messages.Errors.OutputFilePathInvalid);
            }

            if (!File.Exists(outputFileInfo.FullName))
            {
                outputFileInfo.Directory.Create();
            }

            _outputFile = outputFileInfo.FullName;

            _lamePath  = lamePath;
            _inputFile = inputFile;
            _arguments = arguments;

            _lameProc = new Process {
                StartInfo = new ProcessStartInfo {
                    FileName              = lamePath,
                    Arguments             = arguments + " \"" + inputFile + "\" \"" + outputFile + "\"",
                    CreateNoWindow        = true,
                    UseShellExecute       = false,
                    RedirectStandardError = true
                }
            };
            _lameProc.Disposed += LameProc_Disposed;
        }
Esempio n. 2
0
 public LameProcess(string inputFile, string outputFile, LameArguments arguments) : this(Helper.DefaultLamePath, inputFile, outputFile, arguments)
 {
 }