/// <summary>
        /// Parses the specified assembly.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <param name="sourceFiles">The source files.</param>
        /// <returns></returns>
        public static IEnumerable <DnnPackage> Parse(Assembly assembly, ITaskItem[] sourceFiles)
        {
            var packageReflector = new ReflectPackages(assembly);
            var packages         = packageReflector.GetPackages();

            ReflectComponentModules.AssignComponents(assembly, packages, sourceFiles);

            return(packages);
        }
        /// <summary>
        /// Parses the specified assembly.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <param name="packages">The packages.</param>
        /// <param name="sourceFiles">The source files.</param>
        /// <returns></returns>
        public static void AssignComponents(Assembly assembly, IEnumerable <DnnPackage> packages, ITaskItem[] sourceFiles)
        {
            var parser         = new ReflectComponentModules(assembly, packages, sourceFiles);
            var desktopModules = parser.GetDesktopModules();

            desktopModules.ForEach(
                desktopModule =>
            {
                var moduleComponent = new DnnComponentModule(desktopModule);

                // Find the package to which this module component belongs.
                var packageName = moduleComponent.DesktopModule.ModuleName;
                var package     = packages.FirstOrDefault(arg => arg.Name.Equals(packageName, StringComparison.InvariantCultureIgnoreCase));

                // Update the module component with package details.
                moduleComponent.DesktopModule.ModuleDefinitions.Definitions.ForEach(definition => definition.FriendlyName = package.FriendlyName);

                // Add the module component
                package.Components.Components.Add(moduleComponent);
            });
        }
        /// <summary>
        /// Parses the specified assembly.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <param name="packages">The packages.</param>
        /// <param name="sourceFiles">The source files.</param>
        /// <returns></returns>
        public static void AssignComponents(Assembly assembly, IEnumerable<DnnPackage> packages, ITaskItem[] sourceFiles)
        {
            var parser = new ReflectComponentModules(assembly, packages, sourceFiles);
            var desktopModules = parser.GetDesktopModules();

            desktopModules.ForEach(
                desktopModule =>
                    {
                        var moduleComponent = new DnnComponentModule(desktopModule);

                        // Find the package to which this module component belongs.
                        var packageName = moduleComponent.DesktopModule.ModuleName;
                        var package = packages.FirstOrDefault(arg => arg.Name.Equals(packageName, StringComparison.InvariantCultureIgnoreCase));

                        // Update the module component with package details.
                        moduleComponent.DesktopModule.ModuleDefinitions.Definitions.ForEach(definition => definition.FriendlyName = package.FriendlyName);

                        // Add the module component
                        package.Components.Components.Add(moduleComponent);
                    });
        }