예제 #1
0
        public IEnumerable <string> CollectBases(string type)
        {
            var bases = new List <string>();

            bases.Add("System.Object");
            IType current = Interfaces.FirstOrDefault(x => x.Signature == type);

            if (current == null)
            {
                current = Classes.FirstOrDefault(x => x.Signature == type);
            }
            if (current == null)
            {
                current = Structs.FirstOrDefault(x => x.Signature == type);
            }
            if (current == null)
            {
                current = Enums.FirstOrDefault(x => x.Signature == type);
            }
            if (current == null)
            {
                return new string[] {}
            }
            ;
            foreach (var baseSignature in current.BaseTypes)
            {
                bases.Add(baseSignature);

                bases.AddRange(CollectBases(baseSignature));
            }
            return(bases);
        }
예제 #2
0
 public void WriteInterface(Interface iface)
 {
     iface.AllTypesAreResolved = !_visibility;
     Interfaces.Add(iface);
     if (_visibility)
     {
         writeSignature("interface", iface, new[] { "typesearch" });
     }
 }
예제 #3
0
        public void BuildTypeIndex()
        {
            _typeIndex          = new HashSet <string>();
            _nameIndex          = new Dictionary <string, string>();
            _signaturePositions = new Dictionary <string, FilePosition>();
            Classes.ForEach(x => {
                addNameAndTypeIndex(x);
                addSignaturePosition(x);
            });
            Interfaces.ForEach(x => {
                addNameAndTypeIndex(x);
                addSignaturePosition(x);
            });
            Structs.ForEach(x => {
                addNameAndTypeIndex(x);
                addSignaturePosition(x);
            });
            Enums.ForEach(x => {
                addNameAndTypeIndex(x);
                addSignaturePosition(x);
            });

            _declarations       = new Dictionary <string, string>();
            _staticDeclarations = new Dictionary <string, string>();
            Parameters.ForEach(x => {
                var signature = x.Parent + "." + x.Name;
                addDeclaration(signature, x.DeclaringType, x.IsStatic);
                addSignaturePosition(x);
            });
            Variables.ForEach(x => {
                var signature = x.Parent + "." + x.Name;
                addDeclaration(signature, x.DeclaringType, x.IsStatic);
                addSignaturePosition(x);
            });
            Methods.ForEach(x => {
                var signature = x.GenerateNameSignature();
                addDeclaration(signature, x.ReturnType, x.IsStatic);
                addSignaturePosition(x);
            });
            Fields.ForEach(x => {
                var signature = x.Parent + "." + x.Name;
                addDeclaration(signature, x.ReturnType, x.IsStatic);
                addSignaturePosition(x);
            });
        }
예제 #4
0
        public void MergeWith(IOutputWriter cache)
        {
            // Remove all crawled items
            cache
            .Projects.ForEach(x => {
                Projects.RemoveAll(y => y.File == x.File);
                Files.RemoveAll(y => y.Project != null && y.Project.File == x.File);
            });
            cache
            .Files.ForEach(x => {
                Files.RemoveAll(y => y.File == x.File);
                Usings.RemoveAll(y => y.File.File == x.File);
                UsingAliases.RemoveAll(y => y.File.File == x.File);
                Namespaces.RemoveAll(y => y.File.File == x.File);
                Classes.RemoveAll(y => y.File.File == x.File);
                Interfaces.RemoveAll(y => y.File.File == x.File);
                Structs.RemoveAll(y => y.File.File == x.File);
                Enums.RemoveAll(y => y.File.File == x.File);
                Fields.RemoveAll(y => y.File.File == x.File);
                Methods.RemoveAll(y => y.File.File == x.File);
                Parameters.RemoveAll(y => y.File.File == x.File);
                Variables.RemoveAll(y => y.File.File == x.File);
            });

            // Write new items
            Projects.AddRange(cache.Projects);
            Files.AddRange(cache.Files);
            Usings.AddRange(cache.Usings);
            UsingAliases.AddRange(cache.UsingAliases);
            Namespaces.AddRange(cache.Namespaces);
            Classes.AddRange(cache.Classes);
            Interfaces.AddRange(cache.Interfaces);
            Structs.AddRange(cache.Structs);
            Enums.AddRange(cache.Enums);
            Fields.AddRange(cache.Fields);
            Methods.AddRange(cache.Methods);
            Parameters.AddRange(cache.Parameters);
            Variables.AddRange(cache.Variables);

            BuildTypeIndex();
        }