/// <summary>
        /// Initializes a new instance of the <see cref="ProjectHandler"/> class.
        /// </summary>
        /// <param name="project">The project.</param>
        protected ProjectHandler(MonobjcProject project)
        {
            this.Project = project;

            String sourceFile = this.Project.LanguageBinding.GetFileName ("ABC");
            this.SourceExtension = sourceFile.Substring (3);
        }
        public CreateIVarDialog(RefactoringOperation refactoring, RefactoringOptions options, MonobjcProject project)
            : base(refactoring, options, project)
        {
            this.Build ();

            this.buttonOk.Sensitive = false;
            this.entryName.Changed += delegate { this.buttonOk.Sensitive = this.Validate (); };
            this.entryType.Changed += delegate { this.buttonOk.Sensitive = this.Validate (); };
            this.Validate ();

            this.buttonOk.Clicked += OnOKClicked;
        }
        public static void Generate(IProgressMonitor monitor, BuildResult result, MonobjcProject project, ConfigurationSelector configuration, String outputDirectory, bool native)
        {
            // Infer application name from configuration
            String applicationName = project.GetApplicationName(configuration);

            LoggingService.LogInfo("Generate => applicationName='" + applicationName + "'");
            LoggingService.LogInfo("Generate => outputDirectory='" + outputDirectory + "'");

            // Create the bundle maker
            BundleMaker maker = new BundleMaker(applicationName, outputDirectory);

            // Compile the XIB files
            BuildHelper.CompileXIBFiles(monitor, project, maker, result);
            if (result.ErrorCount > 0)
            {
                monitor.ReportError(GettextCatalog.GetString("Failed to compile XIB files"), null);
                return;
            }

            // Copy the output and dependencies
            BuildHelper.CopyOutputFiles(monitor, project, configuration, maker);

            // Copy the content files
            BuildHelper.CopyContentFiles(monitor, project, configuration, maker);

            // Create the Info.plist
            BuildHelper.CreateInfoPList(monitor, project, configuration, maker);

            if (native)
            {
                GenerateNative(monitor, result, project, configuration, maker);
            }
            else
            {
                // Copy the Monobjc assemblies
                BuildHelper.CopyMonobjcAssemblies(monitor, project, configuration, maker);

                // Write the native runtime
                monitor.BeginTask(GettextCatalog.GetString("Copying native launcher..."), 0);
                maker.WriteRuntime(project.TargetOSVersion);
                monitor.EndTask();
            }

            BuildHelper.CombineArtwork(monitor, project, maker);
            BuildHelper.EncryptContentFiles(monitor, project, configuration, maker);

            // Perform the signing
            BuildHelper.SignBundle(monitor, project, maker);
            BuildHelper.SignNativeBinaries(monitor, project, maker);
        }
        public static void Archive(IProgressMonitor monitor, BuildResult result, MonobjcProject project, ConfigurationSelector configuration, String outputDirectory)
        {
            monitor.BeginTask(GettextCatalog.GetString("Archiving..."), 0);

            // Infer application name from configuration
            String applicationName = project.GetApplicationName(configuration);

            // Create the bundle maker
            BundleMaker maker = new BundleMaker(applicationName, outputDirectory);

            // Archive the application
            BuildHelper.ArchiveBundle(monitor, project, maker);

            monitor.EndTask();
        }
        /// <summary>
        /// Combines the artwork.
        /// </summary>
        public static void CombineArtwork(IProgressMonitor monitor, MonobjcProject project, BundleMaker maker)
        {
            if (!project.CombineArtwork) {
                return;
            }

            monitor.BeginTask (GettextCatalog.GetString ("Combining artwork..."), 0);
            using (StringWriter outputWriter = new StringWriter()) {
                using (StringWriter errorWriter = new StringWriter()) {
                    ArtworkCombiner combiner = new ArtworkCombiner();
                    combiner.Combine(maker.ResourcesFolder, outputWriter, errorWriter);
                    LoggingService.LogInfo ("Combiner returns: " + outputWriter.ToString ());
                }
            }
            monitor.EndTask ();
        }
        /// <summary>
        ///   Archive the application bundle.
        /// </summary>
        /// <param name = 'monitor'>The progress monitor.</param>
        /// <param name = 'project'>The project.</param>
        /// <param name = 'maker'>The bundle maker.</param>
        public static void ArchiveBundle(IProgressMonitor monitor, MonobjcProject project, BundleMaker maker)
        {
            if (project.Archive && project.ArchiveIdentity != null) {
                FilePath definitionFile = project.BaseDirectory.Combine ("Definition.plist");
                String definitionFilename = File.Exists (definitionFile) ? definitionFile.ToString () : null;
                monitor.BeginTask (GettextCatalog.GetString ("Signing archive..."), 0);

                using (StringWriter outputWriter = new StringWriter()) {
                    using (StringWriter errorWriter = new StringWriter()) {
                        ProductBuild.ArchiveApplication (maker.ApplicationDirectory, project.ArchiveIdentity, definitionFilename, outputWriter, errorWriter);
                        LoggingService.LogInfo ("ProductBuild returns: " + outputWriter.ToString ());
                    }
                }

                monitor.EndTask ();
            }
        }
 /// <summary>
 ///   Copies the content files.
 /// </summary>
 /// <param name = 'monitor'>The progress monitor.</param>
 /// <param name = 'project'>The project.</param>
 /// <param name = 'configuration'>The configuration.</param>
 /// <param name = 'maker'>The bundle maker.</param>
 public static void CopyOutputFiles(IProgressMonitor monitor, MonobjcProject project, ConfigurationSelector configuration, BundleMaker maker)
 {
     IEnumerable<FilePair> files = project.GetOutputFiles (configuration, maker.ResourcesFolder);
     if (files == null || files.Count() == 0) {
         return;
     }
     monitor.BeginTask (GettextCatalog.GetString ("Copying output files..."), files.Count ());
     foreach (FilePair pair in files) {
         monitor.Log.WriteLine (GettextCatalog.GetString ("Copying {0}", pair.Source.ToRelative (project.BaseDirectory)));
         pair.Copy (false);
         monitor.Step (1);
     }
     monitor.EndTask ();
 }
        /// <summary>
        ///   Saves the specified project.
        /// </summary>
        public void Save(MonobjcProject project)
        {
            if (project == null) {
                throw new ArgumentNullException ("project");
            }

            project.ApplicationType = this.ApplicationType;
            project.ApplicationCategory = this.ApplicationCategory ?? String.Empty;
            project.BundleId = this.BundleId;
            project.BundleVersion = this.BundleVersion;
            project.TargetOSVersion = this.TargetOSVersion;
            project.MainNibFile = this.MainNibFile;
            project.BundleIcon = this.BundleIcon;
            project.Signing = this.Signing;
            project.SigningIdentity = this.SigningIdentity ?? String.Empty;
            project.UseEntitlements = this.UseEntitlements;
            project.OSFrameworks = this.OSFrameworks;

            project.TargetOSArch = this.TargetOSArch;
            project.EmbeddedFrameworks = this.EmbeddedFrameworks;
            project.AdditionalAssemblies = this.AdditionalAssemblies;
            project.ExcludedAssemblies = this.ExcludedAssemblies;
            project.AdditionalLibraries = this.AdditionalLibraries;

            project.Archive = this.Archive;
            project.ArchiveIdentity = this.ArchiveIdentity;

            project.DevelopmentRegion = this.DevelopmentRegion;
            project.CombineArtwork = this.CombineArtwork;
            project.EncryptionSeed = this.EncryptionSeed;

            project.UpdateReferences();
        }
 /// <summary>
 /// Copies the Monobjc assemblies.
 /// </summary>
 /// <param name="monitor">The monitor.</param>
 /// <param name="project">The project.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="maker">The maker.</param>
 public static void CopyMonobjcAssemblies(IProgressMonitor monitor, MonobjcProject project, ConfigurationSelector configuration, BundleMaker maker)
 {
     IEnumerable<String> assemblies = project.ProjectMonobjcAssemblies.Select (a => a.GetReferencedFileNames (configuration) [0]);
     monitor.BeginTask (GettextCatalog.GetString ("Copying Monobjc assemblies..."), assemblies.Count ());
     foreach (String assembly in assemblies) {
         String filename = Path.GetFileName (assembly);
         monitor.Log.WriteLine (GettextCatalog.GetString ("Copying {0}", filename));
         File.Copy (assembly, Path.Combine (maker.ResourcesFolder, filename), true);
         monitor.Step (1);
     }
     monitor.EndTask ();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="XcodeHandler"/> class.
 /// </summary>
 /// <param name="project">The project.</param>
 public XcodeHandler(MonobjcProject project)
     : base(project)
 {
     handlers.Add(this);
 }
        /// <summary>
        ///   Loads the specified project.
        /// </summary>
        public void Load(MonobjcProject project)
        {
            if (project == null) {
                throw new ArgumentNullException ("project");
            }
            this.project = project;

            this.filechooserbuttonMainNib.SetCurrentFolder (project.BaseDirectory.ToString ());
            this.filechooserbuttonBundleIcon.SetCurrentFolder (project.BaseDirectory.ToString ());

            this.ApplicationType = project.ApplicationType;
            this.ApplicationCategory = project.ApplicationCategory ?? String.Empty;
            this.BundleId = project.BundleId;
            this.BundleVersion = project.BundleVersion;
            this.TargetOSVersion = project.TargetOSVersion;
            this.MainNibFile = project.MainNibFile.ToString () ?? project.BaseDirectory.Combine ("en.lproj", "MainMenu.xib");
            this.BundleIcon = project.BundleIcon.ToString () ?? project.BaseDirectory.Combine ("Monobjc.icns");
            this.Signing = project.Signing;
            this.SigningIdentity = project.SigningIdentity ?? String.Empty;
            this.UseEntitlements = project.UseEntitlements;
            FillFrameworks(this.treeviewFrameworks, project, project.TargetOSVersion);
            this.OSFrameworks = project.OSFrameworks;

            this.TargetOSArch = project.TargetOSArch;
            FillEmbeddedFrameworks(this.treeviewEmbeddedFrameworks, project);
            this.EmbeddedFrameworks = project.EmbeddedFrameworks;
            this.AdditionalAssemblies = project.AdditionalAssemblies;
            this.ExcludedAssemblies = project.ExcludedAssemblies;
            this.AdditionalLibraries = project.AdditionalLibraries;

            this.Archive = project.Archive;
            this.ArchiveIdentity = project.ArchiveIdentity ?? String.Empty;

            FillDevelopmentRegions(this.comboboxDevelopmentRegion, project);
            this.DevelopmentRegion = project.DevelopmentRegion ?? "en";
            this.CombineArtwork = project.CombineArtwork;
            this.EncryptionSeed = project.EncryptionSeed;
        }
 /// <summary>
 /// Combines the artwork.
 /// </summary>
 public static void EncryptContentFiles(IProgressMonitor monitor, MonobjcProject project, ConfigurationSelector configuration, BundleMaker maker)
 {
     IEnumerable<FilePair> files = project.GetEncryptedContentFiles (configuration, maker.ResourcesFolder);
     if (files == null || files.Count() == 0) {
         return;
     }
     Aes provider = FileEncrypter.GetProvider (project.EncryptionSeed);
     monitor.BeginTask (GettextCatalog.GetString ("Encrypting content files..."), files.Count ());
     foreach (FilePair pair in files) {
         monitor.Log.WriteLine (GettextCatalog.GetString ("Encrypting {0}", pair.Source.ToRelative (project.BaseDirectory)));
         pair.Encrypt(provider);
         monitor.Step (1);
     }
     monitor.EndTask ();
 }
        /// <summary>
        ///   Sign the native libraries inside the bundle.
        /// </summary>
        /// <param name = 'monitor'>The progress monitor.</param>
        /// <param name = 'project'>The project.</param>
        /// <param name = 'maker'>The bundle maker.</param>
        public static void SignNativeBinaries(IProgressMonitor monitor, MonobjcProject project, BundleMaker maker)
        {
            if (project.Signing && !String.IsNullOrEmpty(project.SigningIdentity)) {
                String[] files = Directory.GetFiles (maker.MacOSDirectory, "*.dylib");
                if (files == null || files.Count() == 0) {
                    return;
                }

                monitor.BeginTask (GettextCatalog.GetString ("Signing native libraries..."), files.Length);

                foreach (String file in files) {
                    using (StringWriter outputWriter = new StringWriter()) {
                        using (StringWriter errorWriter = new StringWriter()) {
                            CodeSign.PerformSigning (file, project.SigningIdentity, outputWriter, errorWriter);
                            LoggingService.LogInfo ("CodeSign returns: " + outputWriter.ToString ());
                        }
                    }
                    monitor.Step (1);
                }

                monitor.EndTask ();
            }
        }
        public void Load(MonobjcProject proj)
        {
            devRegionEntry.Text = proj.BundleDevelopmentRegion ?? "";
            bundleIdEntry.Text = proj.BundleIdentifier ?? "";
            bundleVersionEntry.Text = proj.BundleVersion ?? "";
            displayNameEntry.Text = proj.BundleDisplayName ?? "";

            mainNibPicker.Project = proj;
            mainNibPicker.EntryIsEditable = true;
            mainNibPicker.DefaultFilter = "*.xib";
            mainNibPicker.DialogTitle = GettextCatalog.GetString ("Select main interface file...");
            mainNibPicker.SelectedFile = proj.MainNibFile.ToString () ?? "";

            appIconPicker.Project = proj;
            appIconPicker.DefaultFilter = "*.icns";
            appIconPicker.DialogTitle = GettextCatalog.GetString ("Select application icon...");
            appIconPicker.SelectedFile = proj.BundleIcon.ToString () ?? "";
        }
        public ImplementProtocolDialog(RefactoringOperation refactoring, RefactoringOptions options, MonobjcProject project)
            : base(refactoring, options, project)
        {
            this.Build ();

            // Configure the protocol TreeView
            // One column: Image|Text
            {
                TreeStore storeProtocols = new TreeStore (typeof(Gdk.Pixbuf), typeof(string), typeof(IType));

                TreeViewColumn column = new TreeViewColumn ();
                column.Title = GettextCatalog.GetString ("Protocol");
                column.Expand = true;
                column.Resizable = true;

                CellRendererPixbuf iconRenderer = new CellRendererPixbuf ();
                column.PackStart (iconRenderer, false);
                column.AddAttribute (iconRenderer, "pixbuf", 0);

                CellRendererText nameRenderer = new CellRendererText ();
                nameRenderer.Ellipsize = Pango.EllipsizeMode.End;
                column.PackStart (nameRenderer, true);
                column.AddAttribute (nameRenderer, "text", 1);

                this.treeviewProtocols.AppendColumn (column);
                storeProtocols.SetSortColumnId (1, SortType.Ascending);
                this.treeviewProtocols.Model = storeProtocols;

                this.treeviewProtocols.Selection.Changed += HandleTreeviewProtocolsSelectionhandleChanged;
            }

            // Configure the protocol TreeView
            // One column: Check|Image|Text
            {
                TreeStore storeMembers = new TreeStore (typeof(bool), typeof(Gdk.Pixbuf), typeof(string), typeof(IMember));

                TreeViewColumn column = new TreeViewColumn ();
                column.Title = GettextCatalog.GetString ("Members");
                column.Expand = true;
                column.Resizable = true;

                CellRendererToggle cbRenderer = new CellRendererToggle ();
                cbRenderer.Activatable = true;
                cbRenderer.Toggled += OnSelectToggled;
                column.PackStart (cbRenderer, false);
                column.AddAttribute (cbRenderer, "active", 0);

                CellRendererPixbuf iconRenderer = new CellRendererPixbuf ();
                column.PackStart (iconRenderer, false);
                column.AddAttribute (iconRenderer, "pixbuf", 1);

                CellRendererText nameRenderer = new CellRendererText ();
                nameRenderer.Ellipsize = Pango.EllipsizeMode.End;
                column.PackStart (nameRenderer, true);
                column.AddAttribute (nameRenderer, "text", 2);

                this.treeviewMembers.AppendColumn (column);
                storeMembers.SetSortColumnId (2, SortType.Ascending);
                this.treeviewMembers.Model = storeMembers;
            }

            this.buttonOk.Clicked += OnOKClicked;

            this.PopulateTreeView ();
            this.Validate ();
        }
 public ObjectiveCHeaderWriter(MonobjcProject project)
     : base(project)
 {
 }
 public void Store(MonobjcProject proj)
 {
     proj.BundleDevelopmentRegion = NullIfEmpty (devRegionEntry.Text);
     proj.BundleIdentifier = NullIfEmpty (bundleIdEntry.Text);
     proj.BundleVersion = NullIfEmpty (bundleVersionEntry.Text);
     proj.BundleDisplayName = NullIfEmpty (displayNameEntry.Text);
     proj.MainNibFile = NullIfEmpty (mainNibPicker.SelectedFile);
     proj.BundleIcon = NullIfEmpty (appIconPicker.SelectedFile);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DependencyHandler"/> class.
 /// </summary>
 /// <param name="project">The project.</param>
 public DependencyHandler(MonobjcProject project)
     : base(project)
 {
     this.DesignerExtension = Constants.DOT_DESIGNER + this.SourceExtension;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ResolverHandler"/> class.
 /// </summary>
 /// <param name="project">The project.</param>
 public ResolverHandler(MonobjcProject project)
     : base(project)
 {
 }
        private static void GenerateNative(IProgressMonitor monitor, BuildResult result, MonobjcProject project, ConfigurationSelector configuration, BundleMaker maker)
        {
            // Create a directory for generation
            String tempDir = Path.Combine(project.GetOutputFileName(configuration).ParentDirectory, ".native");
            Directory.CreateDirectory(tempDir);

            // Build a list of all folders to visit when collecting managed references
            String mainAssembly = project.GetOutputFileName(configuration);
            String configurationDir = Path.GetDirectoryName(mainAssembly);
            List<String> searchDirs = new List<String>();
            searchDirs.Add(configurationDir);

            // For each reference, add its base dir
            foreach (ProjectReference reference in project.References)
            {
                String[] files = reference.GetReferencedFileNames(configuration);
                foreach (string file in files)
                {
                    String dir = Path.GetDirectoryName(file);
                    searchDirs.Add(dir);
                }
            }

            // Remove redundant entries
            searchDirs = searchDirs.Distinct().ToList();

            // Collect all the assemblies
            monitor.BeginTask(GettextCatalog.GetString("Collecting assemblies..."), 0);
            ManagedReferenceCollector collector = new ManagedReferenceCollector();
            collector.Logger = new BuildLogger(monitor, result);
            collector.SearchDirectories = searchDirs;
            monitor.EndTask();

            // Collect the main assembly references
            List<String> assemblies = new List<String>();
            assemblies.AddRange(collector.Collect(mainAssembly));

            // Remove redundant entries
            assemblies = assemblies.Distinct().ToList();

            // Generate the embedded executable
            monitor.BeginTask(GettextCatalog.GetString("Generating native code..."), 0);
            NativeCodeGenerator codeGenerator = new NativeCodeGenerator();
            codeGenerator.Logger = new BuildLogger(monitor, result);
            codeGenerator.Assemblies = assemblies;
            codeGenerator.DeveloperToolsFolder = DeveloperToolsDesktopApplication.DeveloperToolsFolder;
            codeGenerator.TargetOSVersion = project.TargetOSVersion;
            codeGenerator.TargetArchitecture = project.TargetOSArch;

            // We embed the machine.config file; it depends on the target framework
            int version = (int) project.TargetFramework.ClrVersion;
            switch (version)
            {
                case 2: // ClrVersion.Net_2_0:
                    codeGenerator.MachineConfiguration = "/Library/Frameworks/Mono.framework/Home/etc/mono/2.0/machine.config";
                    break;
                case 4: // ClrVersion.Net_4_0:
                    codeGenerator.MachineConfiguration = "/Library/Frameworks/Mono.framework/Home/etc/mono/4.0/machine.config";
                    break;
                case 5: // ClrVersion.Net_4_5:
                    codeGenerator.MachineConfiguration = "/Library/Frameworks/Mono.framework/Home/etc/mono/4.5/machine.config";
                    break;
            }

            // Launch the generation
            String executableFile = codeGenerator.Generate(tempDir);
            String libraryFile = Path.Combine(tempDir, "libmonobjc.dylib");
            monitor.EndTask();

            // Copy the native parts into the bundle
            monitor.BeginTask(GettextCatalog.GetString("Copying native code..."), 0);
            maker.CopyTo(executableFile, maker.MacOSDirectory);
            maker.CopyTo(libraryFile, maker.MacOSDirectory);
            monitor.EndTask();

            // Change the paths
            executableFile = maker.Combine(maker.MacOSDirectory, executableFile);
            libraryFile = maker.Combine(maker.MacOSDirectory, libraryFile);

            // Relocate the libraries
            monitor.BeginTask(GettextCatalog.GetString("Relocating native code..."), 0);
            NativeCodeRelocator relocator = new NativeCodeRelocator();
            relocator.Logger = new BuildLogger(monitor, result);
            relocator.DependencyPattern = new List<string> {"Mono.framework"};
            relocator.Relocate(executableFile, maker.MacOSDirectory);
            relocator.Relocate(libraryFile, maker.MacOSDirectory);
            monitor.EndTask();
        }
        /// <summary>
        ///   Creates the Info.plist file.
        /// </summary>
        /// <param name = 'monitor'>The progress monitor.</param>
        /// <param name = 'project'>The project.</param>
        /// <param name = 'configuration'>The configuration.</param>
        /// <param name = 'maker'>The bundle maker.</param>
        public static void CreateInfoPList(IProgressMonitor monitor, MonobjcProject project, ConfigurationSelector configuration, BundleMaker maker)
        {
            monitor.BeginTask (GettextCatalog.GetString ("Generating the Info.plist..."), 0);

            InfoPListGenerator pListGenerator = new InfoPListGenerator ();

            // If an Info.plist exists in the project then use it
            FilePath infoPListFile = project.BaseDirectory.Combine (Constants.INFO_PLIST);
            if (File.Exists (infoPListFile)) {
                pListGenerator.Content = File.ReadAllText (infoPListFile);
            }

            String mainAssembly = project.GetOutputFileName (configuration);
            Assembly assembly = Assembly.ReflectionOnlyLoadFrom (mainAssembly);
            AssemblyName assemblyName = assembly.GetName ();

            // TODO: Review to use new parameters
            pListGenerator.DevelopmentRegion = project.DevelopmentRegion;
            pListGenerator.ApplicationName = assemblyName.Name;
            pListGenerator.Identifier = project.BundleId;
            pListGenerator.Version = project.BundleVersion;
            pListGenerator.Icon = project.BundleIcon.IsNullOrEmpty ? null : project.BundleIcon.FileNameWithoutExtension;
            pListGenerator.MainNibFile = project.MainNibFile.IsNullOrEmpty ? null : project.MainNibFile.FileNameWithoutExtension;
            pListGenerator.TargetOSVersion = project.TargetOSVersion;
            pListGenerator.PrincipalClass = "NSApplication";
            pListGenerator.WriteTo (Path.Combine (maker.ContentsDirectory, Constants.INFO_PLIST));

            monitor.EndTask ();
        }
 /// <summary>
 /// Get the type cache for the given project.
 /// </summary>
 public static ProjectTypeCache Get(MonobjcProject project)
 {
     ProjectTypeCache cache;
     if (!caches.TryGetValue (project, out cache)) {
         IDELogger.Log ("ProjectTypeCache::Get -- create cache for {0}", project.Name);
         cache = new ProjectTypeCache (project);
         caches.Add (project, cache);
     }
     return cache;
 }
        /// <summary>
        ///   Embeds the XIB files.
        /// </summary>
        /// <param name = 'monitor'>The progress monitor.</param>
        /// <param name = 'project'>The project.</param>
        /// <param name = 'maker'>The bundle maker.</param>
        /// <param name = 'result'>The build result.</param>
        public static void EmbedXIBFiles(IProgressMonitor monitor, MonobjcProject project, BuildResult result)
        {
            XibCompiler xibCompiler = new XibCompiler ();
            IEnumerable<FilePair> files = project.GetIBFiles (Constants.EmbeddedInterfaceDefinition, null);
            if (files == null || files.Count() == 0) {
                return;
            }

            monitor.BeginTask (GettextCatalog.GetString ("Embed XIB files..."), files.Count ());
            foreach (FilePair pair in files) {
                // If the destination file is a place-holder, change its dates
                FileInfo sourceInfo = new FileInfo (pair.Source);
                FileInfo destInfo = new FileInfo (pair.Destination);
                if (destInfo.Length == 0) {
                    DateTime dateTime = sourceInfo.CreationTime.Subtract (new TimeSpan (0, 0, 1));
                    File.SetCreationTime (pair.Destination, dateTime);
                    File.SetLastAccessTime (pair.Destination, dateTime);
                    File.SetLastWriteTime (pair.Destination, dateTime);
                }

                FilePath relativeFile = pair.Source.ToRelative (project.BaseDirectory);
                monitor.Log.WriteLine (GettextCatalog.GetString ("Compiling {0}", relativeFile));
                xibCompiler.Logger = new BuildLogger (pair.Source, monitor, result);
                xibCompiler.Compile (pair.Source, pair.DestinationDir);

                monitor.Step (1);
            }
            monitor.EndTask ();
        }
 protected ObjectiveCWriter(MonobjcProject project)
 {
     this.project = project;
     this.cache = ProjectTypeCache.Get(this.project);
 }
        /// <summary>
        ///   Sign the application bundle.
        /// </summary>
        /// <param name = 'monitor'>The progress monitor.</param>
        /// <param name = 'project'>The project.</param>
        /// <param name = 'maker'>The bundle maker.</param>
        public static void SignBundle(IProgressMonitor monitor, MonobjcProject project, BundleMaker maker)
        {
            if (project.Signing && !String.IsNullOrEmpty(project.SigningIdentity)) {
                monitor.BeginTask (GettextCatalog.GetString ("Signing bundle..."), 0);

                using (StringWriter outputWriter = new StringWriter()) {
                    using (StringWriter errorWriter = new StringWriter()) {
                        FilePath file = project.BaseDirectory.Combine(Constants.APP_ENTITLEMENTS);
                        if (project.UseEntitlements && File.Exists(file)) {
                            monitor.Log.WriteLine (GettextCatalog.GetString ("Signing with identity '{0}' and entitlements '{1}'", project.SigningIdentity, file.FileName));
                            CodeSign.PerformSigning (maker.ApplicationDirectory, project.SigningIdentity, file, outputWriter, errorWriter);
                        } else {
                            monitor.Log.WriteLine (GettextCatalog.GetString ("Signing with identity='{0}'", project.SigningIdentity));
                            CodeSign.PerformSigning (maker.ApplicationDirectory, project.SigningIdentity, outputWriter, errorWriter);
                        }
                        LoggingService.LogInfo ("CodeSign returns: " + outputWriter.ToString ());
                    }
                }

                monitor.EndTask ();
            }
        }
 /// <summary>
 /// Determines whether the preferences can be saved.
 /// </summary>
 public bool CanSave(MonobjcProject project, out String message)
 {
     if (this.entryBundleIdentifier.Text.Length == 0) {
         message = GettextCatalog.GetString("The value for the bundle identifier is not valid. It cannot be empty.");
         return false;
     }
     if (this.entryBundleVersion.Text.Length == 0) {
         message = GettextCatalog.GetString("The value for the bundle version is not valid. It cannot be empty.");
         return false;
     }
     message = String.Empty;
     return true;
 }
 /// <summary>
 ///   Uses the specified project.
 /// </summary>
 /// <param name = "project">The project.</param>
 public void Use(MonobjcProject project)
 {
     this.project = project;
 }
 public BaseRefactoringDialog(RefactoringOperation refactoring, RefactoringOptions options, MonobjcProject project)
 {
     this.Refactoring = refactoring;
     this.Options = options;
     this.Project = project;
 }
 /// <summary>
 ///   Compiles the XIB files.
 /// </summary>
 /// <param name = 'monitor'>The progress monitor.</param>
 /// <param name = 'project'>The project.</param>
 /// <param name = 'maker'>The bundle maker.</param>
 /// <param name = 'result'>The build result.</param>
 public static void CompileXIBFiles(IProgressMonitor monitor, MonobjcProject project, BundleMaker maker, BuildResult result)
 {
     XibCompiler xibCompiler = new XibCompiler ();
     IEnumerable<FilePair> files = project.GetIBFiles (Constants.InterfaceDefinition, maker.ResourcesFolder);
     if (files == null || files.Count() == 0) {
         return;
     }
     List<FilePair> pairs = new List<FilePair> (files);
     monitor.BeginTask (GettextCatalog.GetString ("Compiling XIB files..."), files.Count ());
     foreach (FilePair pair in pairs) {
         monitor.Log.WriteLine (GettextCatalog.GetString ("Compiling {0}", pair.Source.ToRelative (project.BaseDirectory)));
         xibCompiler.Logger = new BuildLogger (pair.Source, monitor, result);
         xibCompiler.Compile (pair.Source, pair.DestinationDir);
         monitor.Step (1);
     }
     monitor.EndTask ();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MonoDevelop.Monobjc.Utilities.ProjectTypeCache"/> class.
 /// </summary>
 private ProjectTypeCache(MonobjcProject project)
 {
     this.Project = project;
 }