Example #1
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);
        }
Example #2
0
 protected BaseWriter(GenerationManifest artifacts, AbstractTypeProvider typeProvider, FrameworkVersion version)
 {
     Artifacts    = artifacts;
     TypeProvider = typeProvider;
     _version     = version;
 }
Example #3
0
 protected BaseWriter(GenerationManifest artifacts, AbstractTypeProvider typeProvider, FrameworkVersion version)
 {
     Artifacts = artifacts;
     TypeProvider = typeProvider;
     _version = version;
 }