/// <summary>Initializes a new instance of the <see cref="ProgId"/> class.</summary> /// <param name="progId">The programmatic identifier string.</param> /// <param name="readOnly">if set to <c>true</c> disallow changes.</param> /// <param name="autoLoadVersioned"> /// if set to <c>true</c> automatically load a referenced versioned ProgId instead of the specified ProgId. /// </param> /// <param name="systemWide">if set to <c>true</c> get the system wide value.</param> /// <exception cref="ArgumentException">Unable to load specified ProgId - progId</exception> public ProgId(string progId, bool readOnly = true, bool autoLoadVersioned = true, bool systemWide = false) : base(ShellRegistrar.GetRoot(systemWide, !readOnly, progId ?? throw new ArgumentNullException(nameof(progId))), readOnly) { if (autoLoadVersioned) { var cv = key.GetSubKeyDefaultValue("CurVer")?.ToString(); if (cv != null) { key = ShellRegistrar.GetRoot(systemWide, !readOnly).OpenSubKey(cv, !readOnly); } } if (key == null) { throw new ArgumentException("Unable to load specified ProgId", nameof(progId)); } ID = progId; Verbs = new CommandVerbDictionary(this, readOnly); }
internal ProgId(string progId, RegistryKey pkey, bool readOnly) : base(pkey, readOnly) { ID = progId; FileTypeAssociations = new FileTypeCollection(progId, readOnly, IsSystemWide); Verbs = new CommandVerbDictionary(this, readOnly); }
internal ProgId(string progId, RegistryKey pkey, bool readOnly) : base(pkey, readOnly) { ID = progId; Verbs = new CommandVerbDictionary(this, readOnly); }