Merges the content of contiguous SRecords into a list of Blobs.
Пример #1
0
        /// <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);
        }
Пример #2
0
        /// <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;
        }
Пример #3
0
        /// <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;
        }