public FileGUIDListBase BuildSectionAny(PBXNativeTargetData target, string path, bool isFolderRef) { string ext = Path.GetExtension(path); var phase = FileTypeUtils.GetFileType(ext, isFolderRef); switch (phase) { case PBXFileType.Framework: foreach (var guid in target.phases) { if (frameworks.HasEntry(guid)) { return(frameworks[guid]); } } break; case PBXFileType.Resource: foreach (var guid in target.phases) { if (resources.HasEntry(guid)) { return(resources[guid]); } } break; case PBXFileType.Source: foreach (var guid in target.phases) { if (sources.HasEntry(guid)) { return(sources[guid]); } } break; case PBXFileType.CopyFile: foreach (var guid in target.phases) { if (copyFiles.HasEntry(guid)) { return(copyFiles[guid]); } } break; } return(null); }
// This function returns a build section that a particular file should be automatically added to. // Returns null for non-buildable file types. // Throws an exception if the file should be added to a section, but that particular section does not exist for given target // Note that for unknown file types we add them to resource build sections public FileGUIDListBase BuildSectionAny(PBXNativeTargetData target, string path, bool isFolderRef) { string ext = Path.GetExtension(path); var phase = FileTypeUtils.GetFileType(ext, isFolderRef); switch (phase) { case PBXFileType.Framework: foreach (var guid in target.phases) { if (frameworks.HasEntry(guid)) { return(frameworks[guid]); } } break; case PBXFileType.Resource: foreach (var guid in target.phases) { if (resources.HasEntry(guid)) { return(resources[guid]); } } break; case PBXFileType.Source: foreach (var guid in target.phases) { if (sources.HasEntry(guid)) { return(sources[guid]); } } break; case PBXFileType.CopyFile: foreach (var guid in target.phases) { if (copyFiles.HasEntry(guid)) { return(copyFiles[guid]); } } break; case PBXFileType.ShellScript: foreach (var guid in target.phases) { if (shellScripts.HasEntry(guid)) { return(shellScripts[guid]); } } break; case PBXFileType.NotBuildable: return(null); } throw new Exception(String.Format("The given path {0} does not refer to a file in a known build section", path)); }