using System; using System.Collections; 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 static Welling_Motor_Debug_Tool.mainForm; namespace Welling_Motor_Debug_Tool { public partial class Version : Form { //修改记录 string ChangeLog = "修改记录:\r\n" + "V" + mainForm.Version + "\r\n" + "1,增加力矩传感器手动标定实时检验,超范围时弹出提示;\r\n" + "2,增加拓展功能配置,支持读取和写入;\r\n" + "3,解决部分情况500ms定时器停止的问题;\r\n" + "4,增加故障日志地址读取、硬件版本HW写入、客户定制编号写入(用于Boot校验);\r\n" + "5,运行信息增加预留的显示内容和GearBox信息;\r\n" + "6,轮毂控制器测试增加新编码规则。\r\n"+ "\r\n" + "V2.4.0\r\n" + "1,生成配置参数时增加导出EXCEL和PDF功能;\r\n" + "2,剎把检测前判断电机是否停止,避免误判;\r\n" + "3,参数检验增加位置校准判断;\r\n" + "4,配置模式下进入Walk时自动调节转速到100%。\r\n" + "\r\n" + "V2.3.0\r\n" + "1,针对位置磁环增加校准功能,支持手动校准和量产模式自动校准;\r\n" + "2,启动时增加网络选择,勾选下次不启动时存储Server文件,下次启动从Server文件读取服务器配置,Config文件中去掉服务器配置;\r\n" + "3,导出文件时增加整车参数2和用户骑行参数,修改量产文件转换工具;\r\n" + "4,参数检验测试结束后,增加导出电机参数并记录的功能;\r\n" + "5,解决离线模式无法进入参数生成界面问题。\r\n" + "\r\n" + "V2.2.2\r\n" + "1,增加自动更新按钮,解决离线使用时打开慢的问题;\r\n" + "2,删除发送进入5S协议指令,新版本UART控制器不需要配置协议,考虑还原提高兼容性;\r\n" + "3,部分工序增加延时,解决通信异常问题;\r\n" + "4,量产测试和检验模式增加重发机制;\r\n" + "5,控制参数预留1低8位作为转把定速巡航开关,仪表用户参数增加转把定速巡航开关;\r\n" + "6, 增加指令窗口,可显示接收和发送的数据;\r\n" + "7,解决导入本地记录文件时,自定义字符串以\\0结尾高级参数界面异常问题,目前关闭自定义字符串指令。\r\n" + "\r\n" + "V2.2.1\r\n" + "1,优化修改配置模式时重复发送指令的问题;\r\n" + "2,解决刹车检测报错的问题;\r\n" + "3, 解决力矩传感器测试结果不显示问题。\r\n" + "\r\n" + "V2.2.0\r\n" + "1,优化新增协议内容;\r\n" + "2,增加协议类型选择,支持CAN和UART;\r\n" + "3,针对UART控制器在量产测试过程中增加5S协议设定和联动装置盒波特率设定,以正确接收UART控制器数据和Boot版本信息;\r\n" + "4,基础功能测试控制电机启动由修改运行模式改为Walk模式;\r\n" + "5,量产功能测试增加MOS内阻校准环节,支持可选;\r\n" + "6,增加流水号记录。\r\n" + "\r\n" + "V2.1.9\r\n" + "1,增加整车信息2、用户骑行参数界面,支持上位机读写;\r\n" + "2,增加车架ODO里程写入和读取;\r\n" + "3,增加产品标签写入,支持32位字符;\r\n" + "4,生成参数界面可选择HUB_FCT,支持仅导出到本地;\r\n" + "5,FCT治具测试账户登录后,测试路径自动改为HUB_FCT_Test;\r\n" + "6,增加删除指定配置文件和样机测试记录文件,支持文件夹递归删除。\r\n" + "\r\n" + "V2.1.8\r\n" + "1,限制FCT治具测试账户需要联网使用;\r\n" + "2,量产测试和检验模式下,双击配置文件可删除选中的配置文件。\r\n" + "\r\n" + "V2.1.7\r\n" + "1,解决系统显示缩放后,截图显示不完全的问题;\r\n" + "2,允许离线使用是关闭网络定时检测;\r\n" + "3,定时检测网络断开时不自动关闭,此时不允许使用,等待网络恢复;\r\n" + "4,启动登录密码错误时不自动关闭,重新进入登录;\r\n" + "5,部分提示框修改为自动关闭;\r\n" + "6,增加读取本机信息功能;\r\n" + "7,启动时自动上传登录日志,包含本机信息。\r\n" + "\r\n" + "V2.1.6\r\n" + "1,修改控制器内阻校准指令,增加写入存储标志;\r\n" + "2,参数生成界面增加导入样机测试记录的文件功能;\r\n" + "3,参数生成界面增加锁,防止误触。\r\n" ; //存储路径文件 LocalInfo localInfo = new LocalInfo(); //服务器配置 string IP, Port, User, PassWD; //FTP ftp myFtp = new ftp(); public Version() { InitializeComponent(); } private void Version_Load(object sender, EventArgs e) { //更新版本信息 label_Ver.Text = "版本: V" + mainForm.Version; label_BT.Text = "编译时间:" + System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location).ToString("yyyy-MM-dd HH:mm:ss"); //修改日志 richTextBox_Log.Text = ""; richTextBox_Log.AppendText(ChangeLog); //网络配置 IP = mainform1.ServerIP; Port = mainform1.ServerPort; User = mainform1.ServerUser; PassWD = mainform1.ServerPassWd; myFtp.FtpOption(IP, Port, User, PassWD, "admin", "ttium_admin"); } private void button_CheckVersion_Click(object sender, EventArgs e) { //离线时直接退出 if (mainform1.OfflineFlag == true) { MessageBoxTimeOut.Show("网络断开,检查失败", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //检查网络状态 if (myFtp.CheckFtp() == false) { MessageBoxTimeOut.Show("网络断开,检查失败", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { //检查本地文件删除 if (System.IO.File.Exists(localInfo.LocalPath + "\\Version")) System.IO.File.Delete(localInfo.LocalPath + "\\Version"); //读取最新版本号 myFtp.DownloadFile("/Tools/Welling_Motor_Debug_Tool/Version", localInfo.LocalPath); StreamReader objReader = new StreamReader(localInfo.LocalPath + "\\Version"); string sLine = ""; ArrayList arrText = new ArrayList();//创建一个动态数组 while (sLine != null) { sLine = objReader.ReadLine(); arrText.Add(sLine); } objReader.Close(); System.IO.File.Delete(localInfo.LocalPath + "\\Version"); //检查是否有最新版本 string[] VerOld = mainForm.Version.Trim().Split('.'); string[] VerNew = arrText[0].ToString().Trim().Split('.'); int VerOld_int = Convert.ToInt32(VerOld[0]) * 10000 + Convert.ToInt32(VerOld[1].PadLeft(2, '0')) * 100 + Convert.ToInt32(VerOld[2].PadLeft(2, '0')); int VerNew_int = Convert.ToInt32(VerNew[0]) * 10000 + Convert.ToInt32(VerNew[1].PadLeft(2, '0')) * 100 + Convert.ToInt32(VerNew[2].PadLeft(2, '0')); if (VerNew_int <= VerOld_int) { //版本已是最新,跳出 MessageBox.Show("版本已是最新", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //下载最新版本 string SavePath = Directory.GetCurrentDirectory(); string[] FileList = myFtp.GetFileNameList("/Tools/Welling_Motor_Debug_Tool"); foreach (string file in FileList) { if (file.Contains(".exe")) { myFtp.DownloadFile("/Tools/Welling_Motor_Debug_Tool/" + file, SavePath); MessageBox.Show("最新版本下载完成,请手动删除旧版本\r\n最新版本:" + file, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); System.Environment.Exit(0); } } } } } }