Beispiel #1
0
        //=====================================================================

        /// <summary>
        /// This is called to visit all namespaces, types, and members in the list of assemblies to be documented
        /// </summary>
        public void VisitApis()
        {
            // Store types.  We have to do this after all assemblies are registered because the resolution may
            // not work unless all the assemblies we need are in the resolver cache.
            foreach (AssemblyNode assembly in assemblies)
            {
                this.StoreTypes(assembly.Types);

                if (this.Canceled)
                {
                    break;
                }
            }

            if (!this.Canceled)
            {
                NamespaceList spaces = new NamespaceList();

                foreach (Namespace space in catalog.Values)
                {
                    if (filter.IsExposedNamespace(space))
                    {
                        spaces.Add(space);
                    }
                }

                if (!this.Canceled)
                {
                    this.VisitNamespaces(spaces);
                }
            }
        }
Beispiel #2
0
        // Visit Object Model

        public void VisitApis()
        {
            // store types
            // we have to do this after all assemblies are registered because the resolution may not work unless
            // all the assemblies we need are in the resolver cache
            //Console.WriteLine("storing types");
            foreach (AssemblyNode assembly in assemblies)
            {
                //Console.WriteLine("assembly {0}", assembly.Name);
                //Console.WriteLine("has {0} types", assembly.Types.Count);
                StoreTypes(assembly.Types);
                //Console.WriteLine("done with assembly");
            }
            //Console.WriteLine("done storing types");

            //Console.WriteLine("visiting namespaces");
            NamespaceList spaces = new NamespaceList();

            foreach (Namespace space in catalog.Values)
            {
                if (filter.IsExposedNamespace(space))
                {
                    spaces.Add(space);
                }
            }
            VisitNamespaces(spaces);
        }
Beispiel #3
0
        public static void init( )
        {
            // if ( allNamespaces != null ) return;
            allNamespaces = new NamespaceList();

            nsCached = new Dictionary <string, TypeNodeList>();

            // Scan all assemblies referenced in parameters
            // and take all namespaces from them.
            // Put all these namespaces into the common list.
            System.Collections.Specialized.StringCollection assemblies = CONTEXT.options.ReferencedAssemblies;
            foreach (string assName in assemblies)
            {
                AssemblyNode assembly = AssemblyNode.GetAssembly(assName, true, false, true);
                if (assembly == null && !CONTEXT.AnalysisOnly)
                {
                    ERROR.UnresolvedReference(assName);
                    continue;
                }
                NamespaceList nss = assembly.GetNamespaceList();
                for (int i = 0, n = nss.Length; i < n; i++)
                {
                    allNamespaces.Add(nss[i]);
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Fetches the name space list object.
        /// </summary>
        /// <param name="pluginSource">The plugin source.</param>
        /// <returns></returns>
        public NamespaceList FetchNamespaceListObject(ComPluginSource pluginSource)
        {
            var interrogatePlugin = ReadNamespaces(pluginSource.ClsId, pluginSource.Is32Bit);
            var namespacelist     = new NamespaceList();

            namespacelist.AddRange(interrogatePlugin);
            namespacelist.Add(new NamespaceItem());
            return(namespacelist);
        }
Beispiel #5
0
        //=====================================================================

        /// <summary>
        /// This is called to visit all namespaces, types, and members in the list of assemblies to be documented
        /// </summary>
        public void VisitApis()
        {
            // Store types.  We have to do this after all assemblies are registered because the resolution may
            // not work unless all the assemblies we need are in the resolver cache.
            foreach(AssemblyNode assembly in assemblies)
            {
                this.StoreTypes(assembly.Types);

                if(this.Canceled)
                    break;
            }

            if(!this.Canceled)
            {
                NamespaceList spaces = new NamespaceList();

                foreach(Namespace space in catalog.Values)
                    if(filter.IsExposedNamespace(space))
                        spaces.Add(space);

                if(!this.Canceled)
                    this.VisitNamespaces(spaces);
            }
        }
 public virtual Differences VisitNamespaceList(NamespaceList list1, NamespaceList list2,
   out NamespaceList changes, out NamespaceList deletions, out NamespaceList insertions){
   changes = list1 == null ? null : list1.Clone();
   deletions = list1 == null ? null : list1.Clone();
   insertions = list1 == null ? new NamespaceList() : list1.Clone();
   //^ assert insertions != null;
   Differences differences = new Differences();
   //Compare definitions that have matching key attributes
   TrivialHashtable matchingPosFor = new TrivialHashtable();
   TrivialHashtable matchedNodes = new TrivialHashtable();
   for (int j = 0, n = list2 == null ? 0 : list2.Count; j < n; j++){
     //^ assert list2 != null;
     Namespace nd2 = list2[j];
     if (nd2 == null || nd2.Name == null) continue;
     matchingPosFor[nd2.Name.UniqueIdKey] = j;
     insertions.Add(null);
   }
   for (int i = 0, n = list1 == null ? 0 : list1.Count; i < n; i++){
     //^ assert list1 != null && changes != null && deletions != null;
     Namespace nd1 = list1[i];
     if (nd1 == null || nd1.Name == null) continue;
     object pos = matchingPosFor[nd1.Name.UniqueIdKey];
     if (!(pos is int)) continue;
     //^ assert pos != null;
     //^ assume list2 != null; //since there was entry int matchingPosFor
     int j = (int)pos;
     Namespace nd2 = list2[j];
     //^ assume nd2 != null;
     //nd1 and nd2 have the same key attributes and are therefore treated as the same entity
     matchedNodes[nd1.UniqueKey] = nd1;
     matchedNodes[nd2.UniqueKey] = nd2;
     //nd1 and nd2 may still be different, though, so find out how different
     Differences diff = this.VisitNamespace(nd1, nd2);
     if (diff == null){Debug.Assert(false); continue;}
     if (diff.NumberOfDifferences != 0){
       changes[i] = diff.Changes as Namespace;
       deletions[i] = diff.Deletions as Namespace;
       insertions[i] = diff.Insertions as Namespace;
       insertions[n+j] = nd1; //Records the position of nd2 in list2 in case the change involved a permutation
       Debug.Assert(diff.Changes == changes[i] && diff.Deletions == deletions[i] && diff.Insertions == insertions[i]);
       differences.NumberOfDifferences += diff.NumberOfDifferences;
       differences.NumberOfSimilarities += diff.NumberOfSimilarities;
       continue;
     }
     changes[i] = null;
     deletions[i] = null;
     insertions[i] = null;
     insertions[n+j] = nd1; //Records the position of nd2 in list2 in case the change involved a permutation
   }
   //Find deletions
   for (int i = 0, n = list1 == null ? 0 : list1.Count; i < n; i++){
     //^ assert list1 != null && changes != null && deletions != null;
     Namespace nd1 = list1[i]; 
     if (nd1 == null) continue;
     if (matchedNodes[nd1.UniqueKey] != null) continue;
     changes[i] = null;
     deletions[i] = nd1;
     insertions[i] = null;
     differences.NumberOfDifferences += 1;
   }
   //Find insertions
   for (int j = 0, n = list1 == null ? 0 : list1.Count, m = list2 == null ? 0 : list2.Count; j < m; j++){
     //^ assert list2 != null;
     Namespace nd2 = list2[j]; 
     if (nd2 == null) continue;
     if (matchedNodes[nd2.UniqueKey] != null) continue;
     insertions[n+j] = nd2;  //Records nd2 as an insertion into list1, along with its position in list2
     differences.NumberOfDifferences += 1; //REVIEW: put the size of the tree here?
   }
   if (differences.NumberOfDifferences == 0){
     changes = null;
     deletions = null;
     insertions = null;
   }
   return differences;
 }
Beispiel #7
0
        // Visit Object Model

        public void VisitApis() {

            // store types
            // we have to do this after all assemblies are registered because the resolution may not work unless
            // all the assemblies we need are in the resolver cache
            //Console.WriteLine("storing types");
            foreach (AssemblyNode assembly in assemblies) {
                //Console.WriteLine("assembly {0}", assembly.Name);
                //Console.WriteLine("has {0} types", assembly.Types.Count);
                StoreTypes(assembly.Types);
                //Console.WriteLine("done with assembly");
            }
            //Console.WriteLine("done storing types");

            //Console.WriteLine("visiting namespaces");
            NamespaceList spaces = new NamespaceList();
            foreach (Namespace space in catalog.Values) {
                if (filter.IsExposedNamespace(space)) spaces.Add(space);
            }
            VisitNamespaces(spaces);
        }