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


C# IAssemblyDefinition类代码示例

本文整理汇总了C#中IAssemblyDefinition的典型用法代码示例。如果您正苦于以下问题:C# IAssemblyDefinition类的具体用法?C# IAssemblyDefinition怎么用?C# IAssemblyDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: NotImplementedException

		bool ITypeDefinition.IsInternalAsPublic (IAssemblyDefinition assembly)
		{
			throw new NotImplementedException ();
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:4,代码来源:import.cs

示例2:

		bool ITypeDefinition.IsInternalAsPublic (IAssemblyDefinition assembly)
		{
			return Module.DeclaringAssembly == assembly;
		}
开发者ID:fvalette,项目名称:mono,代码行数:4,代码来源:class.cs

示例3:

		bool ITypeDefinition.IsInternalAsPublic (IAssemblyDefinition assembly)
		{
			var a = importer.GetAssemblyDefinition (provider.Module.Assembly);
			return a == assembly || a.IsFriendAssemblyTo (assembly);
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:5,代码来源:import.cs

示例4: IsFriendAssemblyTo

		public bool IsFriendAssemblyTo (IAssemblyDefinition assembly)
		{
			if (internals_visible_to == null)
				return false;

			AssemblyName is_visible = null;
			if (internals_visible_to_cache == null) {
				internals_visible_to_cache = new Dictionary<IAssemblyDefinition, AssemblyName> ();
			} else {
				if (internals_visible_to_cache.TryGetValue (assembly, out is_visible))
					return is_visible != null;
			}

			var token = assembly.GetPublicKeyToken ();
			if (token != null && token.Length == 0)
				token = null;

			foreach (var internals in internals_visible_to) {
				if (internals.Name != assembly.Name)
					continue;

				if (token == null && assembly is AssemblyDefinition) {
					is_visible = internals;
					break;
				}

				if (!ArrayComparer.IsEqual (token, internals.GetPublicKeyToken ()))
					continue;

				is_visible = internals;
				break;
			}

			internals_visible_to_cache.Add (assembly, is_visible);
			return is_visible != null;
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:36,代码来源:import.cs

示例5: GetAssemblyVisibleToName

		public AssemblyName GetAssemblyVisibleToName (IAssemblyDefinition assembly)
		{
			return internals_visible_to_cache [assembly];
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:4,代码来源:import.cs

示例6: LoadBitmapsFromAssembly

        public static Task<IList<BitmapContainer>> LoadBitmapsFromAssembly(IAssemblyDefinition assembly, Action<int> progressChangedCallback = null)
        {
            return Task.Factory.StartNew<IList<BitmapContainer>>(() =>
            {
                var bitmaps = new List<BitmapContainer>();

                ICollection<IResource> resources = CollectResources(assembly);

                int total = resources.Count;

                int progressCount = 0;
                //for (int i = 0; i < resources.Count; i++)

                foreach (IResource resource in resources)
                {
                    if (progressChangedCallback != null)
                        progressChangedCallback.Invoke((int)(100.0 * progressCount / total));

                    if (string.IsNullOrWhiteSpace(resource.Name)) continue;

                    if (resource.ResourceType != ResourceType.Embedded) continue;

                    IEmbeddedResource embeddedResource = resource as IEmbeddedResource;
                    if (embeddedResource == null) continue;

                    if (resource.Name.EndsWith(".resources"))
                    {
                        using (ResourceReader resourceReader = new ResourceReader(embeddedResource.GetResourceStream()))
                        {
                            var iterator = resourceReader.GetEnumerator();
                            while (iterator.MoveNext())
                            {
                                string rkey = iterator.Key as string;

                                if (string.IsNullOrWhiteSpace(rkey)) continue;

                                //Type rType = iterator.Value.GetType();

                                if (iterator.Value is string) continue;

                                Bitmap value = iterator.Value as Bitmap;
                                if (value != null)
                                {
                                    bitmaps.Add(new BitmapContainer
                                    {
                                        Name = rkey,
                                        Bitmap = Bitmap2BitmapImage(value)
                                    });

                                    continue;
                                }

                                try
                                {
                                    BitmapSource bitmap = LoadBitmapImage(embeddedResource.GetResourceStream());

                                    bitmaps.Add(new BitmapContainer
                                    {
                                        Name = rkey,
                                        Bitmap = bitmap
                                    });
                                }
                                catch
                                {
                                    /*not a bitmap */
                                }
                            }
                        }
                    }

                    try
                    {
                        var bitmap = LoadBitmapImage(embeddedResource.GetResourceStream());

                        bitmaps.Add(new BitmapContainer
                        {
                            Name = resource.Name,
                            Bitmap = bitmap
                        });
                    }
                    catch
                    {
                        /*not a bitmap */
                    }

                    progressCount++;
                }
                return bitmaps;
            });
        }
开发者ID:BinaryConstruct,项目名称:ResourceViewer,代码行数:90,代码来源:ResourceLoader.cs

示例7: CollectResources

        private static ICollection<IResource> CollectResources(IAssemblyDefinition assembly)
        {
            List<IResource> result = new List<IResource>();

            foreach (IResource resource in assembly.MainModule.Resources)
            {
                result.Add(resource);
            }

            return result;
        }
开发者ID:BinaryConstruct,项目名称:ResourceViewer,代码行数:11,代码来源:ResourceLoader.cs


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