public static Build Read(Stream stream, byte[] projectImportsArchive = null) { using (var binaryLogReader = new BinaryLogReader(stream)) { if (!binaryLogReader.formatIsValid) { throw new Exception("Invalid log file format"); } var build = (Build)binaryLogReader.ReadNode(); var buildStringCache = build.StringTable; foreach (var stringInstance in binaryLogReader.reader.StringTable) { buildStringCache.Intern(stringInstance); } if (build.SourceFilesArchive == null && projectImportsArchive != null) { build.SourceFilesArchive = projectImportsArchive; } return(build); } }
public static Build Read(string filePath) { using (var binaryLogReader = new BinaryLogReader(filePath)) { if (!binaryLogReader.formatIsValid) { throw new Exception("Invalid log file format"); } var build = (Build)binaryLogReader.ReadNode(); var buildStringCache = build.StringTable; foreach (var stringInstance in binaryLogReader.reader.StringTable) { buildStringCache.Intern(stringInstance); } var projectImportsZip = Path.ChangeExtension(filePath, ".ProjectImports.zip"); if (build.SourceFilesArchive == null && File.Exists(projectImportsZip)) { build.SourceFilesArchive = File.ReadAllBytes(projectImportsZip); } return(build); } }
public static Build Read(string filePath) { if (filePath.EndsWith(".xml", StringComparison.OrdinalIgnoreCase)) { return(XmlLogReader.ReadFromXml(filePath)); } else { return(BinaryLogReader.Read(filePath)); } }
public static Build Read(string filePath) { using (var binaryLogReader = new BinaryLogReader(filePath)) { var build = (Build)binaryLogReader.ReadNode(); var buildStringCache = build.StringTable; foreach (var stringInstance in binaryLogReader.reader.StringTable) { buildStringCache.Intern(stringInstance); } return(build); } }
public static Build Read(string filePath) { if (filePath.EndsWith(".xml", StringComparison.OrdinalIgnoreCase)) { return(XmlLogReader.ReadFromXml(filePath)); } else if (filePath.EndsWith(".binlog", StringComparison.OrdinalIgnoreCase)) { try { return(BinaryLog.ReadBuild(filePath)); } catch (Exception) { if (DetectLogFormat(filePath) == ".buildlog") { return(BinaryLogReader.Read(filePath)); } else { throw; } } } else if (filePath.EndsWith(".buildlog", StringComparison.OrdinalIgnoreCase)) { try { return(BinaryLogReader.Read(filePath)); } catch (Exception) { if (DetectLogFormat(filePath) == ".binlog") { return(BinaryLog.ReadBuild(filePath)); } else { throw; } } } return(null); }
public static Build ReadBuildLog(Stream stream, byte[] projectImportsArchive = null) => BinaryLogReader.Read(stream, projectImportsArchive);