当前位置: 首页>>代码示例>>C#>>正文


C# DirectoryInfo.GetAssembliesFromDir方法代码示例

本文整理汇总了C#中System.IO.DirectoryInfo.GetAssembliesFromDir方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryInfo.GetAssembliesFromDir方法的具体用法?C# DirectoryInfo.GetAssembliesFromDir怎么用?C# DirectoryInfo.GetAssembliesFromDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.DirectoryInfo的用法示例。


在下文中一共展示了DirectoryInfo.GetAssembliesFromDir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Handle

        public HandlerAnswer Handle(Dictionary<string, string> prms)
        {
            Console.WriteLine("...TypeShortNameNamespaceContextHandler...");

            TagHTML tagsHTMLfull;
            string messageRangeOfError = null;
            TagHTML tagHTMLextra = Views.Text2TagHTML("");
            string contextname;
            if (prms.TryGetValue("ctx", out contextname))
            {
                string namespaceName;
                if (prms.TryGetValue("namespace", out namespaceName))
                {
                    namespaceName = namespaceName.IsNameOfNamespaceSpecialThenConvertToEmpty(); // conversao interna de normalizacao
                    string typeShortName;
                    if (prms.TryGetValue("shortName", out typeShortName))
                    {
                        var tagsHTMLnested = new List<TagHTML>();
                        var dir = new DirectoryInfo(Handlers.DIRECTORIA_RAIZ + "/" + contextname);
                        var listAssembliesOfContext = new List<Assembly>();
                        dir.GetAssembliesFromDir(contextname, listAssembliesOfContext, tagsHTMLnested, false); // povoar
                        var dictNamespacesTypeNamesOfContext =
                            listAssembliesOfContext.ToArray().GetDictNamespacesTypeFullNamesFromAssemblies(false, true).
                                OrderBy(elem => elem.Key).ToDictionary(elem => elem.Key, elem => elem.Value);
                        string namespaceOfContext;
                        List<string> listTypeNamesOfNamespace;
                        // o proprio namespace
                        bool isDataAvailable = false;
                        if (dictNamespacesTypeNamesOfContext.ContainsKey(namespaceName))
                        {
                            namespaceOfContext = namespaceName;
                            listTypeNamesOfNamespace = dictNamespacesTypeNamesOfContext[namespaceName];
                            if (listTypeNamesOfNamespace.Count > 0)
                            {
                                if (listTypeNamesOfNamespace.Contains(typeShortName))
                                {
                                    var listTypesEqualType =
                                        listAssembliesOfContext.GetTypesFromAssemblies(false, true, true).Where(
                                            t => t.GetFullNameFromType().Equals(typeShortName));
                                    if (listTypesEqualType.Count() > 0)
                                    {
                                        isDataAvailable = true;
                                        var tipo = listTypesEqualType.First();
                                        var tipoFullName = tipo.GetFullNameFromType();
                                        var tipoNamespace = tipo.GetNamespaceFromType();
                                        var tipoDeclType = tipo.DeclaringTypeByCatchingAnyException();
                                        tagsHTMLnested.Add(Views.TR(
                                            Views.TD(Views.Text2TagHTML(
                                                string.Format("Type Full Name do Namespace {1} do Contexto {0} :",
                                                              contextname, namespaceOfContext))),
                                            Views.TD(Views.Text2TagHTML(string.Format(" = {0}", tipoFullName)))
                                                               ));
                                        tagsHTMLnested.Add(Views.TR(
                                            Views.TD(Views.Text2TagHTML(string.Format(
                                                "UnderlyingSystemType Full Name do Namespace {1} do Contexto {0} :",
                                                contextname, namespaceOfContext))),
                                            Views.TD(Views.Text2TagHTML(
                                                string.Format(" = {0}", tipo.UnderlyingSystemType.GetFullNameFromType())))
                                                               ));
                                        tagsHTMLnested.Add(Views.TR(
                                            Views.TD(Views.Text2TagHTML(string.Format(
                                                "Características do Type do Namespace {1} do Contexto {0} :",
                                                contextname, namespaceOfContext, tipoFullName))),
                                            Views.TD(Views.Text2TagHTML(" Visible = " + tipo.IsVisible +
                                                                        " ;" +
                                                                        (tipo.IsPublic ? " Public" : "") +
                                                                        (tipo.IsNotPublic ? " NotPublic" : "") +
                                                                        (tipo.IsAbstract ? " Abstract" : "") +
                                                                        (tipo.IsSealed ? " Sealed" : "") +
                                                                        (tipo.IsPrimitive ? " Primitive" : "") +
                                                                        (tipo.IsPointer ? " Pointer" : "") +
                                                                        (tipo.IsEnum ? " Enum" : "") +
                                                                        (tipo.IsGenericType ? " GenericType" : "") +
                                                                        (tipo.IsClass ? " Class_RefType" : "") +
                                                                        (tipo.IsValueType ? " ValueType" : "") +
                                                                        (tipo.IsInterface ? " Interface" : "") +
                                                                        (tipo.IsSpecialName ? " SpecialName" : "")
                                                         ))
                                                               ));
                                        tagsHTMLnested.Add(Views.TR(
                                            Views.TD(Views.Text2TagHTML(string.Format(
                                                "Nome Simples do Assembly do Type {0}", tipoFullName))),
                                            Views.TD(
                                                Views.Text2TagHTML(string.Format(" = {0}", tipo.Assembly.GetName().Name)))
                                                               ));
                                        tagsHTMLnested.Add(Views.TR(
                                            Views.TD(Views.Text2TagHTML(string.Format(
                                                "Nome Completo do Assembly do Type {0}", tipoFullName))),
                                            Views.TD(Views.Text2TagHTML(string.Format(" = {0}", tipo.Assembly.FullName)))
                                                               ));
                                        tagsHTMLnested.Add(Views.TR(
                                            Views.TD(Views.Text2TagHTML(string.Format("Link do Módulo do Type {0} :",
                                                                                      tipoFullName))),
                                            Views.TD(Views.A(true,
                                                             string.Format("/{0}/as/{1}", contextname,
                                                                           tipo.Module.ScopeName),
                                                             Views.Text2TagHTML(string.Format(
                                                                 "Assembly {1} do Contexto {0}", contextname,
                                                                 tipo.Module.ScopeName))))
                                                               ));
//.........这里部分代码省略.........
开发者ID:cmfaustino,项目名称:Prompt11-01-VMEssentials.cmfaustino,代码行数:101,代码来源:Handlers.cs


注:本文中的System.IO.DirectoryInfo.GetAssembliesFromDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。