public void Process(ref MorphemeAssetProcessor.Result result) { try { // get the paths from the Network string mcpFile; string mcnFile; string intermediateFile; MorphemeHelper.GetFilePathsFromNetwork(Network, ExportRootPath, out mcpFile, out mcnFile, out intermediateFile); result.Platform = AssetCompilerExe; if (File.Exists(intermediateFile) == false) { result.Success = false; result.ErrorString = "Cannot find intermediate file: " + intermediateFile; return; } // extract the root path FileInfo mcpfileInfo = new FileInfo(mcpFile); string rootPath = mcpfileInfo.DirectoryName; string commandLine = "-baseDir \"" + rootPath + "\" -outputDir \"" + ExportRootPath + ProcessSubPath + "\" " + Settings.GetInstance().AssetCompilerCommandLine + " -asset \"" + intermediateFile + "\""; if (!CommandLineOptions.Equals("")) { commandLine += " "; commandLine += CommandLineOptions; } // get ready to start the asset compiler with the above command line in a hidden window ProcessStartInfo procStartInfo = new ProcessStartInfo(AssetCompilerExe, commandLine); procStartInfo.WindowStyle = ProcessWindowStyle.Hidden; // run the asset compiler using (Process proc = System.Diagnostics.Process.Start(procStartInfo)) { // wait for the process to end proc.WaitForExit(); if (proc.ExitCode != 0) { result.Success = false; result.ErrorString = AssetCompilerExe + " " + commandLine + " exited with code " + proc.ExitCode.ToString(); } } } catch (System.Exception ex) { result.Success = false; result.ErrorString = ex.ToString(); } }
// Wrapper method for use with thread pool. public void ThreadPoolCallback(ref MorphemeAssetProcessor.Result result) { Process(ref result); DoneEvent.Set(); }