Ejemplo n.º 1
0
        public void ReadMyAssemblyInfoFromAssembly(string assemblyPath, IEnumerable<string> excludedNamespaces)
        {
            try
            {
                string assemblyAbsolutePath = Path.GetFullPath(assemblyPath);
                string assemblyName = AssemblyDefinition.ReadAssembly(assemblyAbsolutePath).Name.Name;

                MyAssemblyInfo myAssemblyInfo;

                if (assemblies == null)
                {
                    assemblies = new Dictionary<string, MyAssemblyInfo>();
                }

                if (!assemblies.ContainsKey(assemblyName))
                {
                    myAssemblyInfo = new MyAssemblyInfo(assemblyName, this);
                    assemblies.Add(assemblyName, myAssemblyInfo);
                }
                else
                {
                    myAssemblyInfo = assemblies[assemblyName];
                }

                myAssemblyInfo.ReadAssembly(assemblyAbsolutePath, excludedNamespaces);
            }
            catch (Exception exc)
            {
              #if DEBUG

                Logger.Warning("Couldn't process assembly '{0}'.\n{1}\n{2}", assemblyPath, exc.Message, Utils.SimplifyStackTrace(exc.StackTrace));

              #else

                        Logger.Warning("Couldn't process assembly '{0}' ({1}).", assemblyPath, exc.Message);

              #endif
            }
        }
Ejemplo n.º 2
0
    private void CreateNamespacesIndex(MyAssemblyInfo myAssemblyInfo)
    {
      string indexFileName = Utils.CombineMultiplePaths(myAssemblyInfo.Name + "_" + myAssemblyInfo.Name.GetHashCode(),
                                                        NAMESPACES_INDEX_FILE_NAME);

	  string filename = Utils.CombineMultiplePaths(outputDirectory, CONTENTS_DIRECTORY, GetAliasName(indexFileName));
			
	  FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write);
      StreamWriter sw = new StreamWriter(fs);

      string pageTitle = String.Format("{0} Assembly", myAssemblyInfo.Name);
      string[] sectionsNamesAndIndices = new string[] { "Namespaces:0" };

      WriteIndexHeader(sw, pageTitle, sectionsNamesAndIndices);

      WriteIndexSummary(sw, myAssemblyInfo.Summary);

      string sectionHeader = "Namespaces";
      int sectionIndex = 0;
      if (myAssemblyInfo.NamespacesCount > 0)
      {
        WriteMembersIndex(sw, sectionHeader, sectionIndex,
                          myAssemblyInfo.GetEnumerator(),
                          DEFAULT_MEMBERS_COLUMNS_NAMES,
                          DEFAULT_MEMBERS_COLUMNS_WIDTHS,
                          0, 0);
      }
      else
      {
        WriteIndexSectionBegin(sw, sectionHeader, sectionIndex);
        WriteIndexText(sw, NO_NAMESPACES);
        WriteIndexSectionEnd(sw);
      }

      WriteIndexFooter(sw);

      sw.Close();
      fs.Close();
    }
Ejemplo n.º 3
0
    private void ProcessAssembly(MyAssemblyInfo myAssemblyInfo)
    {
      CreateNamespacesIndex(myAssemblyInfo);

      if (myAssemblyInfo.NamespacesCount > 0)
      {
        foreach (MyNamespaceInfo myNamespaceInfo in myAssemblyInfo.Namespaces)
        {
          try
          {
            ProcessNamespace(myNamespaceInfo);
          }
          catch (Exception exc)
          {
#if DEBUG

            Logger.Warning("Couldn't process namespace '{0}' in assembly '{1}'.\n{2}{3}", myNamespaceInfo.Name, myAssemblyInfo.Name, exc.Message, Utils.SimplifyStackTrace(exc.StackTrace));

#else

                        Logger.Warning("Couldn't process namespace '{0}' in assembly '{1}' ({2}).", myNamespaceInfo.Name, myAssemblyInfo.Name, exc.Message);

#endif
          }
        }
      }
    }