Exemplo n.º 1
0
    private void CreateNamespaceMembersIndex(MyNamespaceInfo myNamespaceInfo)
    {
      string namespaceDirName = GetNamespaceDirName(myNamespaceInfo.Name);
      string indexFileName = Utils.CombineMultiplePaths(myNamespaceInfo.AssemblyName + "_" + myNamespaceInfo.AssemblyName.GetHashCode(),
                                                        namespaceDirName,
                                                        TYPES_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} Namespace", myNamespaceInfo.Name);

      string[] sectionsShortcutsNamesAndIndices = ObtainListOfSectionsShortcutsNamesAndIndices(myNamespaceInfo);
      string[] sectionsNames = ObtainListOfSectionsNames(myNamespaceInfo);

      WriteIndexHeader(sw, pageTitle, sectionsShortcutsNamesAndIndices);

      WriteIndexSummary(sw, myNamespaceInfo.Summary);

      WriteIndexItemLocation(sw,
                             null,
                             null,
                             myNamespaceInfo.AssemblyName,
                             null,
                             null,
                             ResolveAssemblyLink(myNamespaceInfo.AssemblyName));

      int sectionIndex = 0;
      int sectionNameIndex = 0;

      int namespaceMembersGroupIndex = 0;
      while (Enum.IsDefined(typeof(NamespaceMembersGroups), namespaceMembersGroupIndex))
      {
        NamespaceMembersGroups namespaceMembersGroupType = (NamespaceMembersGroups)namespaceMembersGroupIndex;

        if (myNamespaceInfo.GetMembersCount(namespaceMembersGroupType) > 0)
        {
          WriteMembersIndex(sw, sectionsNames[sectionNameIndex++], sectionIndex,
                            myNamespaceInfo.GetEnumerator(namespaceMembersGroupType),
                            DEFAULT_MEMBERS_COLUMNS_NAMES,
                            TYPE_MEMBERS_COLUMNS_WIDTHS,
                            namespaceMembersGroupType, 0);
        }

        namespaceMembersGroupIndex++;
        sectionIndex++;
      }

      WriteIndexFooter(sw);

      sw.Close();
      fs.Close();
    }
Exemplo n.º 2
0
    private string[] ObtainListOfSectionsNames(MyNamespaceInfo myNamespaceInfo)
    {
      List<string> result = new List<string>();
      int sectionIndex = 0;
      int namespaceMembersGroupTypeIndex = 0;

      while (Enum.IsDefined(typeof(NamespaceMembersGroups), namespaceMembersGroupTypeIndex))
      {
        NamespaceMembersGroups membersGroupType = (NamespaceMembersGroups)namespaceMembersGroupTypeIndex;

        if (myNamespaceInfo.GetMembersCount(membersGroupType) > 0)
        {
          string sectionName = MyNamespaceInfo.NamespaceMembersGroupToString(membersGroupType);
          int tmpSectionIndex = sectionIndex;

          tmpSectionIndex++;
          if (myNamespaceInfo.HasProtectedInternalGroupOfTheSameType(membersGroupType))
          {
            sectionName += String.Format(" ${{SectionReference:{0}:{1}}}", tmpSectionIndex, "Protected Internal");
          }

          tmpSectionIndex++;
          if (myNamespaceInfo.HasProtectedGroupOfTheSameType(membersGroupType))
          {
            sectionName += String.Format(" ${{SectionReference:{0}:{1}}}", tmpSectionIndex, "Protected");
          }

          tmpSectionIndex++;
          if (myNamespaceInfo.HasInternalGroupOfTheSameType(membersGroupType))
          {
            sectionName += String.Format(" ${{SectionReference:{0}:{1}}}", tmpSectionIndex, "Internal");
          }

          tmpSectionIndex++;
          if (myNamespaceInfo.HasPrivateGroupOfTheSameType(membersGroupType))
          {
            sectionName += String.Format(" ${{SectionReference:{0}:{1}}}", tmpSectionIndex, "Private");
          }

          result.Add(sectionName);
        }

        namespaceMembersGroupTypeIndex++;
        sectionIndex++;
      }

      return result.ToArray();
    }
Exemplo n.º 3
0
    private void ProcessNamespace(MyNamespaceInfo myNamespaceInfo)
    {
      CreateNamespaceMembersIndex(myNamespaceInfo);

      int namespaceMembersGroupTypeIndex = 0;
      while (Enum.IsDefined(typeof(NamespaceMembersGroups), namespaceMembersGroupTypeIndex))
      {
        NamespaceMembersGroups namespaceMembersGroupType = (NamespaceMembersGroups)namespaceMembersGroupTypeIndex;

        if (myNamespaceInfo.GetMembersCount(namespaceMembersGroupType) > 0)
        {
          Dictionary<string, MetaClass> namespaceMembers = myNamespaceInfo.GetMembers(namespaceMembersGroupType);

          foreach (MetaClass namespaceMember in namespaceMembers.Values)
          {
            ProcessNamespaceMember(namespaceMember, namespaceMembersGroupType);
          }
        }

        namespaceMembersGroupTypeIndex++;
      }
    }
Exemplo n.º 4
0
    private string[] ObtainListOfSectionsShortcutsNamesAndIndices(MyNamespaceInfo myNamespaceInfo)
    {
      List<string> result = new List<string>();
      int sectionIndex = 0;
      int namespaceMembersGroupTypeIndex = 0;

      while (Enum.IsDefined(typeof(NamespaceMembersGroups), namespaceMembersGroupTypeIndex))
      {
        NamespaceMembersGroups membersGroupType = (NamespaceMembersGroups)namespaceMembersGroupTypeIndex;

        if (myNamespaceInfo.GetMembersCount(membersGroupType) > 0)
        {
          if (MyNamespaceInfo.IsMembersGroupTypePublic(membersGroupType))
          {
            result.Add(MyNamespaceInfo.GetBaseGroupName(membersGroupType) + ":" + sectionIndex);
          }
        }

        namespaceMembersGroupTypeIndex++;
        sectionIndex++;
      }

      return result.ToArray();
    }