Exemple #1
0
        /// <summary>
        /// <para>
        /// Finds the resource URL closure for the given starting assembly list.
        /// </para>
        /// The closure is computed recursively from the referenced assemblies;
        /// satellite assemblies for the current culture are included also.
        /// </summary>
        /// <remarks>
        /// Referenced System, IKVM, Hsqldb core and NUnit assemblies are excluded.
        /// </remarks>
        /// <param name="startingList">The starting assembly list.</param>
        /// <returns>
        /// An array of <c>ikvmres:</c> protocol URLs describing the useful portion
        /// of the reference closure for the starting list.
        /// </returns>
        //[CLSCompliant(false)]
        public static URL[] FindResourceURLClosure(List <Assembly> startingList)
        {
            if (startingList == null)
            {
                throw new ArgumentNullException("startingList");
            }

            Set included    = new HashSet();
            Set encountered = new HashSet();

            foreach (Assembly entry in startingList)
            {
                AddAssembly(encountered, included, entry);
            }

            Assembly[] assemblies = new Assembly[included.size()];

            included.toArray(assemblies);

            URL[] urls = new URL[included.size()];

            for (int i = 0; i < assemblies.Length; i++)
            {
                Assembly entry     = assemblies[i];
                string   entryName = URLEncoder.encode(entry.FullName, "UTF-8");
                string   entryUrl  = string.Concat("ikvmres://", entryName, "/");

                try
                {
                    urls[i] = new URL(entryUrl);
                }
                catch (Exception ex)
                {
#if DEBUG
                    Debug.WriteLine("URL: " + entryUrl);
                    Debug.WriteLine(ex);
#endif
                }
            }

            return(urls);
        }
        /// <summary>
        /// <para>
        /// Finds the resource URL closure for the given starting assembly list.
        /// </para>
        /// The closure is computed recursively from the referenced assemblies;
        /// satellite assemblies for the current culture are included also.
        /// </summary>
        /// <remarks>
        /// Referenced System, IKVM, Hsqldb core and NUnit assemblies are excluded.
        /// </remarks>
        /// <param name="startingList">The starting assembly list.</param>
        /// <returns>
        /// An array of <c>ikvmres:</c> protocol URLs describing the useful portion
        /// of the reference closure for the starting list.
        /// </returns>
        //[CLSCompliant(false)]
        public static URL[] FindResourceURLClosure(List<Assembly> startingList)
        {
            if (startingList == null)
            {
                throw new ArgumentNullException("startingList");
            }

            Set included = new HashSet();
            Set encountered = new HashSet();

            foreach (Assembly entry in startingList)
            {
                AddAssembly(encountered, included, entry);
            }

            Assembly[] assemblies = new Assembly[included.size()];

            included.toArray(assemblies);

            URL[] urls = new URL[included.size()];

            for (int i = 0; i < assemblies.Length; i++)
            {
                Assembly entry = assemblies[i];
                string entryName = URLEncoder.encode(entry.FullName, "UTF-8");
                string entryUrl = string.Concat("ikvmres://", entryName, "/");

                try
                {
                    urls[i] = new URL(entryUrl);
                }
                catch (Exception ex)
                {
            #if DEBUG
                    Debug.WriteLine("URL: " + entryUrl);
                    Debug.WriteLine(ex);
            #endif
                }
            }

            return urls;
        }