本文整理汇总了C#中ISymUnmanagedDocument类的典型用法代码示例。如果您正苦于以下问题:C# ISymUnmanagedDocument类的具体用法?C# ISymUnmanagedDocument怎么用?C# ISymUnmanagedDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISymUnmanagedDocument类属于命名空间,在下文中一共展示了ISymUnmanagedDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateDocument
public static void ValidateDocument(ISymUnmanagedDocument document, string url, string algorithmId, byte[] checksum)
{
ValidateDocumentUrl(document, url);
int actualCount, actualCount2;
if (checksum != null)
{
Assert.Equal(HResult.S_OK, document.GetChecksum(0, out actualCount, null));
byte[] actualChecksum = new byte[actualCount];
Assert.Equal(HResult.S_OK, document.GetChecksum(actualCount, out actualCount2, actualChecksum));
Assert.Equal(actualCount, actualCount2);
AssertEx.Equal(checksum, actualChecksum);
}
else
{
Assert.Equal(HResult.S_FALSE, document.GetChecksum(0, out actualCount, null));
Assert.Equal(0, actualCount);
}
var guid = Guid.NewGuid();
Assert.Equal(HResult.S_OK, document.GetChecksumAlgorithmId(ref guid));
Assert.Equal(algorithmId != null ? new Guid(algorithmId) : default(Guid), guid);
guid = Guid.NewGuid();
Assert.Equal(HResult.S_OK, document.GetLanguageVendor(ref guid));
Assert.Equal(new Guid("994b45c4-e6e9-11d2-903f-00c04fa302a1"), guid);
guid = Guid.NewGuid();
Assert.Equal(HResult.S_OK, document.GetDocumentType(ref guid));
Assert.Equal(new Guid("5a869d0b-6611-11d3-bd2a-0000f80849bd"), guid);
}
示例2: GetMethodTokensForEachLine
private int[][] GetMethodTokensForEachLine(ISymUnmanagedReader symReader, ISymUnmanagedDocument symDocument, int minZeroBasedLine, int maxZeroBasedLine)
{
var result = new List<int[]>();
for (int line = minZeroBasedLine; line <= maxZeroBasedLine; line++)
{
int[] allMethodTokens = GetMethodTokensFromDocumentPosition(symReader, symDocument, line, 0);
ISymUnmanagedMethod method;
int hr = symReader.GetMethodFromDocumentPosition(symDocument, line, 1, out method);
if (hr != HResult.S_OK)
{
Assert.Equal(HResult.E_FAIL, hr);
Assert.Equal(0, allMethodTokens.Length);
}
else
{
int primaryToken;
Assert.Equal(HResult.S_OK, method.GetToken(out primaryToken));
Assert.Equal(primaryToken, allMethodTokens.First());
}
result.Add(allMethodTokens);
}
return result.ToArray();
}
示例3: TestGetDocuments1
public void TestGetDocuments1()
{
var symReader = CreateSymReaderFromResource(TestResources.Documents.DllAndPdb);
int actualCount;
Assert.Equal(HResult.S_OK, symReader.GetDocuments(0, out actualCount, null));
Assert.Equal(11, actualCount);
var actualDocuments = new ISymUnmanagedDocument[actualCount];
int actualCount2;
Assert.Equal(HResult.S_OK, symReader.GetDocuments(actualCount, out actualCount2, actualDocuments));
Assert.Equal(11, actualCount2);
ValidateDocument(actualDocuments[0],
url: @"C:\Documents.cs",
algorithmId: "ff1816ec-aa5e-4d10-87f7-6f4963833460",
checksum: new byte[] { 0xDB, 0xEB, 0x2A, 0x06, 0x7B, 0x2F, 0x0E, 0x0D, 0x67, 0x8A, 0x00, 0x2C, 0x58, 0x7A, 0x28, 0x06, 0x05, 0x6C, 0x3D, 0xCE });
ValidateDocument(actualDocuments[1], url: @"C:\a\b\c\d\1.cs", algorithmId: null, checksum: null);
ValidateDocument(actualDocuments[2], url: @"C:\a\b\c\D\2.cs", algorithmId: null, checksum: null);
ValidateDocument(actualDocuments[3], url: @"C:\a\b\C\d\3.cs", algorithmId: null, checksum: null);
ValidateDocument(actualDocuments[4], url: @"C:\a\b\c\d\x.cs", algorithmId: null, checksum: null);
ValidateDocument(actualDocuments[5], url: @"C:\A\b\c\x.cs", algorithmId: null, checksum: null);
ValidateDocument(actualDocuments[6], url: @"C:\a\b\x.cs", algorithmId: null, checksum: null);
ValidateDocument(actualDocuments[7], url: @"C:\a\B\3.cs", algorithmId: null, checksum: null);
ValidateDocument(actualDocuments[8], url: @"C:\a\B\c\4.cs", algorithmId: null, checksum: null);
ValidateDocument(actualDocuments[9], url: @"C:\*\5.cs", algorithmId: null, checksum: null);
ValidateDocument(actualDocuments[10], url: @":6.cs", algorithmId: null, checksum: null);
}
示例4: SymbolDocument
internal SymbolDocument(ISymUnmanagedDocument document)
{
if (document == null)
{
throw new ArgumentNullException("document");
}
m_unmanagedDocument = document;
}
示例5: SymbolDocument
internal SymbolDocument(ISymUnmanagedDocument unmanagedDocument)
{
if (unmanagedDocument == null)
{
throw new ArgumentNullException("unmanagedDocument");
}
this.unmanagedDocument = unmanagedDocument;
}
示例6: GetMethodsFromDocumentPosition
public static ISymUnmanagedMethod[] GetMethodsFromDocumentPosition(this CorSymReader_SxSClass instance, ISymUnmanagedDocument document, uint line, uint column)
{
uint count;
instance.__GetMethodsFromDocumentPosition(document, line, column, 0, out count, new ISymUnmanagedMethod[0]);
var methods = new ISymUnmanagedMethod[count];
instance.__GetMethodsFromDocumentPosition(document, line, column, count, out count, methods);
ProcessOutParameter(methods);
return methods;
}
示例7: GetSourceExtentInDocument
public static void GetSourceExtentInDocument(this ISymEncUnmanagedMethod method, ISymUnmanagedDocument document, out int startLine, out int endLine)
{
if (method == null)
{
throw new ArgumentNullException(nameof(method));
}
ThrowExceptionForHR(method.GetSourceExtentInDocument(document, out startLine, out endLine));
}
示例8: ValidateDocumentUrl
public static void ValidateDocumentUrl(ISymUnmanagedDocument document, string url)
{
int actualCount, actualCount2;
Assert.Equal(HResult.S_OK, document.GetUrl(0, out actualCount, null));
char[] actualUrl = new char[actualCount];
Assert.Equal(HResult.S_OK, document.GetUrl(actualCount, out actualCount2, actualUrl));
Assert.Equal(url, new string(actualUrl, 0, actualUrl.Length - 1));
}
示例9: GetDocuments
public ISymbolDocument[] GetDocuments() {
uint numDocs;
reader.GetDocuments(0, out numDocs, null);
var unDocs = new ISymUnmanagedDocument[numDocs];
reader.GetDocuments((uint)unDocs.Length, out numDocs, unDocs);
var docs = new ISymbolDocument[numDocs];
for (uint i = 0; i < numDocs; i++)
docs[i] = new SymbolDocument(unDocs[i]);
return docs;
}
示例10: TestGetMethodFromDocumentPosition
private void TestGetMethodFromDocumentPosition(
ISymUnmanagedReader symReader,
ISymUnmanagedDocument symDocument,
int zeroBasedLine,
int zeroBasedColumn,
int expectedToken)
{
ISymUnmanagedMethod method;
Assert.Equal(HResult.S_OK, symReader.GetMethodFromDocumentPosition(symDocument, zeroBasedLine, zeroBasedColumn, out method));
int token;
Assert.Equal(HResult.S_OK, method.GetToken(out token));
Assert.Equal(expectedToken, token);
}
示例11: SymUnmanagedSequencePoint
public SymUnmanagedSequencePoint(
int offset,
ISymUnmanagedDocument document,
int startLine,
int startColumn,
int endLine,
int endColumn)
{
this.Offset = offset;
this.Document = document;
this.StartLine = startLine;
this.StartColumn = startColumn;
this.EndLine = endLine;
this.EndColumn = endColumn;
}
示例12: GetDocuments
public ISymbolDocument[] GetDocuments()
{
int cDocs;
unmanagedReader.GetDocuments(0, out cDocs, null);
ISymUnmanagedDocument[] unmanagedDocuments = new ISymUnmanagedDocument[cDocs];
unmanagedReader.GetDocuments(cDocs, out cDocs, unmanagedDocuments);
ISymbolDocument[] documents = new SymbolDocument[cDocs];
uint i;
for (i = 0; i < cDocs; i++)
{
documents[i] = new SymbolDocument(unmanagedDocuments[i]);
}
return documents;
}
示例13: GetSequencePoints
// ISymUnmanagedMethod
public static SequencePoint[] GetSequencePoints(this ISymUnmanagedMethod symMethod, int codesize)
{
uint count = symMethod.GetSequencePointCount();
ISymUnmanagedDocument[] documents = new ISymUnmanagedDocument[count];
uint[] offsets = new uint[count];
uint[] lines = new uint[count];
uint[] columns = new uint[count];
uint[] endLines = new uint[count];
uint[] endColumns = new uint[count];
symMethod.GetSequencePoints(
count,
out count,
offsets,
documents,
lines,
columns,
endLines,
endColumns
);
var sequencePoints = new SequencePoint[count];
var urls = documents.Distinct().ToDictionary(d => d, d => d.GetURL());
var sums = documents.Distinct().ToDictionary(d => d, d => d.GetCheckSum());
uint token = symMethod.GetToken();
for(int i = 0; i < count; i++) {
sequencePoints[i] = new SequencePoint() {
MethodDefToken = token,
ILRanges = new [] { new ILRange((int)offsets[i], i + 1 < count ? (int)offsets[i + 1] : codesize) },
Filename = urls[documents[i]],
FileCheckSum = sums[documents[i]],
StartLine = (int)lines[i],
StartColumn = (int)columns[i],
EndLine = (int)endLines[i],
EndColumn = (int)endColumns[i]
};
}
return sequencePoints;
}
示例14: GetMethodTokensFromDocumentPosition
private int[] GetMethodTokensFromDocumentPosition(
ISymUnmanagedReader symReader,
ISymUnmanagedDocument symDocument,
int zeroBasedLine,
int zeroBasedColumn)
{
int count;
Assert.Equal(HResult.S_OK, symReader.GetMethodsFromDocumentPosition(symDocument, zeroBasedLine, zeroBasedColumn, 0, out count, null));
var methods = new ISymUnmanagedMethod[count];
int count2;
Assert.Equal(HResult.S_OK, symReader.GetMethodsFromDocumentPosition(symDocument, zeroBasedLine, zeroBasedColumn, count, out count2, methods));
Assert.Equal(count, count2);
return methods.Select(m =>
{
int token;
Assert.Equal(HResult.S_OK, m.GetToken(out token));
return token;
}).ToArray();
}
示例15: GetSequencePoints
internal static ImmutableArray<SymUnmanagedSequencePoint> GetSequencePoints(this ISymUnmanagedMethod method)
{
// NB: method.GetSequencePoints(0, out numAvailable, ...) always returns 0.
int numAvailable;
int hr = method.GetSequencePointCount(out numAvailable);
SymUnmanagedReaderExtensions.ThrowExceptionForHR(hr);
if (numAvailable == 0)
{
return ImmutableArray<SymUnmanagedSequencePoint>.Empty;
}
int[] offsets = new int[numAvailable];
ISymUnmanagedDocument[] documents = new ISymUnmanagedDocument[numAvailable];
int[] startLines = new int[numAvailable];
int[] startColumns = new int[numAvailable];
int[] endLines = new int[numAvailable];
int[] endColumns = new int[numAvailable];
int numRead;
hr = method.GetSequencePoints(numAvailable, out numRead, offsets, documents, startLines, startColumns, endLines, endColumns);
SymUnmanagedReaderExtensions.ThrowExceptionForHR(hr);
if (numRead != numAvailable)
{
throw new InvalidOperationException(string.Format("Read only {0} of {1} sequence points.", numRead, numAvailable));
}
var builder = ArrayBuilder<SymUnmanagedSequencePoint>.GetInstance(numRead);
for (int i = 0; i < numRead; i++)
{
builder.Add(new SymUnmanagedSequencePoint(
offsets[i],
documents[i],
startLines[i],
startColumns[i],
endLines[i],
endColumns[i]));
}
return builder.ToImmutableAndFree();
}