/// <summary> /// Check if a line of text contains a MSBuild message /// </summary> /// <param name="text">The text to search</param> /// <returns>A MSBuildMessage if one exists in the text. Otherwise, return null.</returns> public static MSBuildMessage FindMSBuildMessage(string text) { Match messageMatch = MSBuildMessage.MSBuildMessageRegex.Match(text); if (messageMatch.Success) { int messageNumber = String.IsNullOrEmpty(messageMatch.Groups["messageNumber"].Value) ? 0 : Convert.ToInt32(messageMatch.Groups["messageNumber"].Value); string messageText = messageMatch.Groups["messageText"].Value; MSBuildMessage.MessageTypeEnum messageType = Message.ConvertToMessageTypeEnum(messageMatch.Groups["messageType"].Value); return(new MSBuildMessage(messageNumber, messageText, messageType)); } else { return(null); } }
/// <summary> /// Check if a line of text contains a WiX message /// </summary> /// <param name="text">The text to search</param> /// <param name="tool">Specifies which tool the message is expected to come from</param> /// <returns>A WixMessage if one exists in the text. Otherwise, return null.</returns> public static WixMessage FindWixMessage(string text, WixTool.WixTools tool) { Match messageMatch = WixMessage.GetToolWixMessageRegex(tool).Match(text); if (messageMatch.Success) { int messageNumber = Convert.ToInt32(messageMatch.Groups["messageNumber"].Value); string messageText = messageMatch.Groups["messageText"].Value; Message.MessageTypeEnum messageType = Message.ConvertToMessageTypeEnum(messageMatch.Groups["messageType"].Value); return(new WixMessage(messageNumber, messageText, messageType)); } else { return(null); } }