コード例 #1
0
        /// <summary>
        /// Updates Dict with the actual values inside XML file
        /// </summary>
        /// <param name="Dict"></param>
        /// <param name="LanguagePackFileName"></param>
        static void UpdateLanguageDictionary(Dictionary <string, string> Dict, string LanguagePackFileName)
        {
            if (!File.Exists(LanguagePackFileName))
            {
                return;
            }
            //Load default first
            foreach (XElement KazanNeftSoftware in XElement.Load(LanguagePackFileName).Elements("Native-Langue"))
            {
                foreach (XElement Menu in KazanNeftSoftware.Elements("Menu"))
                {
                    foreach (XElement Main in Menu.Elements("Main"))
                    {
                        foreach (XElement Entries in Main.Elements("Entries"))
                        {
                            foreach (XElement Item in Entries.Elements("Item"))
                            {
                                if (Item.Attribute("menuId") != null)
                                {
                                    Dict.AddOrUpdate($"Menu.Main.Entries.Item.menuId.{Item.Attribute("menuId").Value}", Item.Attribute("name").Value);
                                }
                                else if (Item.Attribute("idName") != null)
                                {
                                    Dict.AddOrUpdate($"Menu.Main.Entries.Item.idName.{Item.Attribute("idName").Value}", Item.Attribute("name").Value);
                                }
                            }
                        }
                    }

                    foreach (XElement TabBar in Menu.Elements("TabBar"))
                    {
                        foreach (XElement Item in TabBar.Elements("Item"))
                        {
                            Dict.AddOrUpdate($"Menu.TabBar.Item.{Item.Attribute("CMID").Value}", Item.Attribute("name").Value);
                        }
                    }
                }

                foreach (XElement InventoryDashboard in KazanNeftSoftware.Elements("InventoryDashboard"))
                {
                    foreach (XElement child in InventoryDashboard.Elements())
                    {
                        if (child.Attribute("value") != null)
                        {
                            Dict.AddOrUpdate($"InventoryDashboard.{child.Name}.{child.Attribute("name").Value}", child.Attribute("value").Value);
                        }
                        else
                        {
                            Dict.AddOrUpdate($"InventoryDashboard.{child.Name}", child.Attribute("name").Value);
                        }
                    }
                }

                foreach (XElement InventoryDashboard in KazanNeftSoftware.Elements("InventoryControl"))
                {
                    foreach (XElement child in InventoryDashboard.Elements())
                    {
                        if (child.Attribute("value") != null)
                        {
                            Dict.AddOrUpdate($"InventoryControl.{child.Name}.{child.Attribute("name").Value}", child.Attribute("value").Value);
                        }
                        else
                        {
                            Dict.AddOrUpdate($"InventoryControl.{child.Name}", child.Attribute("name").Value);
                        }
                    }
                }

                foreach (XElement MiscStrings in KazanNeftSoftware.Elements("MiscStrings"))
                {
                    foreach (XElement child in MiscStrings.Elements())
                    {
                        Dict.AddOrUpdate($"MiscStrings.{child.Name}", child.Attribute("value").Value);
                    }
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: cualquiercosa327/goombasav
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            object o = listBox1.SelectedItem;

            if (o is ExtractedROM)
            {
                ExtractedROM r = (ExtractedROM)o;
                lblSizeVal.Text       = r.Data.Length + " bytes";
                lblTypeVal.Text       = "ROM image";
                flpConfigdata.Visible = flpStateheader.Visible = false;
                lblChecksumVal.Text   = r.GetChecksum().ToString("X8");
                lblTitleVal.Text      = r.Name;
                btnExtract.Enabled    = true;
                btnReplace.Enabled    = false;
                btnDelete.Enabled     = false;
                return;
            }

            GameBoyAdvanceSRAMHeader h = (GameBoyAdvanceSRAMHeader)o;

            lblSizeVal.Text = h.Size + " bytes";
            lblTypeVal.Text = h.Type == GameBoyAdvanceSRAMHeader.STATESAVE ? "Savestate"
                                : h.Type == GameBoyAdvanceSRAMHeader.SRAMSAVE ? "SRAM"
                                : h.Type == GameBoyAdvanceSRAMHeader.CONFIGSAVE ? "Config"
                                : "Unknown";
            if (h is Stateheader)
            {
                Stateheader sh = (Stateheader)h;
                flpConfigdata.Visible    = false;
                flpStateheader.Visible   = true;
                lblUncompressedSize.Text =
                    sh.DataSize >= sh.Size
                                        ? "Uncompressed size:"
                                        : "Compressed size:";
                lblUncompressedSizeVal.Text = sh.DataSize + " bytes";
                lblFramecountVal.Text       = sh.Framecount.ToString();
                lblChecksumVal.Text         = sh.ROMChecksum.ToString("X8");

                btnExtract.Enabled = btnReplace.Enabled = sh.Type == GameBoyAdvanceSRAMHeader.SRAMSAVE || sh.Type == GameBoyAdvanceSRAMHeader.STATESAVE;
            }
            else if (h is Configdata)
            {
                flpStateheader.Visible = false;

                Configdata cd = (Configdata)h;
                if (h is GoombaConfigdata)
                {
                    flpConfigdata.Visible = true;
                    GoombaConfigdata gcd = (GoombaConfigdata)h;
                    lblBorderVal.Text  = gcd.BorderColor.ToString();
                    lblPaletteVal.Text = gcd.PaletteBank.ToString();
                    MiscStrings strs = gcd.GetMiscStrings;
                    lblSleepVal.Text     = strs.SleepStr;
                    lblAutostateVal.Text = strs.AutoloadStateStr;
                    lblGammaVal.Text     = strs.GammaStr;
                }
                else
                {
                    flpConfigdata.Visible = false;
                    lblBorderVal.Text     = "";
                    lblPaletteVal.Text    = "";
                    lblSleepVal.Text      = "";
                    lblAutostateVal.Text  = "";
                    lblGammaVal.Text      = "";
                }
                lblChecksumVal.Text = cd.ROMChecksum.ToString("X8");                 // The SRAM with this ROM checksum value is currently in 0xe000-0xffff

                btnExtract.Enabled = btnReplace.Enabled = false;
            }
            else
            {
                flpConfigdata.Visible = flpStateheader.Visible = false;
                btnExtract.Enabled    = btnReplace.Enabled = false;
            }
            lblTitleVal.Text = h.Title;
        }