public static Parse ( |
||
reader | The reader from which the problem shall be parsed. | |
strings | NameTable strings used to parse Android Studio files. | |
Результат |
/// <summary>Processes an Android Studio log and writes issues therein to an instance of /// <see cref="IResultLogWriter"/>.</summary> /// <param name="xmlReader">The XML reader from which AndroidStudio format shall be read.</param> /// <returns> /// A list of the <see cref="Result"/> objects translated from the AndroidStudio format. /// </returns> private IList <Result> ProcessAndroidStudioLog(XmlReader xmlReader) { // The SARIF spec actually allows for non-unique results to be persisted to the // results array. We currently enforce uniqueness in the Android converter. We could // consider loosening this moving forward. The current behavior is primarily // intended to minimize test breaks while SARIF v2 is finalized. var results = new HashSet <Result>(Result.ValueComparer); int problemsDepth = xmlReader.Depth; xmlReader.ReadStartElement(_strings.Problems); while (xmlReader.Depth > problemsDepth) { var problem = AndroidStudioProblem.Parse(xmlReader, _strings); if (problem != null) { results.Add(ConvertProblemToSarifResult(problem)); } } xmlReader.ReadEndElement(); // </problems> return(new List <Result>(results)); }
/// <summary>Processes an Android Studio log and writes issues therein to an instance of /// <see cref="IResultLogWriter"/>.</summary> /// <param name="xmlReader">The XML reader from which AndroidStudio format shall be read.</param> /// <param name="output">The <see cref="IResultLogWriter"/> to write the output to.</param> private void ProcessAndroidStudioLog(XmlReader xmlReader, IResultLogWriter output) { int problemsDepth = xmlReader.Depth; xmlReader.ReadStartElement(_strings.Problems); while (xmlReader.Depth > problemsDepth) { var problem = AndroidStudioProblem.Parse(xmlReader, _strings); if (problem != null) { output.WriteResult(AndroidStudioConverter.ConvertProblemToSarifIssue(problem)); } } xmlReader.ReadEndElement(); // </problems> }
/// <summary>Processes an Android Studio log and writes issues therein to an instance of /// <see cref="IResultLogWriter"/>.</summary> /// <param name="xmlReader">The XML reader from which AndroidStudio format shall be read.</param> /// <returns> /// A list of the <see cref="Result"/> objects translated from the AndroidStudio format. /// </returns> private ISet <Result> ProcessAndroidStudioLog(XmlReader xmlReader) { var results = new HashSet <Result>(Result.ValueComparer); int problemsDepth = xmlReader.Depth; xmlReader.ReadStartElement(_strings.Problems); while (xmlReader.Depth > problemsDepth) { var problem = AndroidStudioProblem.Parse(xmlReader, _strings); if (problem != null) { results.Add(ConvertProblemToSarifResult(problem)); } } xmlReader.ReadEndElement(); // </problems> return(results); }
private static AndroidStudioProblem Parse(XmlReader reader) { return(AndroidStudioProblem.Parse(reader, new AndroidStudioStrings(reader.NameTable))); }