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


C# AssemblyNameReference.ToString方法代码示例

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


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

示例1: Resolve

        public virtual AssemblyDefinition Resolve(AssemblyNameReference name)
        {
            if (name == null)
                throw new ArgumentNullException ("name");

            var assembly = SearchDirectory (name, m_directories);
            if (assembly != null)
                return assembly;

            #if !SILVERLIGHT && !CF
            var framework_dir = Path.GetDirectoryName (typeof(object).Module.FullyQualifiedName);

            if (IsZero (name.Version)) {
                assembly = SearchDirectory (name, new[] { framework_dir });
                if (assembly != null)
                    return assembly;
            }

            if (name.Name == "mscorlib") {
                assembly = GetCorlib (name);
                if (assembly != null)
                    return assembly;
            }

            assembly = GetAssemblyInGac (name);
            if (assembly != null)
                return assembly;

            assembly = SearchDirectory (name, new[] { framework_dir });
            if (assembly != null)
                return assembly;
            #endif

            if (ResolveFailure != null) {
                assembly = ResolveFailure (this, name);
                if (assembly != null)
                    return assembly;
            }

            throw new FileNotFoundException (name.ToString ());
        }
开发者ID:remobjects,项目名称:Obfuscar,代码行数:41,代码来源:AssemblyCache.cs

示例2: Cecil2Reflector

        public static Reflector.CodeModel.IAssemblyReference Cecil2Reflector(AssemblyNameReference anr, ModuleDefinition md)
        {
            Reflector.CodeModel.IModule m = Cecil2Reflector(md);
            if (m == null) return null;

            string anrName = anr.ToString();
            foreach (Reflector.CodeModel.IAssemblyReference ar in m.AssemblyReferences)
            {
                if (ar.ToString() == anrName) 
                    return ar;
            }
            return null;
        }
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:13,代码来源:CecilHelper.cs

示例3: findModules

 IEnumerable<Module> findModules(AssemblyNameReference assemblyRef)
 {
     var moduleHash = assemblyHash.lookup(assemblyRef.ToString());
     if (moduleHash != null)
         return moduleHash.Modules;
     return null;
 }
开发者ID:ldh0227,项目名称:de4dot,代码行数:7,代码来源:Modules.cs

示例4: LoadDependency

 /// <summary>
 /// Loads a dependency and adds it to Dependencies. Requires the field Dir to be set.
 /// </summary>
 /// <param name="dependency">Dependency to load.</param>
 public virtual void LoadDependency(AssemblyNameReference dependency)
 {
     LoadDependency(dependency.Name, dependency.ToString());
 }
开发者ID:alikaptanoglu,项目名称:MonoMod,代码行数:8,代码来源:MonoMod.cs

示例5: Load

        /// <summary>
        /// this is fully reentrant and multithreading capable, but will itself block.
        /// </summary>
        private AssemblyDefinition Load(AssemblyNameReference name, string assemblyFilename, ReaderParameters parameters)
        {
            AssemblyDefinition ret = null;
            TaskCompletionSource<AssemblyDefinition> loadingTaskSource = new TaskCompletionSource<AssemblyDefinition>();

            bool nameRegistered = false, filenameRegistered = false;

            try
            {
                // First, make sure we are the only one loading.
                while (true)
                {
                    Task<AssemblyDefinition> loadingTask;
                    if (name != null && !nameRegistered)
                    {
                        if (loadingTasks.TryGetValue(name.Name, out loadingTask))
                        {
                            ret = loadingTask.Result;
                            return ret;
                        }

                        if (!loadingTasks.TryAdd(name.Name, loadingTaskSource.Task))
                            continue;
                        nameRegistered = true;
                    }

                    if (loadingTasks.TryAdd(assemblyFilename, loadingTaskSource.Task))
                    {
                        filenameRegistered = true;
                        break;
                    }
                    if (loadingTasks.TryGetValue(assemblyFilename, out loadingTask))
                    {
                        if (loadingTask == loadingTaskSource.Task)
                            break;

                        ret = loadingTask.Result;
                        return ret;
                    }
                }

                // now check if it has already been loaded.
                if (name != null)
                {
                    if (referencesByName.TryGetValue(name.Name, out ret))
                        return ret;
                }

                ret = fileNamesByAssembly.FirstOrDefault(v => v.Value.Equals(assemblyFilename, StringComparison.InvariantCultureIgnoreCase)).Key;
                if (ret != null)
                    return ret;

                // now load the assembly.
                Console.WriteLine("Loading {0}...", Path.GetFileName(assemblyFilename));

                AssemblyDefinition assm = AssemblyDefinition.ReadAssembly(assemblyFilename, parameters);

                VerifyFrameworkAssembly(assm, assemblyFilename);

                // have to use a lock to update both data structures at the same time.
                lock (referencesByName)
                {
                    // now check again by the assembly name if it has been loaded before.
                    // This can happen if we were only provided a file name
                    if (!referencesByName.TryAdd(assm.Name.Name, assm))
                    {
                        ret = referencesByName[assm.Name.Name];
                        return ret;
                    }

                    fileNamesByAssembly[assm] = assemblyFilename;
                }

                ret = assm;

                // now notify any listeners. note that if we were called on multiple threads
                // these might be called reentrantly as well.

                if(assemblyLoaded != null)
                    assemblyLoaded(ret);

                if (classLoader != null)
                    classLoader.LoadAssembly(ret);

                // done.
                return ret;
            }
            catch (Exception ex)
            {
            #if DEBUG
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            #endif
                // Log the error
                var assemblyName = name==null?assemblyFilename:name.ToString();
                DLog.Error(DContext.CompilerAssemblyResolver, "Failed to load assembly {0}: {1}", assemblyName, ex.Message);

//.........这里部分代码省略.........
开发者ID:Xtremrules,项目名称:dot42,代码行数:101,代码来源:AssemblyResolver.cs


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