private void ExportButton_Click(object sender, EventArgs args) { // get an export folder string outputPath = Properties.Settings.Default.ExportPath; if (string.IsNullOrEmpty(outputPath)) { outputPath = Path.GetDirectoryName(_XMLFileName); } var dialog = new FolderBrowserDialog { ShowNewFolderButton = true, Description = "Select export folder:", SelectedPath = outputPath }; if (FolderBrowserLauncher.ShowFolderBrowser(dialog, this) != DialogResult.OK || string.IsNullOrEmpty(dialog.SelectedPath)) { return; } // generate output filenames string interfaceFile = Path.Combine(dialog.SelectedPath, _codeGen.N2ObjC.InterfaceFile); string implementationFile = Path.Combine(dialog.SelectedPath, _codeGen.N2ObjC.ImplementationFile); try { bool ouputMonolithicInterface = false; bool ouputMonolithicImplementation = false; // output interface if (ouputMonolithicInterface) { File.WriteAllText(interfaceFile, _codeGen.N2ObjC.InterfaceOutput, Encoding.UTF8); } else { GeneratedFileExporter.WriteAllText(Net2ObjC.OutputType.Interface, interfaceFile, _codeGen.N2ObjC.InterfaceOutput); } // output implementation if (ouputMonolithicImplementation) { File.WriteAllText(implementationFile, _codeGen.N2ObjC.ImplementationOutput, Encoding.UTF8); } else { GeneratedFileExporter.WriteAllText(Net2ObjC.OutputType.Implementation, implementationFile, _codeGen.N2ObjC.ImplementationOutput); } // do post flight processing PostflightObjC postflight = PostflightObjC.PostflightObjCForAssembly(_codeGen.N2ObjC.XMLFilePath); if (!postflight.Process()) { // problems MessageBox.Show(string.Format("The code was exported to {0} but problems occurred during the postflight processing.", dialog.SelectedPath)); } else { // success MessageBox.Show(string.Format("The code was successfully exported to {0}.", dialog.SelectedPath)); } // persistence is not futile Properties.Settings.Default.ExportPath = dialog.SelectedPath; } catch (Exception e) { MessageBox.Show(string.Format("Exception: {0}.", e.ToString())); } }