/// <summary> /// Dump the contents of an SRecord file. Mostly intended for development use. /// </summary> private static bool TryDumpSRecordFile(string path) { bool result = true; SRecord record; SRecordReader reader = new SRecordReader(path); reader.Open(); BlobList list = new BlobList(); while (reader.TryReadNextRecord(out record)) { if (!record.IsValid) { Trace.WriteLine(record.ToString()); result = false; continue; } list.ProcessRecord(record); Trace.WriteLine(record.ToString()); } Trace.WriteLine("Aggregated:"); foreach (Blob blob in list.Blobs) { Trace.WriteLine(blob.ToString()); } return(result); }
/// <summary> /// Try to read blobs from the patch file. /// </summary> private bool TryReadBlobs(out BlobList blist) { BlobList list = new BlobList(); this.reader.Open(); SRecord record; while (this.reader.TryReadNextRecord(out record)) { if (!record.IsValid) { Trace.WriteLine("The patch file contains garbage - was it corrupted somehow?"); Trace.WriteLine(String.Format("Line {0}: {1}", record.LineNumber, record.RawData)); blist = null; return false; } list.ProcessRecord(record); } blist = list; return true; }
/// <summary> /// Dump the contents of an SRecord file. Mostly intended for development use. /// </summary> private static bool TryDumpSRecordFile(string path) { bool result = true; SRecord record; SRecordReader reader = new SRecordReader(path); reader.Open(); BlobList list = new BlobList(); while (reader.TryReadNextRecord(out record)) { if (!record.IsValid) { Trace.WriteLine(record.ToString()); result = false; continue; } list.ProcessRecord(record); Trace.WriteLine(record.ToString()); } Trace.WriteLine("Aggregated:"); foreach (Blob blob in list.Blobs) { Trace.WriteLine(blob.ToString()); } return result; }