Exemplo n.º 1
0
 private void cmb_Events_Sector_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmb_Events_Sector.SelectedIndex >= 0)
     {
         spinner_Events_Sector.Value = ISOHelper.GetSectorValue(((SectorPair)cmb_Events_Sector.SelectedItem).Sector);
     }
 }
Exemplo n.º 2
0
        public static void ReadFreeSpaceXML(string xmlFilename = _xmlFilename)
        {
            if (File.Exists(xmlFilename))
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(xmlFilename);

                XmlNode rootNode = xmlDoc.SelectSingleNode("//FreeSpace");

                foreach (FreeSpaceMode mode in freeSpaceModes)
                {
                    List <string>     newRangeNames = new List <string>();
                    List <PatchRange> newRanges     = new List <PatchRange>();

                    string  modeName   = Enum.GetName(typeof(FreeSpaceMode), mode);
                    XmlNode parentNode = rootNode[modeName];
                    if (parentNode != null)
                    {
                        foreach (XmlNode node in parentNode.ChildNodes)
                        {
                            XmlAttribute attrName        = node.Attributes["name"];
                            XmlAttribute attrSector      = node.Attributes["sector"];
                            XmlAttribute attrStartOffset = node.Attributes["startOffset"];
                            XmlAttribute attrEndOffset   = node.Attributes["endOffset"];

                            string name = attrName.InnerText;

                            int    sector     = 0;
                            string sectorText = attrSector.InnerText;

                            Type sectorType  = (mode == FreeSpaceMode.PSP) ? typeof(PspIso.Sectors) : typeof(PsxIso.Sectors);
                            Enum sectorValue = (Enum)Enum.Parse(sectorType, sectorText);
                            if (!int.TryParse(sectorText, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out sector))
                            {
                                sector = ISOHelper.GetSectorValue(sectorValue);
                            }

                            uint startOffset = uint.Parse(attrStartOffset.InnerText, System.Globalization.NumberStyles.HexNumber);
                            uint endOffset   = uint.Parse(attrEndOffset.InnerText, System.Globalization.NumberStyles.HexNumber);

                            newRangeNames.Add(name);
                            newRanges.Add(new PatchRange(sector, startOffset, endOffset));
                        }
                    }

                    RangeNames[(int)mode] = newRangeNames.ToArray();
                    Ranges[(int)mode]     = newRanges.ToArray();
                }
            }
        }
Exemplo n.º 3
0
 private void SetSectorDefault(Enum sector, NumericUpDown spinner, ComboBox comboBox)
 {
     spinner.Value = ISOHelper.GetSectorValue(sector);
     SetSectorComboBoxValue(sector, comboBox);
 }