public void WriteJsonResultFilePrefix(FileInfo file) { try { using (StreamWriter sw = file.AppendText()) { sw.Write("["); } } catch (IOException) { throw new DexterRuntimeException("Exception in method " + DexterUtil.GetCurrentMethodName()); } }
public void WriteXml2ResultFilePrefix(FileInfo file) { try { using (StreamWriter sw = file.AppendText()) { sw.WriteLine("<dexter-result created=\"" + DexterUtil.currentDateTime() + "\">"); } } catch (IOException) { throw new DexterRuntimeException("Exception in method " + DexterUtil.GetCurrentMethodName()); } }
public void WriteXmlResultFileBody(FileInfo xmlResultFile, List <Defect> allDefectList, string sourceFileFullPath) { int size = allDefectList.Count * 1024; StringBuilder m; if (size < Int32.MaxValue) { m = new StringBuilder(size); } else { m = new StringBuilder(Int32.MaxValue); } m.Append("\t<error filename=\"").Append(sourceFileFullPath).Append("\">\n"); foreach (Defect defect in allDefectList) { m.Append("\t\t<defect checker=\"").Append(defect.CheckerCode).Append("\">\n"); foreach (Occurence o in defect.Occurences) { m.Append("\t\t\t<occurence startLine=\"").Append(o.StartLine).Append("\" ") .Append("endLine=\"").Append(o.EndLine).Append("\" ") .Append(" message=\"").Append(o.Message.Replace("\"", """)).Append("\" />\n"); } m.Append("\t\t</defect>\n"); } m.Append("\t</error>\n"); try { using (StreamWriter sw = xmlResultFile.AppendText()) { sw.Write(m.ToString()); } } catch (IOException) { throw new DexterRuntimeException("Exception in method " + DexterUtil.GetCurrentMethodName()); } }