private static void AddExtensionToFileType([NotNull] string extension, [NotNull] string progID, [NotNull] CapabilityList capabilities)
{
#region Sanity checks
if (string.IsNullOrEmpty(progID)) throw new ArgumentNullException(nameof(progID));
if (string.IsNullOrEmpty(extension)) throw new ArgumentNullException(nameof(extension));
if (capabilities == null) throw new ArgumentNullException(nameof(capabilities));
#endregion
// Find the matching existing file type
var fileType = capabilities.Entries.OfType<FileType>().FirstOrDefault(type => type.ID == progID);
if (fileType != null)
{
// Check if the file type already has the extension and add it if not
if (!fileType.Extensions.Any(element => StringUtils.EqualsIgnoreCase(element.Value, extension)))
fileType.Extensions.Add(new FileTypeExtension {Value = extension.ToLower()});
}
}
#endregion