예제 #1
0
 Tuple<Resource, string[]>[] PartitionResourceReferences(UnresolvedResource[] resources, HashSet<string> pathsInModule)
 {
     return resources.Select(
         resource => resource.Resolve(pathsInModule.Contains)
     ).ToArray();
 }
예제 #2
-1
        /// <param name="path">Application relative path to the module directory.</param>
        /// <param name="resources">All the unresolved resources found in the module.</param>
        /// <param name="isResourceOrderFixed">When true, the resources will not be sorted by their dependency ordering.</param>
        public UnresolvedModule(string path, UnresolvedResource[] resources, string location, bool isResourceOrderFixed)
        {
            this.path = path;
            this.location = location;

            var pathsInModule = new HashSet<string>(resources.Select(resource => resource.Path));
            partition = PartitionResourceReferences(resources, pathsInModule);
            // Store all the references to external resources.
            this.externalReferences = partition.SelectMany(p => p.Item2).Distinct().ToArray();
            // The resources now only contain references found in this module.
            var resolvedResources = partition.Select(p => p.Item1).ToArray();
            if (isResourceOrderFixed)
            {
                this.resources = resolvedResources;
            }
            else
            {
                this.resources = OrderScriptsByDependency(resolvedResources);
            }
        }