Пример #1
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);
        }
Пример #2
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;
     }
 }