예제 #1
0
        public ActionResult <Configdata> InsertConfig(Configdata configdata)
        {
            if (configdata == null)
            {
                return(BadRequest());
            }
            else
            {
                repository.InsertConfigdata(configdata);

                return(Ok(configdata));
            }
        }
예제 #2
0
        public ActionResult <Configdata> GetById(long id)
        {
            Configdata configdata = repository.GetConfigdataById(id);

            if (configdata == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(configdata));
            }
        }
예제 #3
0
 public IActionResult UpdateConfig([FromBody] Configdata configdata)
 {
     if (configdata == null)
     {
         return(BadRequest());
     }
     else if (repository.UpdateConfigdata(configdata))
     {
         return(Ok(configdata));
     }
     else
     {
         return(NotFound());
     }
 }
예제 #4
0
        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;
        }
 public bool UpdateConfigdata(Configdata configdata)
 {
     context.Configdatas.Update(configdata);
     return(SaveAndReturnTrue());
 }
 public bool InsertConfigdata(Configdata configdata)
 {
     context.Configdatas.Add(configdata);
     return(SaveAndReturnTrue());
 }