Reads SRecord objects from an SRecord file.
Inheritance: IDisposable
Example #1
0
 public Verifier(Stream rs, SRecordReader sr, bool apply)
 {
     this.romStream = rs;
     this.patchReader = sr;
     this.apply = apply;
     this.dispose = false;
 }
Example #2
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);
        }
Example #3
0
 public Verifier(Stream rs, SRecordReader sr, bool apply)
 {
     this.romStream   = rs;
     this.patchReader = sr;
     this.apply       = apply;
     this.dispose     = false;
 }
Example #4
0
 public Verifier(string patchPath, string romPath, bool apply)
 {
     this.patchPath = patchPath;
     this.romPath = romPath;
     this.apply = apply;
     this.patchReader = new SRecordReader(patchPath);
     this.romStream = File.OpenRead(romPath);
     this.dispose = true;
 }
Example #5
0
 public Verifier(string patchPath, string romPath, bool apply)
 {
     this.patchPath   = patchPath;
     this.romPath     = romPath;
     this.apply       = apply;
     this.patchReader = new SRecordReader(patchPath);
     this.romStream   = File.OpenRead(romPath);
     this.dispose     = true;
 }
Example #6
0
        public void Dispose()
        {
            if (dispose)
            {
                if (this.patchReader != null)
                {
                    this.patchReader.Dispose();
                    this.patchReader = null;
                }

                if (this.romStream != null)
                {
                    this.romStream.Dispose();
                    this.romStream = null;
                }
            }
        }
Example #7
0
        public void Dispose()
        {
            if (dispose)
            {
                if (this.patchReader != null)
                {
                    this.patchReader.Dispose();
                    this.patchReader = null;
                }

                if (this.romStream != null)
                {
                    this.romStream.Dispose();
                    this.romStream = null;
                }
            }
        }
Example #8
0
 /// <summary>
 /// Constructor for external mods
 /// </summary>
 /// <param name="modPath"></param>
 public Mod(string modPath)
 {
     this.patchList = new List<Patch>();
     this.ModAuthor = "Unknown Author";
     this.ModBuild = "Unknown Build";
     //MemoryStream modMemStream = new MemoryStream();
     //using (FileStream fileStream = File.OpenRead(modPath))
     //{
     //    modMemStream.SetLength(fileStream.Length);
     //    fileStream.Read(modMemStream.GetBuffer(), 0, (int)fileStream.Length);
     //}
     FileInfo f = new FileInfo(modPath);
     FileSize = f.Length;
     FileName = f.Name;
     FilePath = modPath;
     isResource = false;
     reader = new SRecordReader(modPath);//modMemStream, modPath);
     TryReadPatches();
     TryReversePatches();
 }
Example #9
0
 /// <summary>
 /// Constructor for embedded mods
 /// </summary>
 /// <param name="s"></param>
 /// <param name="modPath"></param>
 public Mod(Stream s, string modPath)
 {
     this.patchList = new List<Patch>();
     this.ModAuthor = "Unknown Author";
     this.ModBuild = "Unknown Build";
     reader = new SRecordReader(s, modPath);
     FileName = modPath;
     isResource = true;
     modStream = s;
     TryReadPatches();
     TryReversePatches();
 }
Example #10
0
 /// <summary>
 /// Constructor for external mods
 /// </summary>
 /// <param name="modPath"></param>
 public Mod(string modPath)
 {
     isAuthd = false;
     this.patchList = new List<Patch>();
     this.ModAuthor = "Unknown Author";
     this.ModBuild = "Unknown Build";
     FileInfo f = new FileInfo(modPath);
     FileSize = f.Length;
     FileName = f.Name;
     FilePath = modPath;
     isResource = false;
     reader = new SRecordReader(modPath);
     TryReadPatches();
     TryReversePatches();
 }
Example #11
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;
        }