當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。