protected override void Run() { var proj = GetSelectedMonoMacProject(); var settings = proj.UserProperties.GetValue <MonoMacPackagingSettings> (PROP_KEY) ?? MonoMacPackagingSettings.GetAppStoreDefault(); MonoMacPackagingSettingsDialog dlg = null; try { dlg = new MonoMacPackagingSettingsDialog(); dlg.LoadSettings(settings); if (MessageService.RunCustomDialog(dlg) != (int)ResponseType.Ok) { return; } dlg.SaveSettings(settings); } finally { if (dlg != null) { dlg.Destroy(); } } var configSel = IdeApp.Workspace.ActiveConfiguration; var cfg = (MonoMacProjectConfiguration)proj.GetConfiguration(configSel); var ext = settings.CreatePackage? ".pkg" : ".app"; var fileDlg = new SelectFileDialog() { Title = settings.CreatePackage? GettextCatalog.GetString("Save Installer Package") : GettextCatalog.GetString("Save Application Bundle"), InitialFileName = cfg.AppName + ext, Action = FileChooserAction.Save }; fileDlg.DefaultFilter = fileDlg.AddFilter("", "*" + ext); if (!fileDlg.Run()) { return; } proj.UserProperties.SetValue(PROP_KEY, settings); var target = fileDlg.SelectedFile; if (!string.Equals(target.Extension, ext, StringComparison.OrdinalIgnoreCase)) { target.ChangeExtension(ext); } MonoMacPackaging.Package(proj, configSel, settings, target); }
public int Run(string[] arguments) { Monitor = new ConsoleProgressMonitor(); Options = new MonoMacPackagingToolOptions(arguments); switch (Options.Parse()) { case MonoMacPackagingToolOptions.ParseResult.Failure: Console.WriteLine("{0}: {1}", Name, Options.ParseFailureMessage); Console.WriteLine("Try `{0} --help' for more information.", Name); return(1); case MonoMacPackagingToolOptions.ParseResult.Success: break; } if (Options.ShowHelp) { ShowUsage(); return(0); } var project = MaybeFindMonoMacProject(); if (project == null) { Console.WriteLine("Error: Could not find MonoMac project."); return(1); } var config = project.Configurations.FirstOrDefault <ItemConfiguration> (c => c.Name == Options.Configuration); if (config == null) { Console.WriteLine("Error: Could not find configuration: {0}", Options.Configuration); return(1); } MonoMacPackaging.BuildPackage(Monitor, project, config.Selector, Options.PackagingSettings, GetTarget(project)); return(0); }