コード例 #1
0
ファイル: Program.cs プロジェクト: LegacyNsfw/RomPatch
        /// <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)
                {
                    Console.WriteLine(record.ToString());
                    result = false;
                    continue;
                }

                list.ProcessRecord(record);

                Console.WriteLine(record.ToString());
            }

            Console.WriteLine("Aggregated:");
            foreach (Blob blob in list.Blobs)
            {
                Console.WriteLine(blob.ToString());
            }

            return(result);
        }
コード例 #2
0
ファイル: Patcher.cs プロジェクト: LegacyNsfw/RomPatch
        /// <summary>
        /// Try to read blobs from the patch file.
        /// </summary>
        private bool TryReadBlobs()
        {
            BlobList list = new BlobList();

            this.reader.Open();
            SRecord record;

            while (this.reader.TryReadNextRecord(out record))
            {
                if (!record.IsValid)
                {
                    Console.WriteLine("The patch file contains garbage - was it corrupted somehow?");
                    Console.WriteLine("Line {0}: {1}", record.LineNumber, record.RawData);
                    return(false);
                }

                list.ProcessRecord(record);
            }

            this.blobs = list.Blobs;

            return(true);
        }