private void btnOpen_Click(object sender, EventArgs e)
        {
            using (var openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Title  = "Выберите карту CTP 3.21";
                openFileDialog.Filter = "Map files|*.j5;*.j7|All files|*.*";
                if (openFileDialog.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                ctpMap.LoadFromFile(openFileDialog.FileName);

                openFileDialog.Title    = "Выберите файл прошивки";
                openFileDialog.Filter   = "buffer files|*.bir;*.bin|all files|*.*";
                openFileDialog.FileName = String.Empty;
                if (openFileDialog.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                var fileInfo = new FileInfo(openFileDialog.FileName);

                if (fileInfo.Length != 0x10000 && !MapDataHelper.UnpackCtpFirmware(fileInfo, true, this))
                {
                    return;
                }

                buffer = File.ReadAllBytes(openFileDialog.FileName);
            }

            ctpMapTree.LoadMap(ctpMap, true);
            FirmwareHelper.FillRpmRT(buffer, out rpmSampling, out rpmRt32, out rpmRt16);

            for (int i = 0; i < 256; i++)
            {
                quantGrid.Rows[0].Cells[i].Value = rpmSampling[i].ToString();
            }

            for (int i = 0; i < 32; i++)
            {
                quant32Grid.Rows[0].Cells[i].Value = rpmRt32[i].ToString();
            }

            for (int i = 0; i < 16; i++)
            {
                quant16Grid.Rows[0].Cells[i].Value = rpmRt16[i].ToString();
            }
        }
Beispiel #2
0
        private void Prepare()
        {
            SWDigest  = DataHelper.CalculateCRC(buffer, 0, 0xB0);
            IsFastRpm = DataHelper.IndexOf(buffer, new byte[] { 0x90, 0x61, 0x3C, 0xE5, 0x55 }) != -1;

            J7esFlags.Prepare(buffer);
            FillKGbc();
            if (J7esFlags.IsDadMode && !J7esFlags.IsCommonKGBCTable)
            {
                kgbc.Address = FirmwareHelper.KGbcJ7esDadAddr;
            }

            FirmwareHelper.FillRpmRT(buffer, out rpmSampling, out rpmRt32, out rpmRt16);
            FillThrRT();
            FillGbcRT();
            FillTWatRT();
            FillPressRT();

            FillPoints();

            FillGbc();
            FillKGbc();
            FillKGbcPress();
        }