We need you! We're working hard on the next version of Developer Fusion -
Let us know what you think we should be up to!
-
Expand
Microsoft.Win32
-
Expand
Microsoft.Win32.SafeHandles
-
Expand
System
-
Expand
System.Runtime.Hosting
-
Expand
System.Runtime.InteropServices
-
Expand
System.Runtime.CompilerServices
-
Expand
System.Collections
-
Expand
System.Collections.Generic
-
Expand
System.Collections.ObjectModel
-
Expand
System.Configuration.Assemblies
-
Expand
System.Diagnostics
-
Expand
System.Diagnostics.CodeAnalysis
-
Expand
System.Diagnostics.SymbolStore
-
Expand
CreateSymClass
-
Expand
ISymbolBinder
-
Expand
ISymbolBinder1
-
Expand
ISymbolDocument
-
Expand
ISymbolDocumentWriter
-
Expand
ISymbolMethod
-
Expand
ISymbolNamespace
-
Expand
ISymbolReader
-
Expand
ISymbolScope
-
Expand
ISymbolVariable
-
Expand
ISymbolWriter
-
Expand
SymAddressKind
-
Expand
SymBinder
-
Expand
SymbolToken
-
Expand
SymDocument
-
Expand
SymDocumentType
-
Expand
SymDocumentWriter
-
Expand
SymLanguageType
-
Expand
SymLanguageVendor
-
Expand
SymMethod
-
Expand
SymNamespace
-
Expand
SymReader
-
Expand
SymScope
-
EndOffset()
-
GetChildren()
-
GetLocals()
-
GetNamespaces()
-
Method()
-
Parent()
-
StartOffset()
-
SymScope(IntPtr)
-
SymScope_GetChildren(IntPtr, int, int, IntPtr)
-
SymScope_GetEndOffset(IntPtr, int)
-
SymScope_GetLocals(IntPtr, int, int, IntPtr)
-
SymScope_GetMethod(IntPtr, IntPtr)
-
SymScope_GetNamespaces(IntPtr, int, int, IntPtr)
-
SymScope_GetParent(IntPtr, IntPtr)
-
SymScope_GetStartOffset(IntPtr, int)
-
SymScope_Release(IntPtr)
-
Expand
SymVariable
-
Expand
SymWriter
-
Expand
Win32Native
-
Expand
System.Globalization
-
Expand
System.IO
-
Expand
System.IO.IsolatedStorage
-
Expand
System.Reflection
-
Expand
System.Reflection.Cache
-
Expand
System.Reflection.Emit
-
Expand
System.Resources
-
Expand
System.Runtime
-
Expand
System.Runtime.InteropServices.Expando
-
Expand
System.Runtime.ConstrainedExecution
-
Expand
System.Runtime.Remoting.Activation
-
Expand
System.Runtime.Remoting.Messaging
-
Expand
System.Runtime.Remoting.Channels
-
Expand
System.Runtime.Remoting.Lifetime
-
Expand
System.Runtime.Remoting
-
Expand
System.Runtime.Remoting.Contexts
-
Expand
System.Runtime.Remoting.Proxies
-
Expand
System.Runtime.Remoting.Metadata
-
Expand
System.Runtime.Remoting.Metadata.W3cXsd2001
-
Expand
System.Runtime.Remoting.Services
-
Expand
System.Runtime.Serialization
-
Expand
System.Runtime.Serialization.Formatters
-
Expand
System.Runtime.Serialization.Formatters.Binary
-
Expand
System.Runtime.Versioning
-
Expand
System.Security
-
Expand
System.Security.Cryptography
-
Expand
System.Security.Cryptography.X509Certificates
-
Expand
System.Security.Permissions
-
Expand
System.Security.Policy
-
Expand
System.Security.Principal
-
Expand
System.Security.Util
-
Expand
System.Text
-
Expand
System.Threading
-
Expand
System.Runtime.Remoting.Channels.Http
-
Expand
System.Runtime.Remoting.Channels.Tcp
-
Expand
System.Runtime.Remoting.MetadataServices
-
Expand
System.Runtime.Serialization.Formatters.Soap.Xml
-
Expand
System.Runtime.Serialization.Formatters.Soap
-
Expand
Microsoft.Tools.Caspol
-
Expand
Microsoft.Tools.Build
-
Expand
Microsoft.CSharp
-
Expand
System.CodeDom
-
Expand
System.CodeDom.Compiler
-
Expand
System.Collections.Specialized
-
Expand
System.ComponentModel
-
Expand
System.ComponentModel.Design
-
Expand
System.ComponentModel.Design.Serialization
-
Expand
System.Configuration
-
Expand
System.Web
-
Expand
System.Configuration.Provider
-
Expand
System.Configuration.Internal
-
Expand
System.Internal
-
Expand
System.Windows.Forms
-
Expand
System.Net
-
Expand
System.Net.Sockets
-
Expand
System.Net.NetworkInformation
-
Expand
System.Net.ComImports
-
Expand
System.Net.Security
-
Expand
System.Net.Cache
-
Expand
System.Net.Configuration
-
Expand
System.Text.RegularExpressions
-
Expand
System.Tools
-
Expand
System.IO.Compression
-
Expand
System.IO.Ports
-
Expand
System.Security.AccessControl
-
Expand
System.Xml
-
Expand
System.Xml.XPath.DataBinding
-
Expand
System.Xml.Schema
-
Expand
System.Xml.Serialization
-
Expand
System.Xml.Serialization.Advanced
-
Expand
System.Xml.Serialization.Configuration
-
Expand
System.Xml.XPath
-
Expand
System.Xml.Xsl
-
Expand
System.Xml.Xsl.IlGen
-
Expand
System.Xml.Xsl.Qil
-
Expand
System.Xml.Xsl.Runtime
-
Expand
System.Xml.Xsl.XPath
-
Expand
System.Xml.Xsl.Xslt
-
Expand
System.Xml.Xsl.XsltOld
-
Expand
System.Xml.Xsl.XsltOld.Debugger
-
Expand
Microsoft.JScript
-
Expand
Microsoft.Vsa
-
Expand
Microsoft.JScript.Vsa
- using System;
- using System.Text;
- using System.Reflection;
- using System.Diagnostics;
- using System.Security.Permissions;
- using System.Diagnostics.SymbolStore;
- using System.Runtime.InteropServices;
- using Microsoft.Win32;
- namespace System.Diagnostics.SymbolStore
- {
- internal sealed class Win32Native
- {
- #if !PLATFORM_UNIX
- internal const string DLLPREFIX = "";
- internal const string DLLSUFFIX = ".dll";
- #else // !PLATFORM_UNIX
- #if __APPLE__
- internal const string DLLPREFIX = "lib";
- internal const string DLLSUFFIX = ".dylib";
- #else
- internal const string DLLPREFIX = "lib";
- internal const string DLLSUFFIX = ".so";
- #endif
- #endif // !PLATFORM_UNIX
- }
-
-
-
-
- class CreateSymClass
- {
- public const string NATIVE_DLL = Win32Native.DLLPREFIX + "ildbsymbols" + Win32Native.DLLSUFFIX;
-
- private static readonly Guid IID_IClassFactory = new Guid(1, 0, 0, 192, 0, 0, 0, 0, 0, 0,
- 70);
-
- [DllImport(NATIVE_DLL)]
- static extern int DllGetClassObject( [In()]
- ref Guid rclsid, [In()]
- ref Guid riid, out IntPtr ClassObject);
-
- [DllImport(NATIVE_DLL)]
- static extern int ClassFactory_CreateInstance(IntPtr classfactory, [In()]
- ref Guid rclsid, out IntPtr ClassInstance);
-
- [DllImport(NATIVE_DLL)]
- static extern void ClassFactory_Release(IntPtr classfactory);
-
- public static IntPtr CreateClass(Guid rclsid, Guid riid)
- {
- IntPtr classFactory;
- IntPtr objCreatedObject;
-
- COMException Exception;
-
- Guid IClassFactory = IID_IClassFactory;
- int hr;
- hr = DllGetClassObject(ref rclsid, ref IClassFactory, out classFactory);
- try {
- if (hr < 0) {
- Exception = new COMException("Call to DllGetClassObject failed.", hr);
- throw Exception;
- }
- hr = ClassFactory_CreateInstance(classFactory, ref riid, out objCreatedObject);
- if (hr < 0) {
- Exception = new COMException("Call to CreateInstance failed.", hr);
- throw Exception;
- }
- }
- finally {
- ClassFactory_Release(classFactory);
- }
-
- return objCreatedObject;
- }
- }
-
-
-
-
- public class SymDocument : ISymbolDocument
- {
-
- private IntPtr m_Document;
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocument_Release(IntPtr DocumentWriter);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocument_GetCheckSum(IntPtr Document, int cData, out int pcData, [In()]
- byte[] data);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocument_GetCheckSumAlgorithmId(IntPtr Document, out Guid pRetVal);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocument_GetDocumentType(IntPtr Document, out Guid pRetVal);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocument_GetLanguage(IntPtr Document, out Guid pRetVal);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocument_GetLanguageVendor(IntPtr Document, out Guid pRetVal);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocument_HasEmbeddedSource(IntPtr Document, out bool pRetVal);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocument_GetSourceLength(IntPtr Document, out int pRetVal);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocument_GetSourceRange(IntPtr Document, int startLine, int startColumn, int endLine, int endColumn, int cSourceBytes, out int pcSourceBytes, [In()]
- byte[] source);
-
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocument_FindClosestLine(IntPtr Document, int line, out int pRetVal);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocument_GetUrl(IntPtr Document, int cchUrl, out int pcchUrl, StringBuilder szUrl);
-
-
-
-
-
-
- public SymDocument(IntPtr pDocument)
- {
- m_Document = pDocument;
- }
-
- ~SymDocument()
- {
- SymDocument_Release(m_Document);
- }
-
- public byte[] GetCheckSum()
- {
- int hr;
- byte[] Data;
- COMException Exception;
- int cData;
- hr = SymDocument_GetCheckSum(m_Document, 0, out cData, null);
- if (hr < 0) {
- Exception = new COMException("Call to GetCheckSum failed.", hr);
- throw Exception;
- }
- Data = new byte[cData];
- hr = SymDocument_GetCheckSum(m_Document, cData, out cData, Data);
- if (hr < 0) {
- Exception = new COMException("Call to GetCheckSum failed.", hr);
- throw Exception;
- }
- return Data;
- }
-
- public Guid CheckSumAlgorithmId {
- get {
- int hr;
- Guid AlgorigthId;
- COMException Exception;
- hr = SymDocument_GetCheckSumAlgorithmId(m_Document, out AlgorigthId);
- if (hr < 0) {
- Exception = new COMException("Call to GetCheckSumAlgorithmId failed.", hr);
- throw Exception;
- }
- return AlgorigthId;
- }
- }
-
- public Guid DocumentType {
- get {
- int hr;
- Guid DocumentType;
- COMException Exception;
- hr = SymDocument_GetDocumentType(m_Document, out DocumentType);
- if (hr < 0) {
- Exception = new COMException("Call to GetDocumentType failed.", hr);
- throw Exception;
- }
- return DocumentType;
- }
- }
-
- public Guid Language {
- get {
- int hr;
- Guid Language;
- COMException Exception;
- hr = SymDocument_GetLanguage(m_Document, out Language);
- if (hr < 0) {
- Exception = new COMException("Call to GetLanguage failed.", hr);
- throw Exception;
- }
- return Language;
- }
- }
-
- public Guid LanguageVendor {
- get {
- int hr;
- Guid LanguageVendor;
- COMException Exception;
- hr = SymDocument_GetLanguageVendor(m_Document, out LanguageVendor);
- if (hr < 0) {
- Exception = new COMException("Call to GetLanguageVendor failed.", hr);
- throw Exception;
- }
- return LanguageVendor;
- }
- }
-
- public bool HasEmbeddedSource {
- get {
- int hr;
- bool HasEmbeddedSource;
- COMException Exception;
- hr = SymDocument_HasEmbeddedSource(m_Document, out HasEmbeddedSource);
- if (hr < 0) {
- Exception = new COMException("Call to HasEmbeddedSource failed.", hr);
- throw Exception;
- }
- return HasEmbeddedSource;
- }
- }
-
- public int FindClosestLine(int line)
- {
- int hr;
- int ClosestLine = 0;
- COMException Exception;
- hr = SymDocument_FindClosestLine(m_Document, line, out ClosestLine);
- if (hr < 0) {
- Exception = new COMException("Call to FindClosestLine failed.", hr);
- throw Exception;
- }
- return ClosestLine;
- }
-
- public byte[] GetSourceRange(int startLine, int startColumn, int endLine, int endColumn)
- {
- int hr;
- byte[] Range;
- int cSourceBytes;
- COMException Exception;
- hr = SymDocument_GetSourceRange(m_Document, startLine, startColumn, endLine, endColumn, 0, out cSourceBytes, null);
- if (hr < 0) {
- Exception = new COMException("Call to GetSourceRange failed.", hr);
- throw Exception;
- }
- Range = new byte[cSourceBytes];
- hr = SymDocument_GetSourceRange(m_Document, startLine, startColumn, endLine, endColumn, cSourceBytes, out cSourceBytes, Range);
- if (hr < 0) {
- Exception = new COMException("Call to GetSourceRange failed.", hr);
- throw Exception;
- }
- return Range;
- }
-
- public int SourceLength {
- get {
- int hr;
- int SourceLength;
- COMException Exception;
- hr = SymDocument_GetSourceLength(m_Document, out SourceLength);
- if (hr < 0) {
- Exception = new COMException("Call to GetSourceLength failed.", hr);
- throw Exception;
- }
- return SourceLength;
- }
- }
- public string URL {
- get {
- int hr;
- StringBuilder URL;
- int cchUrl;
- COMException Exception;
- hr = SymDocument_GetUrl(m_Document, 0, out cchUrl, null);
- if (hr < 0) {
- Exception = new COMException("Call to GetUrl failed.", hr);
- throw Exception;
- }
-
- URL = new StringBuilder(cchUrl);
- hr = SymDocument_GetUrl(m_Document, cchUrl, out cchUrl, URL);
- if (hr < 0) {
- Exception = new COMException("Call to GetUrl failed.", hr);
- throw Exception;
- }
- return URL.ToString();
- }
- }
-
-
- public IntPtr InternalDocument {
- get { return m_Document; }
- }
-
- }
-
- public class SymDocumentWriter : ISymbolDocumentWriter
- {
-
- private IntPtr m_DocumentWriter;
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocumentWriter_Release(IntPtr DocumentWriter);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocumentWriter_SetSource(IntPtr DocumentWriter, int sourceSize, byte[] source);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymDocumentWriter_SetCheckSum(IntPtr DocumentWriter, Guid algorithmId, int CheckSumSize, byte[] CheckSum);
-
-
-
-
-
-
- public SymDocumentWriter(IntPtr DocumentWriter)
- {
- m_DocumentWriter = DocumentWriter;
- }
-
- ~SymDocumentWriter()
- {
- SymDocumentWriter_Release(m_DocumentWriter);
- }
-
- public void SetSource(byte[] source)
- {
- int hr;
- COMException Exception;
- hr = SymDocumentWriter_SetSource(m_DocumentWriter, source.Length, source);
- if (hr < 0) {
- Exception = new COMException("Call to SetSource failed.", hr);
- throw Exception;
- }
- }
-
- public void SetCheckSum(Guid algorithmId, byte[] source)
- {
- int hr;
- COMException Exception;
- hr = SymDocumentWriter_SetCheckSum(m_DocumentWriter, algorithmId, source.Length, source);
- if (hr < 0) {
- Exception = new COMException("Call to SetCheckSum failed.", hr);
- throw Exception;
- }
- }
-
- public IntPtr InternalDocumentWriter {
- get { return m_DocumentWriter; }
- }
- }
-
-
-
-
- public class SymMethod : ISymbolMethod
- {
- private IntPtr m_Method;
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymMethod_Release(IntPtr Method);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymMethod_GetSequencePoints(IntPtr Method, int cPoint, out int pcPoints, [In()]
- IntPtr[] document, [In()]
- int[] offsets, [In()]
- int[] lines, [In()]
- int[] columns, [In()]
- int[] endLines, [In()]
- int[] endColumns);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymMethod_GetRootScope(IntPtr Method, out IntPtr pScope);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymMethod_GetScopeFromOffset(IntPtr Method, int offset, out IntPtr pScope);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymMethod_GetOffset(IntPtr Method, IntPtr Document, int line, int column, out int offset);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymMethod_GetToken(IntPtr Method, out int Token);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymMethod_GetSequencePointCount(IntPtr Method, out int Count);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymMethod_GetRanges(IntPtr Method, IntPtr Document, int line, int column, int cRanges, out int pcRanges, [In()]
- int[] Ranges);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymMethod_GetParameters(IntPtr Method, int cParams, out int pcParams, [In()]
- IntPtr[] parameters);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymMethod_GetNamespace(IntPtr Method, out IntPtr pNamespace);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymMethod_GetSourceStartEnd(IntPtr Method, [In()]
- IntPtr[] docs, [In()]
- int[] lines, [In()]
- int[] columns, out bool pRetVal);
-
-
-
-
- public SymMethod(IntPtr pMethod)
- {
- m_Method = pMethod;
- }
-
- ~SymMethod()
- {
- SymMethod_Release(m_Method);
- }
-
- public void GetSequencePoints(int[] offsets, ISymbolDocument[] documents, int[] lines, int[] columns, int[] endLines, int[] endColumns)
- {
- int hr;
- int spCount = 0;
- if (offsets != null)
- spCount = offsets.Length;
- else if (documents != null)
- spCount = documents.Length;
- else if (lines != null)
- spCount = lines.Length;
- else if (columns != null)
- spCount = columns.Length;
- else if (endLines != null)
- spCount = endLines.Length;
- else if (endColumns != null)
- spCount = endColumns.Length;
-
-
- if (spCount == 0)
- return;
-
-
- if ((offsets != null) && (spCount != offsets.Length))
- throw new ArgumentException();
-
- if ((lines != null) && (spCount != lines.Length))
- throw new ArgumentException();
-
- if ((columns != null) && (spCount != columns.Length))
- throw new ArgumentException();
-
- if ((endLines != null) && (spCount != endLines.Length))
- throw new ArgumentException();
-
- if ((endColumns != null) && (spCount != endColumns.Length))
- throw new ArgumentException();
-
- COMException Exception;
- IntPtr[] IDocuments = new IntPtr[documents.Length];
- int cPoints;
- uint i;
- hr = SymMethod_GetSequencePoints(m_Method, documents.Length, out cPoints, IDocuments, offsets, lines, columns, endLines, endColumns);
-
- if (hr < 0) {
- Exception = new COMException("Call to GetSequencePoints failed.", hr);
- throw Exception;
- }
-
-
- for (i = 0; i < documents.Length; i++) {
- documents[i] = new SymDocument(IDocuments[i]);
- }
-
- return;
- }
-
- public ISymbolScope RootScope {
- get {
- int hr;
- IntPtr pRootScope;
- COMException Exception;
- hr = SymMethod_GetRootScope(m_Method, out pRootScope);
- if (hr < 0) {
- Exception = new COMException("Call to GetRootScope failed.", hr);
- throw Exception;
- }
- return new SymScope(pRootScope);
- }
- }
-
- public ISymbolScope GetScope(int offset)
- {
- int hr;
- IntPtr pScope;
- COMException Exception;
- hr = SymMethod_GetScopeFromOffset(m_Method, offset, out pScope);
- if (hr < 0) {
- Exception = new COMException("Call to GetScopeFromOffset failed.", hr);
- throw Exception;
- }
- return new SymScope(pScope);
- }
-
- public int GetOffset(ISymbolDocument document, int line, int column)
- {
- int hr;
- int offset = 0;
- COMException Exception;
- hr = SymMethod_GetOffset(m_Method, ((SymDocument)document).InternalDocument, line, column, out offset);
- if (hr < 0) {
- Exception = new COMException("Call to GetOffset failed.", hr);
- throw Exception;
- }
-
- return offset;
- }
- public SymbolToken Token {
- get {
- int hr;
- int tokenId;
- COMException Exception;
- hr = SymMethod_GetToken(m_Method, out tokenId);
- if (hr < 0) {
- Exception = new COMException("Call to GetToken failed.", hr);
- throw Exception;
- }
-
- SymbolToken t = new SymbolToken(tokenId);
- return t;
- }
- }
-
- public int SequencePointCount {
- get {
- int hr;
- int Count;
- COMException Exception;
- hr = SymMethod_GetSequencePointCount(m_Method, out Count);
- if (hr < 0) {
- Exception = new COMException("Call to GetSequencePointCount failed.", hr);
- throw Exception;
- }
-
- return Count;
- }
- }
- public int[] GetRanges(ISymbolDocument document, int line, int column)
- {
- int hr;
- int cRanges;
- int[] Ranges;
- COMException Exception;
- hr = SymMethod_GetRanges(m_Method, ((SymDocument)document).InternalDocument, line, column, 0, out cRanges, null);
- if (hr < 0) {
- Exception = new COMException("Call to GetRanges failed.", hr);
- throw Exception;
- }
- Ranges = new int[cRanges];
- hr = SymMethod_GetRanges(m_Method, ((SymDocument)document).InternalDocument, line, column, cRanges, out cRanges, Ranges);
- if (hr < 0) {
- Exception = new COMException("Call to GetRanges failed.", hr);
- throw Exception;
- }
-
- return Ranges;
- }
-
- public ISymbolVariable[] GetParameters()
- {
- int hr;
- int cVariables;
- uint i;
- SymVariable[] Variables;
- IntPtr[] VariablePointers;
- COMException Exception;
- hr = SymMethod_GetParameters(m_Method, 0, out cVariables, null);
- if (hr < 0) {
- Exception = new COMException("Call to GetParameters failed.", hr);
- throw Exception;
- }
- VariablePointers = new IntPtr[cVariables];
- hr = SymMethod_GetParameters(m_Method, cVariables, out cVariables, VariablePointers);
- if (hr < 0) {
- Exception = new COMException("Call to GetParameters failed.", hr);
- throw Exception;
- }
-
- Variables = new SymVariable[cVariables];
-
- for (i = 0; i < cVariables; i++) {
- Variables[i] = new SymVariable(VariablePointers[i]);
- }
-
- return Variables;
- }
-
- public ISymbolNamespace GetNamespace()
- {
- int hr;
- IntPtr pNamespace;
- COMException Exception;
- hr = SymMethod_GetNamespace(m_Method, out pNamespace);
- if (hr < 0) {
- Exception = new COMException("Call to GetNamespace failed.", hr);
- throw Exception;
- }
- return new SymNamespace(pNamespace);
- }
-
- public bool GetSourceStartEnd(ISymbolDocument[] docs, int[] lines, int[] columns)
- {
- int hr;
- uint i;
- bool pRetVal;
- int spCount = 0;
- if (docs != null)
- spCount = docs.Length;
- else if (lines != null)
- spCount = lines.Length;
- else if (columns != null)
- spCount = columns.Length;
-
-
- if (spCount < 2)
- throw new ArgumentException();
-
-
- if ((docs != null) && (spCount != docs.Length))
- throw new ArgumentException();
-
- if ((lines != null) && (spCount != lines.Length))
- throw new ArgumentException();
-
- if ((columns != null) && (spCount != columns.Length))
- throw new ArgumentException();
-
- COMException Exception;
- IntPtr[] Documents = new IntPtr[docs.Length];
- hr = SymMethod_GetSourceStartEnd(m_Method, Documents, lines, columns, out pRetVal);
- if (hr < 0) {
- Exception = new COMException("Call to GetSourceStartEnd failed.", hr);
- throw Exception;
- }
- if (pRetVal) {
- for (i = 0; i < docs.Length; i++) {
- docs[i] = new SymDocument(Documents[i]);
- }
- }
- return pRetVal;
-
- }
- }
-
-
-
-
- public class SymReader : ISymbolReader
- {
-
- private IntPtr m_Reader;
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymReader_Release(IntPtr Reader);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymReader_GetUserEntryPoint(IntPtr Reader, out int EntryPoint);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymReader_GetDocuments(IntPtr Reader, int cDocs, out int pcDocs, [In()]
- IntPtr[] pDocs);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymReader_GetDocument(IntPtr Reader, [MarshalAs(UnmanagedType.LPWStr)]
- string Url, Guid Language, Guid LanguageVendor, Guid DocumentType, out IntPtr Document);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymReader_GetMethod(IntPtr Reader, int MethodToken, out IntPtr Document);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymReader_GetMethodByVersion(IntPtr Reader, int MethodToken, int Version, out IntPtr Document);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymReader_GetVariables(IntPtr Reader, int ParentToken, int cVars, out int pcVars, [In()]
- IntPtr[] Variables);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymReader_GetGlobalVariables(IntPtr Reader, int cVars, out int pcVars, [In()]
- IntPtr[] Variables);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymReader_GetMethodFromDocumentPosition(IntPtr Reader, IntPtr Document, int line, int column, out IntPtr MethodPointer);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymReader_GetSymAttribute(IntPtr Reader, int parentToken, [MarshalAs(UnmanagedType.LPWStr)]
- string name, int cBuffer, out int pcBuffer, byte[] buffer);
-
- [DllImport(CreateSymClass.NATIVE_DLL)]
- static extern int SymReader_GetNamespaces(IntPtr Reader, int cNamespaces, out int pcNamespaces, [In()]
- IntPtr[] NamespacePointers);
-
-
-
-
- public SymReader(IntPtr Reader)
- {
- m_Reader = Reader;
- }
-
- ~SymReader()
- {
- SymReader_Release(m_Reader);
- }
-
- public SymbolToken UserEntryPoint {
- get {
- COMException Exception;
- int hr;
- int EntryPoint;
- hr = SymReader_GetUserEntryPoint(m_Reader, out EntryPoint);
- if (hr < 0) {
- Exception = new COMException("Call to GetUserEntryPoint failed.", hr);
- throw Exception;
- }
-
- SymbolToken t = new SymbolToken(EntryPoint);
- return t;
- }
- }
-
- public ISymbolDocument[] GetDocuments()
- {
- COMException Exception;
- int hr;
- uint i;
- int cDocs;
- IntPtr[] DocumentPointers;
- SymDocument[] Documents;
- hr = SymReader_GetDocuments(m_Reader, 0, out cDocs, null);
- if (hr < 0) {
- Exception = new COMException("Call to GetDocuments failed.", hr);
- throw Exception;
- }
- DocumentPointers = new IntPtr[cDocs];
- Documents = new SymDocument[cDocs];
- hr = SymReader_GetDocuments(m_Reader, cDocs, out cDocs, DocumentPointers);
- if (hr < 0) {
- Exception = new COMException("Call to GetDocuments failed.", hr);
- throw Exception;
- }
-
- for (i = 0; i < cDocs; i++) {
- Documents[i] = new SymDocument(DocumentPointers[i]);
- }
-
- return Documents;
- }
-
- public ISymbolDocument GetDocument(string url, Guid language, Guid languageVendor, Guid documentType)
- {
- COMException Exception;
- int hr;
- IntPtr DocumentPointer;
- hr = SymReader_GetDocument(m_Reader, url, language, languageVendor, documentType, out DocumentPointer);
- if (hr < 0) {
- Exception = new COMException("Call to GetDocument failed.", hr);
- throw Exception;
- }
- return new SymDocument(DocumentPointer);
- }
-
- public ISymbolMethod GetMethod(SymbolToken method)
- {
- COMException Exception;
- int hr;
- IntPtr MethodPointer;
- hr = SymReader_GetMethod(m_Reader, method.GetToken(), out MethodPointer);
- if (hr < 0) {
- Exception = new COMException("Call to GetMethod failed.", hr);
- throw Exception;
- }
- return new SymMethod(MethodPointer);
- }
-
- public ISymbolMethod GetMethod(SymbolToken method, int version)
- {
- COMException Exception;
- int hr;
- IntPtr MethodPointer;
- hr = SymReader_GetMethodByVersion(m_Reader, method.GetToken(), version, out MethodPointer);
- if (hr < 0) {
- Exception = new COMException("Call to GetMethodByVersion failed.", hr);
- throw Exception;
- }
- return new SymMethod(MethodPointer);
- }
-
- public