Пример #1
0
        /// <summary>
        /// Removes the dependant project.
        /// </summary>
        /// <param name="referenceProxy">The reference proxy.</param>
        private void RemoveDependantProject(PBXReferenceProxy referenceProxy)
        {
            lock (this.syncRoot) {
                // Add a dummy group for references
                PBXGroup referenceGroup = this.AddGroup("References");

                // Get proxies references
                PBXContainerItemProxy containerItemProxy = referenceProxy.RemoteRef;
                PBXFileReference      fileReference      = containerItemProxy.ContainerPortal;

                // Remove file reference
                this.Project.MainGroup.RemoveChild(fileReference);

                // Remove proxy
                referenceGroup.RemoveChild(referenceProxy);

                // Remove association
                this.Project.RemoveProjectReference(fileReference);
            }
        }
Пример #2
0
        /// <summary>
        ///   Adds the dependant project.
        /// </summary>
        /// <param name = "project">The project.</param>
        /// <param name = "targetName">Name of the target.</param>
        public void AddDependantProject(XcodeProject project, String targetName)
        {
            lock (this.syncRoot) {
                // Get the native target
                PBXNativeTarget target = project.GetDefaultTarget() as PBXNativeTarget;
                if (target == null)
                {
                    return;
                }

                // Get the product reference
                PBXFileReference productReference = target.ProductReference;

                // Add a dummy group for references
                PBXGroup referecenGroup = this.AddGroup("References");

                // Add file reference
                PBXFileReference fileReference = this.AddFile(String.Empty, project.ProjectFolder) as PBXFileReference;

                // Add proxy
                PBXContainerItemProxy itemProxy = new PBXContainerItemProxy();
                itemProxy.ContainerPortal      = fileReference;
                itemProxy.ProxyType            = 2;      // TODO: Find other values
                itemProxy.RemoteInfo           = Path.GetFileNameWithoutExtension(fileReference.Name);
                itemProxy.RemoteGlobalIDString = project.Document.Mapping [productReference];

                // Add reference proxy
                PBXReferenceProxy referenceProxy = new PBXReferenceProxy();
                referenceProxy.RemoteRef  = itemProxy;
                referenceProxy.SourceTree = PBXSourceTree.BuildProductDir;
                referenceProxy.FileType   = productReference.ExplicitFileType;
                referenceProxy.Path       = Path.GetFileName(productReference.Path);

                // Add reference proxy
                referecenGroup.AddChild(referenceProxy);

                // Add association
                this.Project.AddProjectReference(referecenGroup, fileReference);
            }
        }