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


C# IImageStream.ReadAllBytes方法代码示例

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


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

示例1: Add

		/// <summary>
		/// Adds a resource
		/// </summary>
		/// <param name="stream">The resource data</param>
		/// <returns>The resource data</returns>
		public ByteArrayChunk Add(IImageStream stream) {
			if (setOffsetCalled)
				throw new InvalidOperationException("SetOffset() has already been called");
			var rawData = stream.ReadAllBytes();
			length = Utils.AlignUp(length + 4 + (uint)rawData.Length, alignment);
			var data = new ByteArrayChunk(rawData);
			resources.Add(data);
			return data;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:14,代码来源:NetResources.cs

示例2: PinnedMetaData

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="stream">Metadata stream</param>
		public PinnedMetaData(IImageStream stream) {
			this.stream = stream;

			var umStream = stream as UnmanagedMemoryImageStream;
			if (umStream != null) {
				this.address = umStream.StartAddress;
				GC.SuppressFinalize(this);	// no GCHandle so finalizer isn't needed
			}
			else {
				var memStream = stream as MemoryImageStream;
				if (memStream != null) {
					this.streamData = memStream.DataArray;
					this.gcHandle = GCHandle.Alloc(this.streamData, GCHandleType.Pinned);
					this.address = new IntPtr(this.gcHandle.AddrOfPinnedObject().ToInt64() + memStream.DataOffset);
				}
				else {
					this.streamData = stream.ReadAllBytes();
					this.gcHandle = GCHandle.Alloc(this.streamData, GCHandleType.Pinned);
					this.address = this.gcHandle.AddrOfPinnedObject();
				}
			}
		}
开发者ID:Excelion,项目名称:dnlib,代码行数:26,代码来源:PinnedMetaData.cs


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