Example #1
0
 public void AddNamespace(SDNamespace sdNamespace)
 {
     if (!Namespaces.ContainsKey(sdNamespace.Identifier))
     {
         Namespaces.Add(sdNamespace.Identifier, sdNamespace);
     }
 }
Example #2
0
        /// <default>
        ///     <summary>
        ///     Returns a namespace, referenced by its identifier.
        ///     </summary>
        ///     <param name="identifier">The identifier of the namespace.</param>
        ///     <returns>The namespace if it is available.</returns>
        /// </default>
        /// <de>
        ///     <summary>
        ///     Liefert den Namensraum mit dem angegebenen Identifikator.
        ///     </summary>
        ///     <param name="identifier">Der Identifikator des Namensraum.</param>
        ///     <returns>Der Namensraum, falls dieser vorhanden ist.</returns>
        /// </de>
        public SDNamespace GetNamespaceByIdentifier(string identifier)
        {
            SDNamespace sdNamespace = null;

            Namespaces.TryGetValue(identifier, out sdNamespace);

            return(sdNamespace);
        }
 private void InsertNamespaceDescription(SDNamespace sdNamespace)
 {
     var description = sdNamespace.Descriptions.GetElementOrDefault(_docLanguage);
     if (description != null)
     {
         _wordTemplater.AppendMarkdown(new Markdown().Transform(description.Transform(new Helper(_sdProject).TransformLinkToken)));
     }
 }
Example #4
0
        public NamespaceViewModel(SDNamespace sdNamespace, ObservableCollection<string> excludedIdentifiers)
            : base(sdNamespace.Fullname, null, excludedIdentifiers)
        {
            Text = sdNamespace.Fullname;
            Image = "pack://application:,,,/SharpDox.Resources;component/Icons/Namespace_public.png";

            foreach (var sdType in sdNamespace.Types)
            {
                Children.Add(new TypeViewModel(sdType, this, excludedIdentifiers));
            }
        }
Example #5
0
        public NamespaceViewModel(SDNamespace sdNamespace, ICoreConfigSection sharpDoxConfig)
            : base(sdNamespace.Fullname, null, sharpDoxConfig)
        {
            Text = sdNamespace.Fullname;
            Image = "pack://application:,,,/SharpDox.GUI;component/Resources/Icons/Namespace_public.png";

            foreach (var sdType in sdNamespace.Types)
            {
                Children.Add(new TypeViewModel(sdType, this, sharpDoxConfig));
            }
        }
        public void InsertNamespace(SDNamespace sdNamespace, int navigationLevel)
        {
            _wordTemplater.AppendHeader(sdNamespace.Fullname, navigationLevel);
            InsertNamespaceDescription(sdNamespace);
            InsertNamespaceOverview(sdNamespace, navigationLevel + 1);
            InsertUseUsedBlock(sdNamespace, navigationLevel + 1);
            _wordTemplater.AppendPageBreak();

            foreach (var sdType in sdNamespace.Types)
            {
                _typeBuilder.InsertType(sdType, navigationLevel + 1);
            }
        }
        private void InsertUseUsedBlock(SDNamespace sdNamespace, int navigationLevel)
        {
            if (sdNamespace.Uses.Count > 0)
            {
                _wordTemplater.AppendHeader(_wordStrings.Uses, navigationLevel);
                sdNamespace.Uses.Select(u => u.Fullname).ToList().ForEach(u => _wordTemplater.AppendParagraph(u, "CenteredNoMargin"));
            }

            if (sdNamespace.UsedBy.Count > 0)
            {
                _wordTemplater.AppendHeader(_wordStrings.UsedBy, navigationLevel);
                sdNamespace.UsedBy.Select(u => u.Fullname).ToList().ForEach(u => _wordTemplater.AppendParagraph(u, "CenteredNoMargin"));
            }
        }
Example #8
0
 private SDType CreateSDType(ITypeSymbol typeSymbol, INamespaceSymbol namespaceSymbol)
 {
     var sdNamespace = new SDNamespace(namespaceSymbol.GetIdentifier()) { IsProjectStranger = true };
     var sdType = new SDType(typeSymbol.GetIdentifier(), typeSymbol.Name, sdNamespace)
     {
         Accessibility = typeSymbol.DeclaredAccessibility.ToString().ToLower(),
         IsAbstract = typeSymbol.IsAbstract,
         IsReferenceType = typeSymbol.IsReferenceType,
         IsSealed = typeSymbol.IsSealed,
         IsStatic = typeSymbol.IsStatic,
         IsProjectStranger = true,
         Kind = typeSymbol.TypeKind.ToString().ToLower()
     };
     return sdType;
 }
Example #9
0
        internal void ParseMethodCalls(SDNamespace sdNamespace)
        {
            for (int i = 0; i < sdNamespace.Types.Count; i++)
            {
                foreach (var sdMethod in sdNamespace.Types[i].Methods)
                {
                    HandleOnItemParseStart(sdMethod.Name, i, sdNamespace.Types.Count);
                    var file = _solution.GetFile(sdNamespace.Types[i].Region.Filename);
                    var methodAstNode = file.SyntaxTree.GetNodeContaining(
                                            new TextLocation(sdMethod.Region.BeginLine, sdMethod.Region.BeginColumn), 
                                            new TextLocation(sdMethod.Region.EndLine, sdMethod.Region.EndColumn));

                    methodAstNode.AcceptVisitor(new MethodVisitor(_repository, sdMethod, sdNamespace.Types[i], file));
                }
            }
        }
Example #10
0
        private void ParseNamespaces()
        {
            var pi = 0;
            for (int i = 0; i < _solution.Projects.Count; i++)
            {
                pi = i;
                var types = _solution.Projects[i].Compilation.MainAssembly.TopLevelTypeDefinitions.ToList();
                for (int j = 0; j < types.Count; j++)
                {
                    PostProgress(_sdBuildStrings.ParsingNamespace + ": " + types[j].Namespace, j, types.Count, pi, _solution.Projects.Count);

                    var sdNamespace = new SDNamespace(types[j].Namespace);
                    _repository.AddNamespace(sdNamespace);
                }
            }
        }
Example #11
0
        public SDType(string identifier, string name, SDNamespace sdNamespace)
        {
            Guid = Guid.NewGuid();
            Identifier = identifier;
            Name = name;
            Namespace = sdNamespace;

            BaseTypes = new List<SDType>();
            ImplementedInterfaces = new List<SDType>();
            UsedBy = new List<SDType>();
            Uses = new List<SDType>();

            TypeParameters = new List<SDType>();
			Fields = new List<SDField>();
            Constructors = new List<SDMethod>();
			Methods = new List<SDMethod>();
            Events = new List<SDEvent>();
			Properties = new List<SDProperty>();
        }
Example #12
0
        public SDType(string identifier, string name, SDNamespace sdNamespace)
        {
            Guid       = Guid.NewGuid();
            Identifier = identifier;
            Name       = name;
            Namespace  = sdNamespace;

            BaseTypes             = new List <SDType>();
            ImplementedInterfaces = new List <SDType>();
            UsedBy = new List <SDType>();
            Uses   = new List <SDType>();

            TypeParameters = new List <SDTypeParameter>();
            TypeArguments  = new List <SDType>();
            Fields         = new List <SDField>();
            Constructors   = new List <SDMethod>();
            Methods        = new List <SDMethod>();
            Events         = new List <SDEvent>();
            Properties     = new List <SDProperty>();
        }
Example #13
0
        public SDType(string identifier, string name, SDNamespace sdNamespace)
        {
            Guid       = Guid.NewGuid();
            Identifier = identifier;
            Name       = name;
            Namespace  = sdNamespace;

            Documentations = new SDLanguageItemCollection <SDDocumentation>();

            BaseTypes             = new SortedList <SDType>();
            ImplementedInterfaces = new SortedList <SDType>();
            UsedBy = new SortedList <SDType>();
            Uses   = new SortedList <SDType>();

            TypeParameters = new SortedList <SDTypeParameter>();
            TypeArguments  = new SortedList <SDType>();
            Fields         = new SortedList <SDField>();
            Constructors   = new SortedList <SDMethod>();
            Methods        = new SortedList <SDMethod>();
            Events         = new SortedList <SDEvent>();
            Properties     = new SortedList <SDProperty>();
            NestedTypes    = new SortedList <SDType>();
        }
        private void InsertNamespaceOverview(SDNamespace sdNamespace, int navigationLevel)
        {
            _wordTemplater.AppendHeader(_wordStrings.Overview, navigationLevel);

            var headers = new List<string> {
                    string.Empty,
                    _wordStrings.Name,
                    _wordStrings.Description
                };

            var rows = new List<List<string>>();
            foreach (var sdType in sdNamespace.Types)
            {
                var documentation = sdType.Documentations.GetElementOrDefault(_docLanguage);
                rows.Add(new List<string> {
                        string.Format("<img width=\"16\" src=\"{0}\"/>", Icons.GetIconPath("class", sdType.Accessibility)),
                        sdType.Name,
                        documentation != null ? documentation.Summary.ToString() : string.Empty
                    });
            }

            _wordTemplater.AppendTable(headers, rows);
        }
Example #15
0
 public void RemoveNamespace(SDNamespace sdNamespace)
 {
     Namespaces.Remove(sdNamespace.Identifier);
 }
Example #16
0
 public void AddNamespace(SDNamespace sdNamespace)
 {
     if (!Namespaces.ContainsKey(sdNamespace.Identifier))
         Namespaces.Add(sdNamespace.Identifier, sdNamespace);
 }
Example #17
0
        private void StructureParseNamespaces(CSharpProject project, SDRepository sdRepository)
        {
            var types = project.Compilation.MainAssembly.TopLevelTypeDefinitions.ToList();
            for (int j = 0; j < types.Count; j++)
            {
                PostParseMessage(_parserStrings.ParsingNamespace + ": " + types[j].Namespace);

                var sdNamespace = new SDNamespace(types[j].Namespace);
                sdRepository.AddNamespace(sdNamespace);
            }
        }
Example #18
0
        private SDType CreateSDType(INamedTypeSymbol typeSymbol, SDNamespace sdNamespace)
        {
            var sdType = new SDType(typeSymbol.GetIdentifier(), typeSymbol.Name, sdNamespace)
            {
                Accessibility = typeSymbol.DeclaredAccessibility.ToString().ToLower(),
                IsAbstract = typeSymbol.IsAbstract,
                IsReferenceType = typeSymbol.IsReferenceType,
                IsSealed = typeSymbol.IsSealed,
                IsStatic = typeSymbol.IsStatic,
                IsProjectStranger = false,
                Kind = typeSymbol.TypeKind.ToString().ToLower()
            };
            sdType.Regions = GetRegions(typeSymbol);

            return sdType;
        }
Example #19
0
		public void AddNamespace(SDNamespace nameSpace)
		{
            if (GetNamespaceByIdentifier(nameSpace.Identifier) == null)
                Namespaces.Add(nameSpace);
		}
Example #20
0
 public void RemoveNamespace(SDNamespace sdNamespace)
 {
     Namespaces.Remove(sdNamespace.Identifier);
 }