コード例 #1
0
        /// <summary>
        /// Instantiates a new BuildEventFileInfo object using an XML node (presumably from the project
        /// file).  The reason this isn't just another constructor on BuildEventFileInfo is because
        /// BuildEventFileInfo.cs gets compiled into multiple assemblies (Engine and Conversion, at least),
        /// and not all of those assemblies have the code for XmlUtilities.
        /// </summary>
        /// <param name="xmlNode"></param>
        /// <param name="defaultFile"></param>
        /// <returns></returns>
        /// <owner>RGoel</owner>
        internal static BuildEventFileInfo CreateBuildEventFileInfo(XmlNode xmlNode, string defaultFile)
        {
            ErrorUtilities.VerifyThrow(xmlNode != null, "Need Xml node.");

            // Get the file path out of the Xml node.
            int    line   = 0;
            int    column = 0;
            string file   = XmlUtilities.GetXmlNodeFile(xmlNode, String.Empty);

            if (file.Length == 0)
            {
                file = defaultFile;
            }
            else
            {
                // Compute the line number and column number of the XML node.
                XmlSearcher.GetLineColumnByNode(xmlNode, out line, out column);
            }

            return(new BuildEventFileInfo(file, line, column));
        }
コード例 #2
0
        /// <summary>
        /// Creates an instance of this exception using rich error information.
        /// </summary>
        /// <remarks>This constructor is preferred over the basic constructors.</remarks>
        /// <owner>RGoel, SumedhK</owner>
        /// <param name="xmlNode">The XML node where the error is (can be null).</param>
        /// <param name="message">Error message for exception.</param>
        /// <param name="errorSubcategory">Error sub-category that describes the error (can be null).</param>
        /// <param name="errorCode">The error code (can be null).</param>
        /// <param name="helpKeyword">The F1-help keyword for the host IDE (can be null).</param>
        public InvalidProjectFileException
        (
            XmlNode xmlNode,
            string message,
            string errorSubcategory,
            string errorCode,
            string helpKeyword
        ) :
            base(message)
        {
            ErrorUtilities.VerifyThrowArgumentLength(message, "message");

            if (xmlNode != null)
            {
                this.projectFile = XmlUtilities.GetXmlNodeFile(xmlNode, String.Empty /* no project file if XML is purely in-memory */);
                XmlSearcher.GetLineColumnByNode(xmlNode, out this.lineNumber, out this.columnNumber);
            }

            this.errorSubcategory = errorSubcategory;
            this.errorCode        = errorCode;
            this.helpKeyword      = helpKeyword;
        }
コード例 #3
0
ファイル: EngineCallback.cs プロジェクト: 3F/IeXod
        /// <summary>
        /// Figure out the line and column number of the task XML node in the original
        /// project context
        /// </summary>
        internal void GetLineColumnOfXmlNode(int handleId, out int lineNumber, out int columnNumber)
        {
            TaskExecutionContext executionContext = GetTaskContextFromHandleId(handleId);

            XmlSearcher.GetLineColumnByNode(executionContext.TaskNode, out lineNumber, out columnNumber);
        }