/// <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);
}
}