Monobjc.Tools.Xcode.PBXGroup.FindVariantGroup C# (CSharp) Method

FindVariantGroup() public method

Finds the file reference.
public FindVariantGroup ( String name ) : PBXVariantGroup
name String The name.
return PBXVariantGroup
        public PBXVariantGroup FindVariantGroup(String name)
        {
            return this.Find(PBXElementType.PBXVariantGroup, name) as PBXVariantGroup;
        }

Usage Example

Beispiel #1
0
        /// <summary>
        ///   Removes the file.
        /// </summary>
        /// <param name = "groups">The groups.</param>
        /// <param name = "file">The file.</param>
        /// <returns></returns>
        public PBXFileReference RemoveFile(String groups, String file)
        {
            lock (this.syncRoot) {
                // Prepare the group that contains the file
                PBXGroup         group         = this.GetGroup(groups);
                PBXFileReference fileReference = null;
                PBXFileElement   result        = null;

                // Extract information
                String name      = Path.GetFileName(file);
                String parentDir = Path.GetDirectoryName(file);

                // If the file is localized, search for the variant group
                if (Path.GetExtension(parentDir).Equals(".lproj"))
                {
                    PBXVariantGroup variantGroup = group.FindVariantGroup(name);
                    if (variantGroup != null)
                    {
                        // The file is named like the language
                        name = Path.GetFileNameWithoutExtension(parentDir);
                    }
                    group  = variantGroup;
                    result = variantGroup;
                }

                if (group != null)
                {
                    // Search for the file and remove it
                    fileReference = group.FindFileReference(name);
                    if (fileReference != null)
                    {
                        group.RemoveChild(fileReference);
                    }
                }

                if (result == null)
                {
                    result = fileReference;
                }
                return(fileReference);
            }
        }
All Usage Examples Of Monobjc.Tools.Xcode.PBXGroup::FindVariantGroup