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

CollectAutoPlays() public method

Collects data about AutoPlay handlers.
There was an error accessing the registry. Read access to the registry was not permitted.
public CollectAutoPlays ( [ commandMapper, [ capabilities ) : void
commandMapper [ Provides best-match command-line to mapping.
capabilities [ The capability list to add the collected data to.
return void
        public void CollectAutoPlays([NotNull] CommandMapper commandMapper, [NotNull] CapabilityList capabilities)
        {
            #region Sanity checks
            if (capabilities == null) throw new ArgumentNullException(nameof(capabilities));
            if (commandMapper == null) throw new ArgumentNullException(nameof(commandMapper));
            #endregion

            capabilities.Entries.AddRange(AutoPlayHandlersUser
                .Select(handler => GetAutoPlay(handler, Registry.CurrentUser, AutoPlayAssocsUser, commandMapper))
                .WhereNotNull());

            capabilities.Entries.AddRange(AutoPlayHandlersMachine
                .Select(handler => GetAutoPlay(handler, Registry.LocalMachine, AutoPlayAssocsMachine, commandMapper))
                .WhereNotNull());
        }

Usage Example

        private static CapabilityList GetCapabilityList(CommandMapper commandMapper, SnapshotDiff diff)
        {
            var capabilities = new CapabilityList {
                OS = OS.Windows
            };
            string appName = null, appDescription = null;

            diff.CollectFileTypes(commandMapper, capabilities);
            diff.CollectContextMenus(commandMapper, capabilities);
            diff.CollectAutoPlays(commandMapper, capabilities);
            diff.CollectDefaultPrograms(commandMapper, capabilities, ref appName);

            var appRegistration = diff.GetAppRegistration(commandMapper, capabilities, ref appName, ref appDescription);

            if (appRegistration != null)
            {
                capabilities.Entries.Add(appRegistration);
            }
            else
            { // Only collect URL protocols if there wasn't already an application registration that covered them
                diff.CollectProtocolAssocs(commandMapper, capabilities);
            }

            return(capabilities);
        }
All Usage Examples Of ZeroInstall.Publish.Capture.SnapshotDiff::CollectAutoPlays