Ejemplo n.º 1
0
        /// <summary>
        /// Merges the <paramref name="addon"/> <see cref="RegistryXml"/> keys and values into the host's, and destroys the former.
        /// The <see cref="Key"/> or <see cref="Value"/> colections may be <c>Null</c> on either parameter, but on return they're guaranteed to be non-<c>Null</c> in this object.
        /// </summary>
        public void MergeWith([NotNull] RegistryXml addon)
        {
            if (addon == null)
            {
                throw new ArgumentNullException("addon");
            }

            var keys   = new List <RegistryKeyXml>(Key ?? new RegistryKeyXml[] {});
            var values = new List <RegistryValueXml>(Value ?? new RegistryValueXml[] {});

            foreach (RegistryKeyXml key in addon.Key ?? new RegistryKeyXml[] {})
            {
                keys.Add(key);
            }
            foreach (RegistryValueXml value in addon.Value ?? new RegistryValueXml[] {})
            {
                values.Add(value);
            }

            addon.Key   = new RegistryKeyXml[] {};
            addon.Value = new RegistryValueXml[] {};

            Key   = keys.ToArray();
            Value = values.ToArray();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Makes sure all of the collections are non-Null (but may be empty).
 /// </summary>
 public void EnsureNotNull()
 {
     if (Registry == null)
     {
         Registry = new RegistryXml();
     }
     Registry.EnsureNotNull();
     if (Files == null)
     {
         Files = new FolderXml[] {}
     }
     ;
 }
Ejemplo n.º 3
0
        public InstallationDataXml([NotNull] RegistryXml registry, [NotNull] params FolderXml[] folders)
        {
            if (registry == null)
            {
                throw new ArgumentNullException("registry");
            }
            if (folders == null)
            {
                throw new ArgumentNullException("folders");
            }

            Registry = registry;
            Files    = folders;
        }
Ejemplo n.º 4
0
 public InstallationDataXml(RegistryXml registry)
     : this(registry, new FolderXml[] {})
 {
 }