Esempio n. 1
0
        /// <summary>GenerateDocumentation
        /// <para></para>
        /// </summary>
        public DocCollector GenerateDocumentation(Type CurrentType)
        {
            DocCollector            ObjDocCollector        = null;
            MethodDefination        ObjMethodDefination    = null;
            List <MethodDefination> ObjMethodDefinationlst = new List <MethodDefination>();
            List <string>           TypeCollections        = null;

            try
            {
                TypeCollections = new List <string>();
                foreach (var method in ((System.Reflection.TypeInfo)CurrentType).DeclaredMethods)
                {
                    IEnumerable <Attribute> Attributes = method.GetCustomAttributes();
                    foreach (Attribute attr in Attributes)
                    {
                        if (attr.GetType().Name == "Doc")
                        {
                            ObjMethodDefination            = new MethodDefination();
                            ObjMethodDefination.MethodName = method.Name;
                            ObjMethodDefination.Summary    = ((BottomhalfCore.Annotations.Doc)attr).Summary;
                            ObjMethodDefinationlst.Add(ObjMethodDefination);
                        }
                    }
                }

                if (ObjMethodDefinationlst.Count() > 0)
                {
                    ObjDocCollector                     = new DocCollector();
                    ObjDocCollector.ClassName           = CurrentType.FullName;
                    ObjDocCollector.ObjMethodDefination = ObjMethodDefinationlst;
                }
                return(ObjDocCollector);
            }
            catch (BeanException _beanEx)
            {
                _beanEx.LocationTrack(this.GetType().FullName + "GenerateDocumentation()");
                throw _beanEx;
            }
            catch (Exception ex)
            {
                BeanException ObjBeanException = new BeanException();
                ObjBeanException.LocationTrack(this.GetType().FullName + "GenerateDocumentation()");
                ObjBeanException.SetMessage(ex.Message);
                throw ObjBeanException;
            }
        }
        /// <summary>
        /// Unindexes a Node and some full text.
        /// </summary>
        /// <param name="graphUri">Graph URI.</param>
        /// <param name="n">Node.</param>
        /// <param name="text">Full Text.</param>
        protected override void Unindex(String graphUri, INode n, string text)
        {
            TermQuery query = new TermQuery(new Term(this._schema.HashField, this.GetHash(graphUri, n, text)));

            //Close the existing writer
            this.EnsureWriterClosed();

            //Create a read/write Index Reader to modify the index
            this.EnsureReaderOpen();
            IndexSearcher searcher  = new IndexSearcher(this._reader);
            DocCollector  collector = new DocCollector();

            searcher.Search(query, collector);

            //Delete at most one instance
            if (collector.Count > 0)
            {
                this._reader.DeleteDocument(collector.Documents.First().Key);
            }
        }
Esempio n. 3
0
        /// <summary>GetClassTypeCollection
        /// <para></para>
        /// </summary>
        private Dictionary <string, TypeRefCollection> GetClassTypeCollection(Type[] ActiveTypeCollection, List <AopDetail> aopDetailLst)
        {
            List <DocCollector> docCollectorlst = null;
            string            KeyName           = string.Empty;
            TypeRefCollection typeRefCollection = null;
            Dictionary <string, TypeRefCollection> ClassTypeCollection = new Dictionary <string, TypeRefCollection>();

            try
            {
                foreach (Type type in ActiveTypeCollection.ToList <Type>())
                {
                    if (type.Namespace != null && type.FullName.IndexOf("<") == -1 && type.FullName.IndexOf("<>") == -1 && !type.IsInterface && !type.IsAbstract)
                    {
                        typeRefCollection = new TypeRefCollection();
                        //FileName = ClassName.Replace(".cs", "").Trim();
                        //type = assemblyList.Where(x => x.FullName.Split(',')[0].ToLower() == asmName.ToLower())
                        //                   .SelectMany(a => a.GetTypes())
                        //                   .Where(i => i.Name.ToLower() == FileName.ToLower())
                        //                   .FirstOrDefault();

                        if (type != null)
                        {
                            /*---------------------- Reading and storing constructor detail of each class type. ---------------------------------
                             * /                                                                                                                    /
                             * / In this section it will iterate each classtype. Based on classtype this section will find all the constructor and  /
                             * / their parameter and also their detail. It will be used at the time of object creation and constructor selection.   /
                             * /                                                                                                                    /
                             * /                                                                                                                   */

                            DocCollector Docs = this.manageCodeDocuments.GenerateDocumentation(type);
                            if (Docs != null)
                            {
                                if (docCollectorlst == null)
                                {
                                    docCollectorlst = new List <DocCollector>();
                                }
                                docCollectorlst.Add(Docs);
                            }


                            /*-------------------------------------------- End Constructor reading --------------------------------------------- */



                            /*---------------------- Reading and storing constructor detail of each class type. ---------------------------------
                             * /                                                                                                                    /
                             * / In this section it will iterate each classtype. Based on classtype this section will find all the constructor and  /
                             * / their parameter and also their detail. It will be used at the time of object creation and constructor selection.   /
                             * /                                                                                                                    /
                             * /                                                                                                                   */

                            IFindClassAssets <FindConstructors> findClassAssets = new FindConstructors();
                            var CtorParam = findClassAssets.InspectMethods(type);
                            if (CtorParam != null && CtorParam.Count > 0)
                            {
                                typeRefCollection.Constructors = CtorParam;
                            }

                            /*-------------------------------------------- End Constructor reading --------------------------------------------- */



                            /*------------------------------ Reading and storing Class level annotation -----------------------------------------/
                             * /                                                                                                                    /
                             * / In this section it will iterate each classtype. Based on classtype this section will find all the constructor and  /
                             * / their parameter and also their detail. It will be used at the time of object creation and constructor selection.   /
                             * /                                                                                                                    /
                             * /                                                                                                                    /
                             * / ------------------------------------------------------------------------------------------------------------------ */

                            IFindClassAssets <FindAnnotations> findAnnotations = new FindAnnotations();
                            var ClassAnnotations = findAnnotations.InspectAnnotations(type, typeRefCollection);
                            if (ClassAnnotations != null)
                            {
                                if (ClassAnnotations.annotationDefination != null && ClassAnnotations.annotationDefination.Count > 0)
                                {
                                    typeRefCollection.AnnotationNames = ClassAnnotations.annotationDefination;
                                }
                                aopDetailLst = ClassAnnotations.aopDetailLst;
                            }

                            /*-------------------------------------------- End Constructor reading --------------------------------------------- */



                            /*---------------------- Reading and storing attributes detail of each class type. ---------------------------------
                             * /                                                                                                                    /
                             * / In this section it will iterate each classtype. Based on classtype this section will find all the constructor and  /
                             * / their parameter and also their detail. It will be used at the time of object creation and constructor selection.   /
                             * /                                                                                                                   */

                            IFindClassAssets <FindAttributes> findAttributes = new FindAttributes();
                            var TypeAttr = findAttributes.InspectAttributes(type);
                            if (TypeAttr != null && TypeAttr.Count > 0)
                            {
                                typeRefCollection.FieldAttributesCollection = TypeAttr;
                            }

                            /*                                                                                                                   /
                             * /                                                                                                                    /
                             * / ------------------------------------------------------------------------------------------------------------------ */

                            var AllBases = this.typeLoadingHelper.GetDeepBaseTypes(type, this.assemblyList);
                            if (AllBases != null)
                            {
                                typeRefCollection.BaseTypeHirarchy = AllBases;
                            }
                            //typeRefCollection.ClassType = type;
                            typeRefCollection.AssemblyQualifiedName       = type.AssemblyQualifiedName;
                            typeRefCollection.IsContainsGenericParameters = type.ContainsGenericParameters;
                            typeRefCollection.IsInterface             = type.IsInterface;
                            typeRefCollection.IsClass                 = type.IsClass;
                            typeRefCollection.ClassName               = type.Name;
                            typeRefCollection.ClassFullyQualifiedName = type.FullName;
                            typeRefCollection.AssemblyName            = type.Assembly.GetName().Name;
                            typeRefCollection.IsFullyCreated          = true;
                            if (type.Name.IndexOf("`") != -1)
                            {
                                KeyName = type.Name.Split('`')[0];
                            }
                            else
                            {
                                KeyName = type.Name;
                            }
                            ClassTypeCollection.Add(type.FullName.ToLower(), typeRefCollection);
                        }
                    }
                }

                return(ClassTypeCollection);
            }
            catch (BeanException _beanEx)
            {
                _beanEx.LocationTrack(this.GetType().FullName + "GetClassTypeCollection()");
                throw _beanEx;
            }
            catch (Exception ex)
            {
                BeanException ObjBeanException = new BeanException();
                ObjBeanException.LocationTrack(this.GetType().FullName + "GetClassTypeCollection()");
                ObjBeanException.SetMessage(ex.Message);
                throw ObjBeanException;
            }
        }