Beispiel #1
0
 /// <summary>
 /// This Method writes errors to visual studio
 /// </summary>
 /// <param name="message"></param>
 /// <param name="category"></param>
 /// <param name="filedetails"></param>
 /// <param name="hierarchyItem"></param>
 private static void AddTask(ErrorResultSet message, TaskErrorCategory category, string filedetails, IVsHierarchy hierarchyItem)
 {
     ErrorListProvider.Tasks.Add(new ErrorTask
     {
         Category      = TaskCategory.User,
         ErrorCategory = category,
         Text          = message.ErrorDescription + " (" + message.Referencelink + ")",
         HierarchyItem = hierarchyItem,
         Column        = string.IsNullOrEmpty(message.Column) ? 0 : Int32.Parse(message.Column, CultureInfo.InvariantCulture),
         Line          = string.IsNullOrEmpty(message.Line) ? 0 : Int32.Parse(message.Line, CultureInfo.InvariantCulture),
         Document      = filedetails
     });
 }
        /// <summary>
        /// Process the json result output from the tenon api
        /// </summary>
        /// <param name="dynObj"></param>
        /// <returns></returns>
        private static IList <ErrorResultSet> ProcessResults(dynamic dynObj)
        {
            var eCollectionResult = new List <ErrorResultSet>();

            foreach (var data1 in dynObj.resultSet)
            {
                var eCollection = new ErrorResultSet
                {
                    Certainty        = data1.certainty,
                    ErrorTitle       = (string)data1.errorTitle,
                    ErrorDescription = WebUtility.HtmlDecode((string)data1.errorDescription),
                    Column           = !string.IsNullOrEmpty(data1.position.ToString()) ? data1.position.column.ToString() : string.Empty,
                    Line             = !string.IsNullOrEmpty(data1.position.ToString()) ? data1.position.line.ToString() : string.Empty,
                    Referencelink    = data1.@ref
                };

                eCollectionResult.Add(eCollection);
            }

            TenonErrorMessage = string.Format(contents.TenonAPISuccess, dynObj.resultSummary.issues.totalErrors.ToString(), dynObj.resultSummary.issues.totalWarnings.ToString());

            return(eCollectionResult);
        }
Beispiel #3
0
 /// <summary>
 /// Add Warning helper method
 /// </summary>
 /// <param name="message"></param>
 /// <param name="fileName"></param>
 /// <param name="hierarchyItem"></param>
 public static void AddWarning(ErrorResultSet message, string fileName, IVsHierarchy hierarchyItem)
 {
     AddTask(message, TaskErrorCategory.Warning, fileName, hierarchyItem);
 }