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


C# ISymUnmanagedDocument类代码示例

本文整理汇总了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);
        }
开发者ID:antonfirsov,项目名称:roslyn,代码行数:33,代码来源:SymTestHelpers.cs

示例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();
        }
开发者ID:ahmedshuhel,项目名称:roslyn,代码行数:28,代码来源:MethodMapTests.cs

示例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);
        }
开发者ID:ahmedshuhel,项目名称:roslyn,代码行数:29,代码来源:SymReaderTests.cs

示例4: SymbolDocument

 internal SymbolDocument(ISymUnmanagedDocument document)
 {
     if (document == null)
     {
         throw new ArgumentNullException("document");
     }
     m_unmanagedDocument = document;
 }
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:8,代码来源:SymDocument.cs

示例5: SymbolDocument

 internal SymbolDocument(ISymUnmanagedDocument unmanagedDocument)
 {
     if (unmanagedDocument == null)
     {
         throw new ArgumentNullException("unmanagedDocument");
     }
     this.unmanagedDocument = unmanagedDocument;
 }
开发者ID:modulexcite,项目名称:FieldLog,代码行数:8,代码来源:SymbolDocument.cs

示例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;
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:9,代码来源:CorSymExtensionMethods.generated.cs

示例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));
        }
开发者ID:dotnet,项目名称:symreader,代码行数:9,代码来源:SymUnmanagedExtensions.Method.cs

示例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));
        }
开发者ID:antonfirsov,项目名称:roslyn,代码行数:9,代码来源:SymTestHelpers.cs

示例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;
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:10,代码来源:SymbolReader.cs

示例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);
        }
开发者ID:ahmedshuhel,项目名称:roslyn,代码行数:14,代码来源:MethodMapTests.cs

示例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;
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:15,代码来源:SymUnmanagedSequencePoint.cs

示例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;
        }
开发者ID:modulexcite,项目名称:FieldLog,代码行数:15,代码来源:SymbolReader.cs

示例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;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:44,代码来源:CorSymExtensionMethods.cs

示例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();
        }
开发者ID:ahmedshuhel,项目名称:roslyn,代码行数:21,代码来源:MethodMapTests.cs

示例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();
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:40,代码来源:SymUnmanagedReaderTestExtensions.cs


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