• 大小: 2.07M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-05-01
  • 语言: C#
  • 标签: HEX  解析  文件  

资源简介

S19文件与HEX文件解析

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using readFlash;

namespace FlashCRCChecker
{
    public partial class Form1 : Form
    {
        _readFlash _Flash = new _readFlash();
        public Form1()
        {
            InitializeComponent();
            m_List_Main.FullRowSelect = true;
        }

        private void button1_Click(object sender EventArgs e)
        {
            m_Exit_FilePath.Text = string.Empty;
            m_List_Main.Items.Clear();
            //新建一个文件对话框
            OpenFileDialog pOpenFileDialog = new OpenFileDialog();
            pOpenFileDialog.RestoreDirectory = true;
            //设置对话框标题
            pOpenFileDialog.title = “打开刷写文件“;

            //设置打开文件类型
            pOpenFileDialog.Filter = “S19文件(*.s19)|*.s19|HEX文件(*.hex)|*.hex“;

            //监测文件是否存在
            pOpenFileDialog.CheckFileExists = true;

            //文件打开后执行以下程序
            if (pOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                m_Exit_FilePath.Text = pOpenFileDialog.FileName;
                //开始处理相应文件
                if (_Flash.CheckFileType(m_Exit_FilePath.Text) == 1)
                {
                    //Hex处理
                    if (!_Flash.readHEX(m_Exit_FilePath.Text))
                    {
                        MessageBox.Show(string.Format(“Line:{0:D} Error ChecksumFile Closed!“ _Flash.LastErrorLine + 1) “Error“ MessageBoxButtons.OK MessageBoxIcon.Error);
                        m_Exit_FilePath.Text = string.Empty;
                        return;
                    }
                    //crc
                    m_Edit_CRC32.Text = string.Format(“0x{0:X8}“ _Flash._ALLCRC32);
                    //在列表栏展示
                    for (int i = 0; i < _Flash._Block.Count; ++i)
                    {
                        ListViewItem _BufferItem;
                        _BufferItem = m_List_Main.Items.Add(string.Format(“Seg{0:D}“ i));
                        _BufferItem.SubItems.Add(string.Format(“0x{0:X8}“ _Flash._Block[i].BlockStartAddress));
                        _BufferItem.SubItems.Add(string.Format(“0x{0:X8}“ _Flash._Block[i].BlockStartAddress + _Flash._Block[i].BlockSize - 1));
                        _BufferItem.SubItems.Add(string.Format(“{0:D}“ _Flash._Block[i].BlockSize));
                        _BufferItem.SubItems.Add(string.Format(“0x{0:X8}“ _Flash._Block[i].BlockCRC));
                    }
                }
                else if (_Flash.CheckFileType(m_Exit_FilePath.Text) == 2)
                {
                    //S19处理
                    if (!_Flash.readS19(m_Exit_FilePath.Text))
                    {
                        MessageBox.Show(string.Format(“Line:{0:D} Error ChecksumFile Closed!“_Flash.LastErrorLine +

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-09-16 12:36  FlashCRCChecker\
     目录           0  2020-09-15 17:21  FlashCRCChecker\.vs\
     目录           0  2020-09-16 13:37  FlashCRCChecker\.vs\FlashCRCChecker\
     目录           0  2020-09-16 13:37  FlashCRCChecker\.vs\FlashCRCChecker\DesignTimeBuild\
     文件       46877  2020-09-24 17:23  FlashCRCChecker\.vs\FlashCRCChecker\DesignTimeBuild\.dtbcache.v2
     目录           0  2020-09-15 17:21  FlashCRCChecker\.vs\FlashCRCChecker\v16\
     文件       70656  2020-10-20 09:15  FlashCRCChecker\.vs\FlashCRCChecker\v16\.suo
     目录           0  2020-09-24 19:01  FlashCRCChecker\FlashCRCChecker\
     文件         189  2020-09-15 17:20  FlashCRCChecker\FlashCRCChecker\App.config
     文件        3833  2020-09-16 12:37  FlashCRCChecker\FlashCRCChecker\FlashCRCChecker.csproj
     文件       10291  2020-09-17 11:35  FlashCRCChecker\FlashCRCChecker\Form1.Designer.cs
     文件        4519  2020-09-24 19:01  FlashCRCChecker\FlashCRCChecker\Form1.cs
     文件      182318  2020-09-17 11:35  FlashCRCChecker\FlashCRCChecker\Form1.resx
     文件         527  2020-09-15 17:20  FlashCRCChecker\FlashCRCChecker\Program.cs
     目录           0  2020-09-15 17:20  FlashCRCChecker\FlashCRCChecker\Properties\
     文件        1322  2020-09-15 17:20  FlashCRCChecker\FlashCRCChecker\Properties\AssemblyInfo.cs
     文件        2843  2020-09-15 17:20  FlashCRCChecker\FlashCRCChecker\Properties\Resources.Designer.cs
     文件        5612  2020-09-15 17:20  FlashCRCChecker\FlashCRCChecker\Properties\Resources.resx
     文件        1102  2020-09-15 17:20  FlashCRCChecker\FlashCRCChecker\Properties\Settings.Designer.cs
     文件         249  2020-09-15 17:20  FlashCRCChecker\FlashCRCChecker\Properties\Settings.settings
     目录           0  2020-09-15 17:22  FlashCRCChecker\FlashCRCChecker\bin\
     目录           0  2020-09-16 16:29  FlashCRCChecker\FlashCRCChecker\bin\Debug\
     文件      131072  2020-09-24 18:56  FlashCRCChecker\FlashCRCChecker\bin\Debug\FlashCRCChecker.exe
     文件         189  2020-09-15 17:20  FlashCRCChecker\FlashCRCChecker\bin\Debug\FlashCRCChecker.exe.config
     文件       34304  2020-09-24 18:56  FlashCRCChecker\FlashCRCChecker\bin\Debug\FlashCRCChecker.pdb
     文件        9216  2020-09-24 18:56  FlashCRCChecker\FlashCRCChecker\bin\Debug\readFlash.dll
     文件       10808  2020-09-24 18:56  FlashCRCChecker\FlashCRCChecker\bin\Debug\readFlash.pdb
     目录           0  2020-10-20 09:16  FlashCRCChecker\FlashCRCChecker\bin\Release\
     文件      130560  2020-10-20 09:15  FlashCRCChecker\FlashCRCChecker\bin\Release\FlashCRCChecker.exe
     文件         189  2020-09-15 17:20  FlashCRCChecker\FlashCRCChecker\bin\Release\FlashCRCChecker.exe.config
     文件       34304  2020-10-20 09:15  FlashCRCChecker\FlashCRCChecker\bin\Release\FlashCRCChecker.pdb
............此处省略83个文件信息

评论

共有 条评论