示例#1
0
        /// <summary>
        /// Converts to interface.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        private static Models.Interface ConvertToInterface(Type type)
        {
            var @interface = new Models.Interface
            {
                Name       = Regex.Replace(type.Name, TypingSetter, ""),
                Properties = GetProperties(type),
                Functions  = GetFunctions(type),
                Voids      = GetVoids(type)
            };

            @interface.Diagram       = string.Format(Templates.PsuedoCode, AssemblyDiagrammer.WriteClassDiagram(@interface));
            @interface.DiagramUrl    = DiagramService.GetImageUrlForSource(@interface.Diagram, "svg");
            @interface.Documentation = DocumentService.GetInterfaceDocumentation(type.Namespace, @interface);

            @interface.Relationships = AssemblyDiagrammer.GetRelationships(@interface);

            return(@interface);
        }
示例#2
0
        /// <summary>
        /// Converts to class.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public static Models.Class ConvertToClass(Type type)
        {
            var @class = new Models.Class
            {
                Name       = Regex.Replace(type.Name, TypingSetter, ""),
                Properties = GetProperties(type),
                Functions  = GetFunctions(type),
                Voids      = GetVoids(type),
                Abstract   = type.IsAbstract,
                Static     = IsStaticType(type),
                Module     = IsModule(type),
                Implements = type.GetInterfaces().FirstOrDefault(),
                Inherits   = (type.BaseType ?? null)
            };

            @class.Diagram       = string.Format(Templates.PsuedoCode, AssemblyDiagrammer.WriteClassDiagram(@class));
            @class.DiagramUrl    = DiagramService.GetImageUrlForSource(@class.Diagram, "svg");
            @class.Documentation = DocumentService.GetClassDocumentation(type.Namespace, @class);

            @class.Relationships = AssemblyDiagrammer.GetRelationships(@class);

            return(@class);
        }