fCraft.MonoCompat.StartDotNetProcess C# (CSharp) Method

StartDotNetProcess() public static method

Starts a .NET process, using Mono if necessary.
public static StartDotNetProcess ( [ assemblyLocation, [ assemblyArgs, bool detachIfMono ) : Process
assemblyLocation [ .NET executable path.
assemblyArgs [ Arguments to pass to the executable.
detachIfMono bool If true, new process will be detached under Mono.
return System.Diagnostics.Process
        public static Process StartDotNetProcess( [NotNull] string assemblyLocation, [NotNull] string assemblyArgs, bool detachIfMono )
        {
            if ( assemblyLocation == null )
                throw new ArgumentNullException( "assemblyLocation" );
            if ( assemblyArgs == null )
                throw new ArgumentNullException( "assemblyArgs" );
            string binaryName, args;
            if ( IsMono ) {
                if ( IsSGenCapable ) {
                    binaryName = "mono-sgen";
                } else {
                    binaryName = "mono";
                }
                args = "\"" + assemblyLocation + "\"";
                if ( !String.IsNullOrEmpty( assemblyArgs ) ) {
                    args += " " + assemblyArgs;
                }
                if ( detachIfMono ) {
                    args += " &";
                }
            } else {
                binaryName = assemblyLocation;
                args = assemblyArgs;
            }
            return Process.Start( binaryName, args );
        }