ZeroInstall.Publish.Capture.SnapshotDiff.CollectFileAssocsEx C# (CSharp) Method

CollectFileAssocsEx() private static method

Collects data about file assocations indicated by registered application capabilities.
There was an error accessing the registry. Read access to the registry was not permitted.
private static CollectFileAssocsEx ( [ capsKey, [ capabilities ) : void
capsKey [ A registry key containing capability information for a registered application.
capabilities [ The capability list to add the collected data to.
return void
        private static void CollectFileAssocsEx([NotNull] RegistryKey capsKey, [NotNull] CapabilityList capabilities)
        {
            #region Sanity checks
            if (capsKey == null) throw new ArgumentNullException(nameof(capsKey));
            if (capabilities == null) throw new ArgumentNullException(nameof(capabilities));
            #endregion

            using (var fileAssocKey = capsKey.OpenSubKey(DesktopIntegration.Windows.AppRegistration.RegSubKeyFileAssocs))
            {
                if (fileAssocKey == null) return;

                foreach (string extension in fileAssocKey.GetValueNames())
                {
                    var progID = fileAssocKey.GetValue(extension, "") as string;
                    if (!string.IsNullOrEmpty(progID)) AddExtensionToFileType(extension, progID, capabilities);
                }
            }
        }