本文整理汇总了C#中IImageStream.Create方法的典型用法代码示例。如果您正苦于以下问题:C# IImageStream.Create方法的具体用法?C# IImageStream.Create怎么用?C# IImageStream.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IImageStream
的用法示例。
在下文中一共展示了IImageStream.Create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFunctions
public void LoadFunctions(PdbReader reader, IImageStream stream) {
stream.Position = 0;
using (var substream = stream.Create(stream.FileOffset + stream.Position, cbSyms))
ReadFunctions(substream);
if (Functions.Count > 0) {
stream.Position += cbSyms + cbOldLines;
using (var substream = stream.Create(stream.FileOffset + stream.Position, cbLines))
ReadLines(reader, substream);
}
}
示例2: ReadInternal
void ReadInternal(IImageStream stream) {
stream.Position = 0;
string sig = Encoding.ASCII.GetString(stream.ReadBytes(30));
if (sig != "Microsoft C/C++ MSF 7.00\r\n\u001ADS\0")
throw new PdbException("Invalid signature");
stream.Position += 2;
uint pageSize = stream.ReadUInt32();
uint fpm = stream.ReadUInt32();
uint pageCount = stream.ReadUInt32();
uint rootSize = stream.ReadUInt32();
stream.ReadUInt32();
var numOfRootPages = RoundUpDiv(rootSize, pageSize);
var numOfPtrPages = RoundUpDiv(numOfRootPages * 4, pageSize);
if (pageCount * pageSize != stream.Length)
throw new PdbException("File size mismatch");
var pages = new IImageStream[pageCount];
try {
FileOffset offset = 0;
for (uint i = 0; i < pageCount; i++) {
pages[i] = stream.Create(offset, pageSize);
offset += pageSize;
}
var rootPages = new IImageStream[numOfRootPages];
int pageIndex = 0;
for (int i = 0; i < numOfPtrPages && pageIndex < numOfRootPages; i++) {
var ptrPage = pages[stream.ReadUInt32()];
ptrPage.Position = 0;
for (; ptrPage.Position < ptrPage.Length && pageIndex < numOfRootPages; pageIndex++)
rootPages[pageIndex] = pages[ptrPage.ReadUInt32()];
}
ReadRootDirectory(new MsfStream(rootPages, rootSize), pages, pageSize);
}
finally {
foreach (var page in pages) {
if (page != null)
page.Dispose();
}
}
ReadNames();
ReadStringTable();
var tokenMapStream = ReadModules();
documents = new Dictionary<string, DbiDocument>(StringComparer.OrdinalIgnoreCase);
foreach (var module in modules)
if (IsValidStreamIndex(module.StreamId))
module.LoadFunctions(this, streams[module.StreamId].Content);
if (IsValidStreamIndex(tokenMapStream ?? STREAM_INVALID_INDEX))
ApplyRidMap(streams[tokenMapStream.Value].Content);
functions = new Dictionary<uint, DbiFunction>();
foreach (var module in modules)
foreach (var func in module.Functions) {
functions.Add(func.Token, func);
}
}