public void Convert() { Process.StartInfo.Arguments = String.Format( "-y -i \"{0}\" -acodec {1} -metadata comment=\"{2}\" -vcodec copy -sample_fmt s16p -ar 44100 -ac 2 \"{3}\"", InputPath.Replace("\\", "/"), Codec, Hash, OutputPath.Replace("\\", "/") ); //Process.StartInfo.RedirectStandardOutput = true; //Process.StartInfo.RedirectStandardError = true; // hookup the eventhandlers to capture the data that is received //Process.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data); //Process.ErrorDataReceived += (sender, args) => sb.AppendLine(args.Data); // direct start //Process.StartInfo.UseShellExecute = false; Process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; Process.StartInfo.RedirectStandardOutput = false; Process.StartInfo.RedirectStandardError = false; Process.Start(); // start our event pumps //Process.BeginOutputReadLine(); //Process.BeginErrorReadLine(); // until we are done Process.WaitForExit(); }
public FindFileSystemEntryInfo(KernelTransaction transaction, bool isFolder, string path, string searchPattern, DirectoryEnumerationOptions?options, DirectoryEnumerationFilters customFilters, PathFormat pathFormat, Type typeOfT) { if (null == options) { throw new ArgumentNullException("options"); } Transaction = transaction; OriginalInputPath = path; InputPath = Path.GetExtendedLengthPathCore(transaction, path, pathFormat, GetFullPathOptions.RemoveTrailingDirectorySeparator | GetFullPathOptions.FullCheck); IsRelativePath = !Path.IsPathRooted(OriginalInputPath, false); RelativeAbsolutePrefix = IsRelativePath ? InputPath.Replace(OriginalInputPath, string.Empty) : null; SearchPattern = searchPattern.TrimEnd(Path.TrimEndChars); // .NET behaviour. FileSystemObjectType = null; ContinueOnException = (options & DirectoryEnumerationOptions.ContinueOnException) != 0; AsLongPath = (options & DirectoryEnumerationOptions.AsLongPath) != 0; AsString = typeOfT == typeof(string); AsFileSystemInfo = !AsString && (typeOfT == typeof(FileSystemInfo) || typeOfT.BaseType == typeof(FileSystemInfo)); LargeCache = (options & DirectoryEnumerationOptions.LargeCache) != 0 ? NativeMethods.UseLargeCache : NativeMethods.FIND_FIRST_EX_FLAGS.NONE; // Only FileSystemEntryInfo makes use of (8.3) AlternateFileName. FindExInfoLevel = AsString || AsFileSystemInfo || (options & DirectoryEnumerationOptions.BasicSearch) != 0 ? NativeMethods.FindexInfoLevel : NativeMethods.FINDEX_INFO_LEVELS.Standard; if (null != customFilters) { InclusionFilter = customFilters.InclusionFilter; RecursionFilter = customFilters.RecursionFilter; ErrorHandler = customFilters.ErrorFilter; #if !NET35 CancellationToken = customFilters.CancellationToken; #endif } #if !NET35 if (null == CancellationToken) { CancellationToken = new CancellationToken(); } #endif if (isFolder) { IsDirectory = true; Recursive = (options & DirectoryEnumerationOptions.Recursive) != 0 || null != RecursionFilter; SkipReparsePoints = (options & DirectoryEnumerationOptions.SkipReparsePoints) != 0; // Need folders or files to enumerate. if ((options & DirectoryEnumerationOptions.FilesAndFolders) == 0) { options |= DirectoryEnumerationOptions.FilesAndFolders; } } else { options &= ~DirectoryEnumerationOptions.Folders; // Remove enumeration of folders. options |= DirectoryEnumerationOptions.Files; // Add enumeration of files. } FileSystemObjectType = (options & DirectoryEnumerationOptions.FilesAndFolders) == DirectoryEnumerationOptions.FilesAndFolders // Folders and files (null). ? (bool?)null // Only folders (true) or only files (false). : (options & DirectoryEnumerationOptions.Folders) != 0; }