예제 #1
0
        public bool GetSourceStartEnd(ISymbolDocument[] docs, int[] lines, int[] columns)
        {
            if (docs != null && docs.Length < 2)
            {
                throw new ArgumentException("Invalid array: length < 2: docs");
            }
            if (lines != null && lines.Length < 2)
            {
                throw new ArgumentException("Invalid array: length < 2: lines");
            }
            if (columns != null && columns.Length < 2)
            {
                throw new ArgumentException("Invalid array: length < 2: columns");
            }

            var  unDocs = docs == null ? null : new ISymUnmanagedDocument[docs.Length];
            bool result;

            method.GetSourceStartEnd(unDocs, lines, columns, out result);

            if (unDocs != null)
            {
                for (int i = 0; i < unDocs.Length; i++)
                {
                    docs[i] = unDocs[i] == null ? null : new SymbolDocument(unDocs[i]);
                }
            }

            return(result);
        }
        public bool GetSourceStartEnd(ISymbolDocument[] docs,
                                      int[] lines,
                                      int[] columns)
        {
            uint i;
            bool pRetVal = false;
            int  spCount = 0;

            if (docs != null)
            {
                spCount = docs.Length;
            }
            else if (lines != null)
            {
                spCount = lines.Length;
            }
            else if (columns != null)
            {
                spCount = columns.Length;
            }

            // If we don't have at least 2 entries then return an error
            if (spCount < 2)
            {
                throw new ArgumentException();
            }

            // Make sure all arrays are the same length.
            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();
            }

            var unmanagedDocuments = new ISymUnmanagedDocument[docs.Length];

            m_unmanagedMethod.GetSourceStartEnd(unmanagedDocuments, lines, columns, out pRetVal);
            if (pRetVal)
            {
                for (i = 0; i < docs.Length; i++)
                {
                    docs[i] = new SymbolDocument(unmanagedDocuments[i]);
                }
            }
            return(pRetVal);
        }
예제 #3
0
        public bool GetSourceStartEnd(ISymbolDocument[] docs, int[] lines, int[] columns)
        {
            var unmanagedDocs = new ISymUnmanagedDocument[docs.Length];

            for (int i = 0; i < docs.Length; i++)
            {
                docs[i] = new SymbolDocument(unmanagedDocs[i]);
            }

            bool value;

            HRESULT.ThrowOnFailure(_unmanaged.GetSourceStartEnd(unmanagedDocs, lines, columns, out value));

            return(value);
        }