Exemple #1
0
        void AddRow(TextWriter writer, TypeWrapper info, string cssImageClass)
        {
            writer.WriteLine("<tr>");

            // funky but works
            var imageClassDisplayName = string.Format("{0}{1}", cssImageClass.Substring(0, 1).ToUpper(), cssImageClass.Substring(1));

            writer.WriteLine("<td>");
            writer.WriteLine("<img class=\"{0}\" src=\"{2}/resources/blank.gif\" title=\"{1}\" alt=\"{1}\"/>", cssImageClass, imageClassDisplayName, RootRelativePath);
            writer.WriteLine("</td>");

            writer.WriteLine("<td>");
            writer.WriteLine("<a href=\"./{0}\">{1}</a>", FilenameGenerator.GenerateFilename(info), info.GetDisplayName(false));
            writer.WriteLine("</td>");

            writer.WriteLine("<td>");

            var docs = NDocUtilities.FindDocumentation(NDocUtilities.GetDocumentationInstance(info.DocId), info);
            var html = NDocUtilities.TransformDocumentationToHTML(docs, "summary", Artifacts.ManifestAssemblyContext.SdkAssembly, this._version);

            writer.WriteLine(html);
            writer.WriteLine("</td>");

            writer.WriteLine("</tr>");
        }
Exemple #2
0
        void AddEvent(TextWriter writer, EventInfoWrapper info)
        {
            writer.WriteLine("<tr>");

            writer.WriteLine("<td>");
            writer.WriteLine("<img class=\"event\" src=\"{0}/resources/blank.gif\" title=\"Event\" alt=\"Event\"/>", RootRelativePath);
            if (info.IsStatic)
            {
                writer.WriteLine("<img class=\"static\" src=\"{0}/resources/blank.gif\" title=\"Static Event\" alt=\"Static Event\"/>", RootRelativePath);
            }
            writer.WriteLine("</td>");

            writer.WriteLine("<td>");
            writer.WriteLine("<a href=\"./{0}\">{1}</a>", FilenameGenerator.GenerateFilename(info), info.Name);
            writer.WriteLine("</td>");

            writer.WriteLine("<td>");

            var docs = NDocUtilities.FindDocumentation(this._currentNDoc, info);
            var html = NDocUtilities.TransformDocumentationToHTML(docs, "summary", Artifacts.AssemblyWrapper, this._version);

            writer.WriteLine(html);
            writer.WriteLine("</td>");

            writer.WriteLine("</tr>");
        }
Exemple #3
0
        void AddConstructor(TextWriter writer, ConstructorInfoWrapper info)
        {
            writer.WriteLine("<tr>");

            writer.WriteLine("<td>");
            writer.WriteLine("<img class=\"publicMethod\" src=\"{0}/resources/blank.gif\" title=\"Public Method\" alt=\"Public Method\"/>", RootRelativePath);
            if (info.IsStatic)
            {
                writer.WriteLine("<img class=\"static\" src=\"{0}/resources/blank.gif\" title=\"Static Method\" alt=\"Static Method\"/>", RootRelativePath);
            }
            writer.WriteLine("</td>");

            writer.WriteLine("<td>");
            var filename   = FilenameGenerator.GenerateFilename(info);
            var parameters = FormatParameters(info.GetParameters());
            var hrefLink   = string.Format("<a href=\"./{0}\">{1}({2})</a>", filename, info.DeclaringType.Name, parameters);

            writer.WriteLine(hrefLink);
            writer.WriteLine("</td>");

            writer.WriteLine("<td>");

            var docs = NDocUtilities.FindDocumentation(this._currentNDoc, info);
            var html = NDocUtilities.TransformDocumentationToHTML(docs, "summary", this.Artifacts.AssemblyWrapper, this._version);

            writer.WriteLine(html);
            writer.WriteLine("</td>");

            writer.WriteLine("</tr>");
        }
Exemple #4
0
        public static string CreateCrossReferenceTagReplacement(AbstractTypeProvider typeProvider, string crefTypeName, FrameworkVersion version)
        {
            const string amazonNamespaceRoot = "Amazon.";

            var    target = string.Empty;
            string url    = null;

            string typeName;

            if (crefTypeName.Length > 2 && crefTypeName[1] == ':') // cref M:, T:, P:, F: indicators
            {
                typeName = crefTypeName.Substring(2);
            }
            else
            {
                typeName = crefTypeName;
            }

            var typeWrapper = typeProvider.GetType(typeName);

            if (typeWrapper != null)
            {
                url = string.Format("./{0}", FilenameGenerator.GenerateFilename(typeWrapper));
            }
            else if (typeName.StartsWith("system.", StringComparison.OrdinalIgnoreCase))
            {
                url    = string.Format(NDocUtilities.MSDN_TYPE_URL_PATTERN, typeName.ToLower());
                target = "target=_new";
            }

            // If we couldn't generate a url to use with an anchor tag, make the typename italic+bold so
            // that it at least stands out.
            if (url == null)
            {
                return(string.Format("<i><b>{0}</b></i>", typeName));
            }

            // If the type is one of ours, strip the namespace from the display text to condense things
            // a little
            if (typeName.StartsWith(amazonNamespaceRoot, StringComparison.Ordinal))
            {
                var lastPeriodIndex = typeName.LastIndexOf('.');
                typeName = typeName.Substring(lastPeriodIndex + 1);
            }

            return(string.Format("<a href=\"{0}\" {2}>{1}</a>", url, typeName, target));
        }
Exemple #5
0
        void WriteNamespaceToc(JsonWriter writer, string ns)
        {
            var assemblyWrapper = _generatedNamespaces[ns];
            var tocId           = ns.Replace(".", "_");

            var nsFilePath = Path.Combine("./" + Options.ContentSubFolderName,
                                          GenerationManifest.OutputSubFolderFromNamespace(ns),
                                          FilenameGenerator.GenerateNamespaceFilename(ns)).Replace('\\', '/');

            writer.WritePropertyName(ns);
            writer.WriteObjectStart();

            writer.WritePropertyName("id");
            writer.Write(tocId);

            writer.WritePropertyName("href");
            writer.Write(nsFilePath);

            writer.WritePropertyName("nodes");
            writer.WriteObjectStart();

            foreach (var type in assemblyWrapper.GetTypesForNamespace(ns).OrderBy(x => x.Name))
            {
                var filePath = Path.Combine("./" + Options.ContentSubFolderName,
                                            GenerationManifest.OutputSubFolderFromNamespace(type.Namespace),
                                            FilenameGenerator.GenerateFilename(type)).Replace('\\', '/');

                writer.WritePropertyName(type.GetDisplayName(false));
                writer.WriteObjectStart();
                writer.WritePropertyName("id");
                writer.Write(type.GetDisplayName(true).Replace(".", "_"));

                writer.WritePropertyName("href");
                writer.Write(filePath);
                writer.WriteObjectEnd();
            }

            writer.WriteObjectEnd();

            writer.WriteObjectEnd();
        }
Exemple #6
0
        void AddEvent(TextWriter writer, EventInfoWrapper info)
        {
            writer.WriteLine("<tr>");

            writer.WriteLine("<td>");
            writer.WriteLine("<img class=\"event\" src=\"{0}/resources/blank.gif\" title=\"Event\" alt=\"Event\"/>", RootRelativePath);
            if (info.IsStatic)
            {
                writer.WriteLine("<img class=\"static\" src=\"{0}/resources/blank.gif\" title=\"Static Event\" alt=\"Static Event\"/>", RootRelativePath);
            }
            writer.WriteLine("</td>");

            writer.WriteLine("<td>");
            writer.WriteLine("<a href=\"{0}/items/{1}/{2}\">{3}</a>",
                             RootRelativePath,
                             GenerationManifest.OutputSubFolderFromNamespace(info.DeclaringType.Namespace),
                             FilenameGenerator.GenerateFilename(info),
                             info.Name);
            writer.WriteLine("</td>");

            writer.WriteLine("<td>");

            string html        = string.Empty;
            var    isInherited = !info.DeclaringType.Equals(_versionType);

            if (isInherited)
            {
                html = string.Format("Inherited from {0}.{1}.", info.DeclaringType.Namespace, info.DeclaringType.Name);
            }
            else
            {
                var docs = NDocUtilities.FindDocumentation(info);
                html = NDocUtilities.TransformDocumentationToHTML(docs, "summary", Artifacts.AssemblyWrapper, this._version);
            }

            writer.WriteLine(html);
            writer.WriteLine("</td>");

            writer.WriteLine("</tr>");
        }
Exemple #7
0
        void AddMethod(TextWriter writer, MethodInfoWrapper info)
        {
            writer.WriteLine("<tr>");

            writer.WriteLine("<td>");
            writer.WriteLine("<img class=\"publicMethod\" src=\"{0}/resources/blank.gif\" title=\"Public Method\" alt=\"Public Method\"/>", RootRelativePath);
            if (info.IsStatic)
            {
                writer.WriteLine("<img class=\"static\" src=\"{0}/resources/blank.gif\" title=\"Static Method\" alt=\"Static Method\"/>", RootRelativePath);
            }
            writer.WriteLine("</td>");

            writer.WriteLine("<td>");
            writer.WriteLine("<a href=\"{0}/items/{1}/{2}\">{3}({4})</a>",
                             RootRelativePath,
                             GenerationManifest.OutputSubFolderFromNamespace(info.DeclaringType.Namespace),
                             FilenameGenerator.GenerateFilename(info),
                             info.Name,
                             FormatParameters(info.GetParameters()));
            writer.WriteLine("</td>");

            writer.WriteLine("<td>");

            string html = string.Empty;

            if (_versionType.Namespace != info.DeclaringType.Namespace)
            {
                html = string.Format("Inherited from {0}.{1}.", info.DeclaringType.Namespace, info.DeclaringType.Name);
            }
            else
            {
                var docs = NDocUtilities.FindDocumentation(this._currentNDoc, info);
                html = NDocUtilities.TransformDocumentationToHTML(docs, "summary", Artifacts.AssemblyWrapper, this._version);
            }
            writer.WriteLine(html);
            writer.WriteLine("</td>");

            writer.WriteLine("</tr>");
        }
Exemple #8
0
 protected override string GenerateFilename()
 {
     return(FilenameGenerator.GenerateFilename(this._fieldInfo));
 }
Exemple #9
0
 protected override string GenerateFilename()
 {
     return(FilenameGenerator.GenerateFilename(this._versionType));
 }
 protected override string GenerateFilename()
 {
     return(FilenameGenerator.GenerateFilename(this._constructorInfo));
 }