本文整理汇总了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;
}
示例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();
}
}
}