ScoobyRom.Data.LoadRom C# (CSharp) Method

LoadRom() public method

public LoadRom ( string path ) : void
path string
return void
        public void LoadRom(string path)
        {
            romLoaded = false;
            rom = new Subaru.File.Rom (path);

            rom.FindMetadata ();

            string xmlPath = PathWithNewExtension (path, ".xml");
            bool xmlExists = System.IO.File.Exists (xmlPath);

            DataFile.RomXml romXml = null;
            if (xmlExists) {
                Console.WriteLine ("Loading existing XML file " + xmlPath);
                romXml = new DataFile.RomXml ();
                romXml.Load (xmlPath);
                romMetadata = romXml.RomMetadata;
                tableSearchRange = romXml.TableSearchRange;
            } else {
                Console.WriteLine ("No existing XML file has been found!");
                romXml = null;
                romMetadata = new DataFile.RomMetadata ();
                tableSearchRange = null;
            }

            romMetadata.Filesize = rom.Size;
            int calIDpos = romMetadata.CalibrationIDPos;

            calIDfromRom = calIDpos != 0 ? rom.ReadASCII (calIDpos, 8) : "Unknown";
            if (calIDfromRom != romMetadata.CalibrationID)
                Console.Error.WriteLine ("WARNING: Calibration ID mismatch");

            if (this.ProgressChanged != null)
                rom.ProgressChanged += OnProgressChanged;

            rom.FindMaps (tableSearchRange, out list2D, out list3D);

            rom.ProgressChanged -= OnProgressChanged;

            romLoaded = true;

            if (romXml != null) {
                romXml.RomStream = rom.Stream;
                romXml.TryMergeWith (list2D);
                romXml.TryMergeWith (list3D);
            }

            //PrintSharedStatistics ();
        }