ScoobyRom.DataFile.RomXml.Load C# (CSharp) Method

Load() public method

public Load ( string path ) : void
path string
return void
        public void Load(string path)
        {
            XDocument doc = XDocument.Load (path, LoadOptions.SetLineInfo);
            xml2D = new List<Table2D> (40);
            xml3D = new List<Table3D> (50);
            ParseXml (doc.Root);
        }

Usage Example

Ejemplo n.º 1
0
        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 ();
        }
All Usage Examples Of ScoobyRom.DataFile.RomXml::Load