예제 #1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            frmAction frmA = new frmAction();

            frmA.Show(this);
            frmA.CreateBinary(PCM1);
        }
예제 #2
0
        public bool LoadBasefile()
        {
            this.Text = "Modify BIN";
            string FileName = SelectFile();

            if (FileName.Length < 1)
            {
                return(false);
            }
            long fsize = new System.IO.FileInfo(FileName).Length;

            if (fsize != (512 * 1024) && fsize != (1024 * 1024))
            {
                MessageBox.Show("Unknown file", "Unknown file");
                return(false);
            }
            PCM1 = new PCMData();
            PCM1.Segments[1].Source = FileName;
            frmAction frmA = new frmAction();

            frmA.Show();
            if (!frmA.LoadOS(FileName, ref PCM1))
            {
                return(false);
            }
            labelBaseFile.Text = Path.GetFileName(FileName);
            labelBinInfo.Text  = PcmBufInfo(PCM1.Segments[1].Data, PCM1);
            return(true);
        }
예제 #3
0
        private void btnFixCheckSums_Click(object sender, EventArgs e)
        {
            frmAction frmA = new frmAction();

            frmA.FixSchekSums(ref PCM1.Segments[1].Data, ref PCM1);
            labelBinInfo.Text = PcmBufInfo(PCM1.Segments[1].Data, PCM1);
            labelMods.Text    = PCM1.GetModifications();
            frmA.ShowDialog(this);
        }
예제 #4
0
 private void btnApply_Click(object sender, EventArgs e)
 {
     if (this.Text == "Select segments to swap")
     {
         //Return back to "Modify BIN"
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else
     {
         for (int s = 2; s <= 9; s++)
         {
             if (PCM1.Segments[s].Source == "")
             {
                 MessageBox.Show("Please select all segments!", "Please select segments");
                 return;
             }
         }
         frmAction frmA = new frmAction();
         frmA.Show(this);
         frmA.CreateBinary(PCM1);
     }
 }
예제 #5
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (labelSelectOS.Text == "Select patches")
     {
         PCM1.PatchList.Clear();
         for (int i = 0; i < listView1.CheckedItems.Count; i++)
         {
             Patch P;
             P.Name        = listView1.CheckedItems[i].Text;
             P.Description = listView1.CheckedItems[i].SubItems[0].Text;
             P.FileName    = listView1.CheckedItems[i].Tag.ToString();
             PCM1.PatchList.Add(P);
         }
         this.DialogResult = DialogResult.OK;
     }
     else      //Select segment
     {
         string SrcFile = "";
         if (radioButton2.Checked)
         {
             if (listView1.SelectedItems.Count > 0)
             {
                 SrcFile = listView1.SelectedItems[0].Tag.ToString();
             }
         }
         else //radioButton3.Checked
         {
             SrcFile = txtCalFile.Text;
         }
         //PCM1.Segments[SegNr].Source = SrcFile;
         frmAction frmA = new frmAction();
         frmA.Show();
         if (SegNr > 1) //CAL segments
         {
             if (SegNr == 9)
             {
                 if (!frmA.LoadEepromData(SrcFile, ref PCM1))
                 {
                     return;
                 }
             }
             else
             {
                 if (!frmA.LoadCalSegment(SegNr, SrcFile, ref PCM1))
                 {
                     return;
                 }
             }
         }
         else //OS
         {
             if (!frmA.LoadOS(SrcFile, ref PCM1))
             {
                 return;
             }
         }
         if (btnCaller != null)
         {
             if (btnCaller.Text == "Build new BIN") //FrmMain
             {
                 this.DialogResult = DialogResult.OK;
                 this.Close();
             }
             else //From frmSegmentList
             {
                 btnCaller.Text = SegmentNames[SegNr] + ":  " + PCM1.Segments[SegNr].PN.ToString() + " " + PCM1.Segments[SegNr].Ver;
                 this.Close();
             }
         }
         this.DialogResult = DialogResult.OK;
     }
 }