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


C# RuntimeAssembly.ToString方法代码示例

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


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

示例1: CaseInsensitiveManifestResourceStreamLookup

 private Stream CaseInsensitiveManifestResourceStreamLookup(RuntimeAssembly satellite, string name)
 {
     StringBuilder builder = new StringBuilder();
     if (this._mediator.LocationInfo != null)
     {
         string str = this._mediator.LocationInfo.Namespace;
         if (str != null)
         {
             builder.Append(str);
             if (name != null)
             {
                 builder.Append(Type.Delimiter);
             }
         }
     }
     builder.Append(name);
     string str2 = builder.ToString();
     CompareInfo compareInfo = CultureInfo.InvariantCulture.CompareInfo;
     string str3 = null;
     foreach (string str4 in satellite.GetManifestResourceNames())
     {
         if (compareInfo.Compare(str4, str2, CompareOptions.IgnoreCase) == 0)
         {
             if (str3 != null)
             {
                 throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_MultipleBlobs", new object[] { str2, satellite.ToString() }));
             }
             str3 = str4;
         }
     }
     if (FrameworkEventSource.IsInitialized)
     {
         if (str3 != null)
         {
             FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupSucceeded(this._mediator.BaseName, this._mediator.MainAssembly, satellite.GetSimpleName(), str2);
         }
         else
         {
             FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupFailed(this._mediator.BaseName, this._mediator.MainAssembly, satellite.GetSimpleName(), str2);
         }
     }
     if (str3 == null)
     {
         return null;
     }
     bool skipSecurityCheck = (this._mediator.MainAssembly == satellite) && (this._mediator.CallingAssembly == this._mediator.MainAssembly);
     StackCrawlMark lookForMyCaller = StackCrawlMark.LookForMyCaller;
     Stream stream = satellite.GetManifestResourceStream(str3, ref lookForMyCaller, skipSecurityCheck);
     if ((stream != null) && FrameworkEventSource.IsInitialized)
     {
         FrameworkEventSource.Log.ResourceManagerManifestResourceAccessDenied(this._mediator.BaseName, this._mediator.MainAssembly, satellite.GetSimpleName(), str3);
     }
     return stream;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:54,代码来源:ManifestBasedResourceGroveler.cs

示例2: CaseInsensitiveManifestResourceStreamLookup

        [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable
        private Stream CaseInsensitiveManifestResourceStreamLookup(RuntimeAssembly satellite, String name)
        {
            Contract.Requires(satellite != null, "satellite shouldn't be null; check caller");
            Contract.Requires(name != null, "name shouldn't be null; check caller");

            StringBuilder sb = new StringBuilder();
            if (_mediator.LocationInfo != null)
            {
                String nameSpace = _mediator.LocationInfo.Namespace;
                if (nameSpace != null)
                {
                    sb.Append(nameSpace);
                    if (name != null)
                        sb.Append(Type.Delimiter);
                }
            }
            sb.Append(name);

            String givenName = sb.ToString();
            CompareInfo comparer = CultureInfo.InvariantCulture.CompareInfo;
            String canonicalName = null;
            foreach (String existingName in satellite.GetManifestResourceNames())
            {
                if (comparer.Compare(existingName, givenName, CompareOptions.IgnoreCase) == 0)
                {
                    if (canonicalName == null)
                    {
                        canonicalName = existingName;
                    }
                    else
                    {
                        throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_MultipleBlobs", givenName, satellite.ToString()));
                    }
                }
            }

#if !FEATURE_CORECLR && !MONO
            if (FrameworkEventSource.IsInitialized)
            {
                if (canonicalName != null)
                {
                    FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupSucceeded(_mediator.BaseName, _mediator.MainAssembly, satellite.GetSimpleName(), givenName);
                }
                else
                {
                    FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupFailed(_mediator.BaseName, _mediator.MainAssembly, satellite.GetSimpleName(), givenName);
                }
            }
#endif

            if (canonicalName == null)
            {
                return null;
            }
            // If we're looking in the main assembly AND if the main
            // assembly was the person who created the ResourceManager,
            // skip a security check for private manifest resources.
            bool canSkipSecurityCheck = _mediator.MainAssembly == satellite && _mediator.CallingAssembly == _mediator.MainAssembly;
            StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
            Stream s = satellite.GetManifestResourceStream(canonicalName, ref stackMark, canSkipSecurityCheck);
            // GetManifestResourceStream will return null if we don't have 
            // permission to read this stream from the assembly.  For example,
            // if the stream is private and we're trying to access it from another
            // assembly (ie, ResMgr in mscorlib accessing anything else), we 
            // require Reflection TypeInformation permission to be able to read 
            // this.  <




#if !FEATURE_CORECLR && !MONO
            if (s!=null) {
                if (FrameworkEventSource.IsInitialized)
                {
                    FrameworkEventSource.Log.ResourceManagerManifestResourceAccessDenied(_mediator.BaseName, _mediator.MainAssembly, satellite.GetSimpleName(), canonicalName);
                }
            }
#endif
            return s;
        }
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:81,代码来源:manifestbasedresourcegroveler.cs

示例3: CaseInsensitiveManifestResourceStreamLookup

        [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable
        private Stream CaseInsensitiveManifestResourceStreamLookup(RuntimeAssembly satellite, String name)
        {
            Contract.Requires(satellite != null, "satellite shouldn't be null; check caller");
            Contract.Requires(name != null, "name shouldn't be null; check caller");

            StringBuilder sb = new StringBuilder();
            if (_mediator.LocationInfo != null)
            {
                String nameSpace = _mediator.LocationInfo.Namespace;
                if (nameSpace != null)
                {
                    sb.Append(nameSpace);
                    if (name != null)
                        sb.Append(Type.Delimiter);
                }
            }
            sb.Append(name);

            String givenName = sb.ToString();
            CompareInfo comparer = CultureInfo.InvariantCulture.CompareInfo;
            String canonicalName = null;
            foreach (String existingName in satellite.GetManifestResourceNames())
            {
                if (comparer.Compare(existingName, givenName, CompareOptions.IgnoreCase) == 0)
                {
                    if (canonicalName == null)
                    {
                        canonicalName = existingName;
                    }
                    else
                    {
                        throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_MultipleBlobs", givenName, satellite.ToString()));
                    }
                }
            }

            if (canonicalName == null)
            {
                return null;
            }

            // If we're looking in the main assembly AND if the main
            // assembly was the person who created the ResourceManager,
            // skip a security check for private manifest resources.
            bool canSkipSecurityCheck = _mediator.MainAssembly == satellite && _mediator.CallingAssembly == _mediator.MainAssembly;
            StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
            return satellite.GetManifestResourceStream(canonicalName, ref stackMark, canSkipSecurityCheck);
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:49,代码来源:ManifestBasedResourceGroveler.cs


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