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

资源简介

为了处理canoe录制的多通道asc消息,避免导入spy3等工具出现卡死等情况,故做这个程序简单删除了过滤不必要信息.同时也具备处理文本文件,只是保存时会自动变为asc格式,用户可自行修改后缀

资源截图

代码片段和文件信息

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

namespace CanMsgEdit
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();

            rbDelete.Checked = true;
            cbUseKey1.Checked = true;
        }



        private void btnOpenFile_Click(object sender EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = “*.asc|*.asc|*.*|*.*“;

            openFileDialog.RestoreDirectory = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                tbFilePath.Text = openFileDialog.FileName;
            }
        }


        private void btnNormalReplace_Click(object sender EventArgs e)
        {
            string file_path = tbFilePath.Text;

            if (file_path == ““)
            {
                MessageBox.Show(“没有打开文件“);
                return;
            }
            Thread thread = new Thread(new ThreadStart(NormalReplace));
            thread.Start();
         
        }

        private void NormalReplace()
        {
            string line_data = null;
            string file_path = tbFilePath.Text;

            if (file_path == ““)
            {
                MessageBox.Show(“没有打开文件“);
                return;
            }

            string old_str = tbOldString.Text;
            string new_str = tbNewString.Text;
            string new_line = ““;
            StreamReader file_read = new StreamReader(file_path System.Text.Encoding.Default);
            StreamWriter file_write = new StreamWriter(“trans.asc“);

            try
            {

                line_data = file_read.ReadLine();
                while (line_data != null)
                {
                    new_line = line_data.Replace(old_str new_str);

                    file_write.WriteLine(new_line);

                    line_data = file_read.ReadLine();
                }

                file_write.Close();
                file_read.Close();

                MessageBox.Show(“转换完成文件 trans.asc“);
            }
            catch
            {
                file_write.Close();
                file_read.Close();
                MessageBox.Show(“转换失败!“);
            }

            
        }

        private void btClear1_Click(object sender EventArgs e)
        {
            tbOldString.Text = ““;
            tbNewString.Text = ““;
        }

        private void btClear2_Click(object sender EventArgs e)
        {
            tbKeyString1.Text = ““;
            tbKeyString2.Text = ““;
            tbKeyString3.Text = ““;
            tbKeyString4.Text = ““;
        }

        private void btClear3_Cl

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-07-10 20:05  CanMsgEdit\
     目录           0  2020-07-10 20:05  CanMsgEdit\.vs\
     目录           0  2020-07-10 20:05  CanMsgEdit\.vs\CanMsgEdit\
     目录           0  2020-07-10 20:05  CanMsgEdit\.vs\CanMsgEdit\v14\
     文件       40960  2020-07-11 20:18  CanMsgEdit\.vs\CanMsgEdit\v14\.suo
     目录           0  2020-07-11 20:12  CanMsgEdit\CanMsgEdit\
     文件         189  2020-07-10 20:05  CanMsgEdit\CanMsgEdit\App.config
     文件        3933  2020-07-10 20:11  CanMsgEdit\CanMsgEdit\CanMsgEdit.csproj
     文件       22894  2020-07-11 20:10  CanMsgEdit\CanMsgEdit\MainForm.Designer.cs
     文件        9441  2020-07-11 20:12  CanMsgEdit\CanMsgEdit\MainForm.cs
     文件        5817  2020-07-11 20:10  CanMsgEdit\CanMsgEdit\MainForm.resx
     文件         525  2020-07-10 20:11  CanMsgEdit\CanMsgEdit\Program.cs
     目录           0  2020-07-10 20:05  CanMsgEdit\CanMsgEdit\Properties\
     文件        1346  2020-07-10 20:05  CanMsgEdit\CanMsgEdit\Properties\AssemblyInfo.cs
     文件        2833  2020-07-10 20:05  CanMsgEdit\CanMsgEdit\Properties\Resources.Designer.cs
     文件        5612  2020-07-10 20:05  CanMsgEdit\CanMsgEdit\Properties\Resources.resx
     文件        1097  2020-07-10 20:05  CanMsgEdit\CanMsgEdit\Properties\Settings.Designer.cs
     文件         249  2020-07-10 20:05  CanMsgEdit\CanMsgEdit\Properties\Settings.settings
     目录           0  2020-07-10 20:11  CanMsgEdit\CanMsgEdit\bin\
     目录           0  2020-07-11 20:17  CanMsgEdit\CanMsgEdit\bin\Debug\
     文件       17408  2020-07-11 20:12  CanMsgEdit\CanMsgEdit\bin\Debug\CanMsgEdit.exe
     文件         189  2020-07-10 20:05  CanMsgEdit\CanMsgEdit\bin\Debug\CanMsgEdit.exe.config
     文件       28160  2020-07-11 20:12  CanMsgEdit\CanMsgEdit\bin\Debug\CanMsgEdit.pdb
     文件       22696  2020-07-11 20:17  CanMsgEdit\CanMsgEdit\bin\Debug\CanMsgEdit.vshost.exe
     文件         189  2020-07-10 20:05  CanMsgEdit\CanMsgEdit\bin\Debug\CanMsgEdit.vshost.exe.config
     文件         490  2016-03-09 13:48  CanMsgEdit\CanMsgEdit\bin\Debug\CanMsgEdit.vshost.exe.manifest
     目录           0  2020-07-11 20:18  CanMsgEdit\CanMsgEdit\bin\Release\
     目录           0  2020-07-10 20:05  CanMsgEdit\CanMsgEdit\obj\
     目录           0  2020-07-11 20:11  CanMsgEdit\CanMsgEdit\obj\Debug\
     文件         180  2020-07-11 20:11  CanMsgEdit\CanMsgEdit\obj\Debug\CanMsgEdit.MainForm.resources
     文件         180  2020-07-10 20:30  CanMsgEdit\CanMsgEdit\obj\Debug\CanMsgEdit.Properties.Resources.resources
............此处省略12个文件信息

评论

共有 条评论

相关资源