private void WriteBaseMember(ulong symbolId, StreamWriter writer)
        {
            Tuple <string, ulong> baseMemberLink;

            if (!BaseMembers.TryGetValue(symbolId, out baseMemberLink))
            {
                return;
            }

            Write(writer, @"<div class=""rH"">Base:</div>");

            var assemblyName = baseMemberLink.Item1;
            var baseSymbolId = baseMemberLink.Item2;

            ProjectFinalizer baseProject = null;

            if (!this.SolutionFinalizer.assemblyNameToProjectMap.TryGetValue(assemblyName, out baseProject))
            {
                return;
            }

            DeclaredSymbolInfo symbol = null;

            if (baseProject.DeclaredSymbols.TryGetValue(baseSymbolId, out symbol))
            {
                var sb = new StringBuilder();
                Markup.WriteSymbol(symbol, sb);
                writer.Write(sb.ToString());
            }
        }
        private void WriteImplementedInterfaceMembers(ulong symbolId, StreamWriter writer)
        {
            HashSet <Tuple <string, ulong> > implementedInterfaceMembers;

            if (!ImplementedInterfaceMembers.TryGetValue(symbolId, out implementedInterfaceMembers))
            {
                return;
            }

            Write(writer, string.Format(@"<div class=""rH"">Implemented interface member{0}:</div>", implementedInterfaceMembers.Count > 1 ? "s" : ""));

            foreach (var implementedInterfaceMember in implementedInterfaceMembers)
            {
                var assemblyName      = implementedInterfaceMember.Item1;
                var interfaceSymbolId = implementedInterfaceMember.Item2;

                ProjectFinalizer baseProject = null;
                if (!this.SolutionFinalizer.assemblyNameToProjectMap.TryGetValue(assemblyName, out baseProject))
                {
                    return;
                }

                DeclaredSymbolInfo symbol = null;
                if (baseProject.DeclaredSymbols.TryGetValue(interfaceSymbolId, out symbol))
                {
                    var sb = new StringBuilder();
                    Markup.WriteSymbol(symbol, sb);
                    writer.Write(sb.ToString());
                }
            }
        }
        private static int Sorter(DeclaredSymbolInfo left, DeclaredSymbolInfo right)
        {
            if (left == right)
            {
                return(0);
            }

            if (left == null || right == null)
            {
                return(1);
            }

            int comparison = StringComparer.OrdinalIgnoreCase.Compare(left.Name, right.Name);

            if (comparison != 0)
            {
                return(comparison);
            }

            comparison = left.KindRank.CompareTo(right.KindRank);
            if (comparison != 0)
            {
                return(comparison);
            }

            comparison = StringComparer.Ordinal.Compare(left.Name, right.Name);
            if (comparison != 0)
            {
                return(comparison);
            }

            comparison = left.AssemblyNumber.CompareTo(right.AssemblyNumber);
            return(comparison);
        }
Пример #4
0
 public static void WriteDeclaredSymbol(BinaryWriter writer, DeclaredSymbolInfo symbol, Huffman huffman)
 {
     Write7BitEncodedInt(writer, symbol.AssemblyNumber);
     writer.Write(symbol.Name);
     writer.Write(symbol.ID);
     WriteBytes(writer, huffman.Compress(symbol.Description));
     Write7BitEncodedInt(writer, symbol.Glyph);
 }
Пример #5
0
        private void Insert(NamespaceTreeNode root, DeclaredSymbolInfo type)
        {
            var namespaceString   = type.GetNamespace();
            var parts             = namespaceString.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
            var nodeWhereToInsert = GetOrCreateNode(root, parts, 0);

            // { is to sort types after namespaces
            var inserted = nodeWhereToInsert.GetOrCreate("{" + type.Name);

            inserted.TypeDeclaration = type;
        }
Пример #6
0
        private void WriteType(DeclaredSymbolInfo typeDeclaration, StreamWriter sw, string className, string pathPrefix)
        {
            string typeUrl = typeDeclaration.GetUrl();

            sw.Write(string.Format("<div class=\"{3}\"><a class=\"tDN\" href=\"{0}\" target=\"s\"><img class=\"tDNI\" src=\"{4}content/icons/{2}.png\" />{1}</a></div>",
                                   typeUrl,
                                   Markup.HtmlEscape(typeDeclaration.Name),
                                   typeDeclaration.Glyph,
                                   className,
                                   pathPrefix));
        }
Пример #7
0
        public static void WriteSymbol(DeclaredSymbolInfo symbol, StringBuilder sb)
        {
            var url = symbol.GetUrl();

            sb.AppendFormat("<a href=\"{0}\" target=\"s\"><div class=\"resultItem\" onClick=\"resultClick(this);\">", url);
            sb.Append("<div class=\"resultLine\">");
            sb.AppendFormat("<img src=\"/content/icons/{0}\" height=\"16\" width=\"16\" />", GetGlyph(symbol) + ".png");
            sb.AppendFormat("<div class=\"resultKind\">{0}</div>", symbol.Kind);
            sb.AppendFormat("<div class=\"resultName\">{0}</div>", Markup.HtmlEscape(symbol.Name));
            sb.AppendLine("</div>");
            sb.AppendFormat("<div class=\"resultDescription\">{0}</div>", Markup.HtmlEscape(symbol.Description));
            sb.AppendLine();
            sb.AppendLine("</div></a>");
        }
Пример #8
0
        public static void ParseDeclaredSymbol(string separated, DeclaredSymbolInfo declaredSymbolInfo)
        {
            ushort glyph = ushort.MaxValue; // to save space and avoid extra field, this indicates an invalid symbol

            var parts = separated.Split(';');
            if (parts.Length == 5)
            {
                declaredSymbolInfo.Name = string.Intern(parts[0]);
                declaredSymbolInfo.ID = HexStringToULong(parts[1]);
                declaredSymbolInfo.Kind = string.Intern(parts[2]);
                declaredSymbolInfo.Description = parts[3];
                ushort.TryParse(parts[4], out glyph);
            }

            declaredSymbolInfo.Glyph = glyph;
        }
        public void ReadDeclarationLines()
        {
            DeclaredSymbols = new Dictionary <ulong, DeclaredSymbolInfo>();
            var assemblyIndex = Path.Combine(ProjectDestinationFolder, Constants.DeclaredSymbolsFileName + ".txt");

            if (!File.Exists(assemblyIndex))
            {
                return;
            }

            var declarationLines = File.ReadAllLines(assemblyIndex);

            foreach (var declarationLine in declarationLines)
            {
                var symbolInfo = new DeclaredSymbolInfo(declarationLine);
                symbolInfo.AssemblyName = this.AssemblyId;
                if (symbolInfo.IsValid)
                {
                    DeclaredSymbols[symbolInfo.ID] = symbolInfo;
                }
            }
        }
Пример #10
0
        private static string GetGlyph(DeclaredSymbolInfo symbol)
        {
            var result = symbol.Glyph;

            if (result == 196)
            {
                return("CSharp");
            }
            else if (result == 195)
            {
                return("VB");
            }
            else if (result == 227)
            {
                return("xaml");
            }
            else if (result == 228)
            {
                return("TypeScript");
            }

            return(result.ToString());
        }