Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of <see cref="ModuleInfo"/>.
        /// </summary>
        /// <param name="name">The module's name.</param>
        /// <param name="type">The module <see cref="Type"/>'s AssemblyQualifiedName.</param>
        /// <param name="dependsOn">The modules this instance depends on.</param>
        /// <exception cref="ArgumentNullException">An <see cref="ArgumentNullException"/> is thrown if <paramref name="dependsOn"/> is <see langword="null"/>.</exception>
        public ModuleInfo(string name, string type, params string[] dependsOn)
        {
            if (Type.GetType(type) == null)
            {
                throw new ArgumentNullException(nameof(type));
            }
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (dependsOn == null)
            {
                throw new ArgumentNullException(nameof(dependsOn));
            }

            ModuleName = name;
            ModuleType = type;
            foreach (string dependency in dependsOn)
            {
                if (!DependsOn.Contains(dependency))
                {
                    DependsOn.Add(dependency);
                }
            }
        }
Exemplo n.º 2
0
 public void AddDependsOn(Project p)
 {
     if (!DependsOn.Contains(p))
     {
         DependsOn.Add(p);
     }
     if (!p.IsDependencyFor.Contains(this))
     {
         p.IsDependencyFor.Add(this);
     }
 }