ソースを参照

1、部分提示框修改为自动关闭;
2、增加读取计算机信息功能;
3、增加登录日志,上传服务器;
4、服务器原账号权限只读,上传和删除时采用admin账号。

Dail 1 年間 前
コミット
9ca56e39f2

BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 7 - 8
Welling_Motor_Debug_Tool/GenerateParams.cs

@@ -76,7 +76,7 @@ namespace Welling_Motor_Debug_Tool
 
             bool result = myFtp.UploadFile(localInfo.LocalPath + localInfo.NoteFileName, "/Note");
             if (result)
-                MessageBox.Show("上传完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                MessageBoxTimeOut.Show("上传完成", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Information);
             else
                 MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
@@ -319,7 +319,7 @@ namespace Welling_Motor_Debug_Tool
                 bool result1 = myFtp.UploadFile(Directory.GetCurrentDirectory() + "\\" + DataFileName, "ParamsMode");
                 if (result1 == true)
                 {
-                    MessageBox.Show("数据已上传!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    MessageBoxTimeOut.Show("数据已上传!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
@@ -653,7 +653,7 @@ namespace Welling_Motor_Debug_Tool
                         }
                     } while (false);
 
-                    MessageBox.Show("导入完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    MessageBoxTimeOut.Show("导入完成!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Information);
 
                 }
                 catch (Exception ex)
@@ -709,7 +709,7 @@ namespace Welling_Motor_Debug_Tool
                     User = array_CfgInfo[14].ToString().Split(':')[1];
                     PassWD = array_CfgInfo[15].ToString().Split(':')[1];
                     ModelPath = "ParamsMode";
-                    myFtp.FtpOption(IP, Port, User, PassWD);
+                    myFtp.FtpOption(IP, Port, User, PassWD, "admin", "ttium_admin");
                 }
                 catch (System.Exception)
                 {
@@ -732,7 +732,7 @@ namespace Welling_Motor_Debug_Tool
             }
             else
             {
-                label_Server_ComStatus.Text = "网络已连接:" + IP;
+                label_Server_ComStatus.Text = "网络已连接: " + IP;
                 label_ServerStatus.BackColor = Color.Green;
             }
 
@@ -749,7 +749,6 @@ namespace Welling_Motor_Debug_Tool
                 }
             }
 
-
         }
 
         private void button_ModeRefresh_Click(object sender, EventArgs e)
@@ -958,7 +957,7 @@ namespace Welling_Motor_Debug_Tool
                 bool result1 = myFtp.UploadFile(Directory.GetCurrentDirectory() + "\\" + DataFileName,  "ParamsMode");
                 if (result1 == true)
                 {
-                    MessageBox.Show("数据已上传!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    MessageBoxTimeOut.Show("数据已上传!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
@@ -1220,7 +1219,7 @@ namespace Welling_Motor_Debug_Tool
             bool result3 = myFtp.UploadFile(LocalPath + "\\" + fileName + ".png", ServerPath);
             if (result1 & result2 & result3)
             {
-                MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK);
+                MessageBoxTimeOut.Show("上传成功", "提示", 1000, MessageBoxButtons.OK);
             }
             else
             {

+ 2 - 0
Welling_Motor_Debug_Tool/LocalInfo.cs

@@ -10,6 +10,8 @@ namespace Welling_Motor_Debug_Tool
     {
         public string LocalPath = "C:\\Temp\\MotorTestTool\\"; //本地配置文件路径
         public string LocalDataPath = "C:\\Temp\\MotorTestTool\\DataLog\\"; //本地数据文件路径
+        public string LocalLogPath = "C:\\Temp\\MotorTestTool\\Log\\"; //本地日志文件路径
+        public string PC_InfoFileName = "PC_Info.txt";//计算机信息
         public string ConfigFileName = "Config1.ttcfg"; //配置文件
         public string NoteFileName = "Note.txt";
         public string ToolsPath = "C:\\Temp\\MotorTestTool\\Tools";//工具路径

+ 135 - 0
Welling_Motor_Debug_Tool/MessageBoxTimeOut.cs

@@ -0,0 +1,135 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Runtime.InteropServices;
+
+namespace Welling_Motor_Debug_Tool
+{
+    internal class MessageBoxTimeOut
+    {
+        /// <summary>
+        /// 标题
+        /// </summary>
+        private static string _caption;
+
+        /// <summary>
+        /// 显示消息框
+        /// </summary>
+        /// <param name="text">消息内容</param>
+        /// <param name="caption">标题</param>
+        /// <param name="timeout">超时时间,单位:毫秒</param>
+        public static void Show(string text, string caption, int timeout)
+        {
+            _caption = caption;
+            StartTimer(timeout);
+            MessageBox.Show(text, caption);
+        }
+        /// <summary>
+        /// 显示消息框
+        /// </summary>
+        /// <param name="text">消息内容</param>
+        /// <param name="caption">标题</param>
+        /// <param name="timeout">超时时间,单位:毫秒</param>
+        /// <param name="buttons">消息框上的按钮</param>
+        public static void Show(string text, string caption, int timeout, MessageBoxButtons buttons)
+        {
+            _caption = caption;
+            StartTimer(timeout);
+            MessageBox.Show(text, caption, buttons);
+        }
+        /// <summary>
+        /// 显示消息框
+        /// </summary>
+        /// <param name="text">消息内容</param>
+        /// <param name="caption">标题</param>
+        /// <param name="timeout">超时时间,单位:毫秒</param>
+        /// <param name="buttons">消息框上的按钮</param>
+        /// <param name="icon">消息框上的图标</param>
+        public static void Show(string text, string caption, int timeout, MessageBoxButtons buttons, MessageBoxIcon icon)
+        {
+            _caption = caption;
+            StartTimer(timeout);
+            MessageBox.Show(text, caption, buttons, icon);
+        }
+        /// <summary>
+        /// 显示消息框
+        /// </summary>
+        /// <param name="owner">消息框所有者</param>
+        /// <param name="text">消息内容</param>
+        /// <param name="caption">标题</param>
+        /// <param name="timeout">超时时间,单位:毫秒</param>
+        public static void Show(IWin32Window owner, string text, string caption, int timeout)
+        {
+            _caption = caption;
+            StartTimer(timeout);
+            MessageBox.Show(owner, text, caption);
+        }
+        /// <summary>
+        /// 显示消息框
+        /// </summary>
+        /// <param name="owner">消息框所有者</param>
+        /// <param name="text">消息内容</param>
+        /// <param name="caption">标题</param>
+        /// <param name="timeout">超时时间,单位:毫秒</param>
+        /// <param name="buttons">消息框上的按钮</param>
+        public static void Show(IWin32Window owner, string text, string caption, int timeout, MessageBoxButtons buttons)
+        {
+            _caption = caption;
+            StartTimer(timeout);
+            MessageBox.Show(owner, text, caption, buttons);
+        }
+        /// <summary>
+        /// 显示消息框
+        /// </summary>
+        /// <param name="owner">消息框所有者</param>
+        /// <param name="text">消息内容</param>
+        /// <param name="caption">标题</param>
+        /// <param name="timeout">超时时间,单位:毫秒</param>
+        /// <param name="buttons">消息框上的按钮</param>
+        /// <param name="icon">消息框上的图标</param>
+        public static void Show(IWin32Window owner, string text, string caption, int timeout, MessageBoxButtons buttons, MessageBoxIcon icon)
+        {
+            _caption = caption;
+            StartTimer(timeout);
+            MessageBox.Show(owner, text, caption, buttons, icon);
+        }
+
+        private static void StartTimer(int interval)
+        {
+            Timer timer = new Timer();
+            timer.Interval = interval;
+            timer.Tick += new EventHandler(Timer_Tick);
+            timer.Enabled = true;
+        }
+
+        private static void Timer_Tick(object sender, EventArgs e)
+        {
+            KillMessageBox();
+            //停止计时器
+            ((Timer)sender).Enabled = false;
+        }
+
+        [DllImport("user32.dll", EntryPoint = "FindWindow", CharSet = CharSet.Auto)]
+        private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
+
+        [DllImport("user32.dll", CharSet = CharSet.Auto)]
+        private extern static int PostMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
+
+        private const int WM_CLOSE = 0x10;
+
+        private static void KillMessageBox()
+        {
+            //查找MessageBox的弹出窗口,注意对应标题
+            IntPtr ptr = FindWindow(null, _caption);
+            if (ptr != IntPtr.Zero)
+            {
+                //查找到窗口则关闭
+                PostMessage(ptr, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
+            }
+        }
+
+    }
+}

+ 211 - 0
Welling_Motor_Debug_Tool/PC_Information.cs

@@ -0,0 +1,211 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Management;
+
+namespace Welling_Motor_Debug_Tool
+{
+    internal class PC_Information
+    {
+        //获取设备ID
+        public static string GetSystemID()
+        {
+            string systemId = null;
+            using (ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_ComputerSystemProduct"))
+            {
+                foreach (var item in mos.Get())
+                {
+                    systemId = item["UUID"].ToString();
+                }
+            }
+            return systemId;
+        }
+
+        // 获取CPU序列号
+        public static string GetCPUSerialNumber()
+        {
+            string CPU_NO = "";//cpu序列号
+            ManagementClass managementClass = new ManagementClass("Win32_Processor");
+            ManagementObjectCollection moc = managementClass.GetInstances();
+            foreach (ManagementObject mo in moc)
+            {
+                CPU_NO = mo.Properties["ProcessorId"].Value.ToString();
+            }
+            return CPU_NO;
+        }
+
+        //主板型号
+        public static string GetBoardType()
+        {
+            string str = "";
+            ManagementObjectSearcher mos = new ManagementObjectSearcher("Select * from Win32_BaseBoard");
+            foreach (var o in mos.Get())
+            {
+                ManagementObject mo = (ManagementObject)o;
+                str = mo["Product"].ToString();
+            }
+            return str;
+        }
+
+
+        //主板制造商
+        public static string GetBoardManufacturer()
+        {
+            SelectQuery query = new SelectQuery("Select * from Win32_BaseBoard");
+            ManagementObjectSearcher mos = new ManagementObjectSearcher(query);
+            ManagementObjectCollection.ManagementObjectEnumerator data = mos.Get().GetEnumerator();
+            data.MoveNext();
+            ManagementBaseObject board = data.Current;
+
+            string baseBoradMaker = board.GetPropertyValue("Manufacturer").ToString();
+            return baseBoradMaker;
+        }
+
+
+        // 获取主板序列号
+        public static string GetBIOSSerialNumber()
+        {
+            string str = "";
+            ManagementObjectSearcher mos = new ManagementObjectSearcher("Select * from Win32_BaseBoard");
+            foreach (var o in mos.Get())
+            {
+                ManagementObject mo = (ManagementObject)o;
+                str = mo["SerialNumber"].ToString();
+            }
+            return str;
+        }
+
+        // 获取硬盘序列号
+        public static string GetHardDiskSerialNumber()
+        {
+            try
+            {
+                ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
+                string hardDiskSerialNumber = "";
+                foreach (ManagementObject mo in searcher.Get())
+                {
+                    hardDiskSerialNumber = mo["SerialNumber"].ToString().Trim();
+                    break;
+                }
+                return hardDiskSerialNumber;
+            }
+            catch
+            {
+                return "None";
+            }
+        }
+
+        // 获取网卡地址
+        public static string GetNetCardMACAddress()
+        {
+            var mac = "";
+            var mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
+            var moc = mc.GetInstances();
+            foreach (var o in moc)
+            {
+                var mo = (ManagementObject)o;
+                if (!(bool)mo["IPEnabled"]) continue;
+                mac = mo["MacAddress"].ToString();
+                break;
+            }
+            return mac;
+        }
+
+        //获取CPU型号
+        public static string GetCpuName()
+        {
+            var CPUName = "";
+            var management = new ManagementObjectSearcher("Select * from Win32_Processor");
+            foreach (var baseObject in management.Get())
+            {
+                var managementObject = (ManagementObject)baseObject;
+                CPUName = managementObject["Name"].ToString();
+            }
+            return CPUName;
+        }
+
+        //获取CPU制造厂商
+        public static string GetCpuManufacturer()
+        {
+            var CPUMakerStr = "";
+            var management = new ManagementObjectSearcher("Select * from Win32_Processor");
+            foreach (var baseObject in management.Get())
+            {
+                var managementObject = (ManagementObject)baseObject;
+                CPUMakerStr = managementObject["Manufacturer"].ToString();
+            }
+            return CPUMakerStr;
+        }
+
+        //获取IP地址
+        public static string GetIpAddress()
+        {
+            var IPv4Str = "";
+            var management = new ManagementClass("Win32_NetworkAdapterConfiguration");
+            var managementObject = management.GetInstances();
+            foreach (ManagementBaseObject managementBaseObject in managementObject)
+            {
+                var management1 = (ManagementObject)managementBaseObject;
+                if (!(bool)management1["IPEnabled"]) continue;
+                Array array = (Array)(management1.Properties["IpAddress"].Value);
+                IPv4Str = array.GetValue(0).ToString();
+                break;
+            }
+            return IPv4Str;
+        }
+
+        //操作系统
+        public static string GetSystemType()
+        {
+            var sysTypeStr = "";
+            ManagementClass mc = new ManagementClass("Win32_ComputerSystem");
+            ManagementObjectCollection moc = mc.GetInstances();
+            foreach (ManagementBaseObject o in moc)
+            {
+                ManagementObject mo = (ManagementObject)o;
+                sysTypeStr = mo["SystemType"].ToString();
+            }
+            return sysTypeStr;
+        }
+
+        //内存
+        public static float GetPhysicalMemory()
+        {
+            float memoryCount = 0;
+            var mc = new ManagementClass("Win32_ComputerSystem");
+            var moc = mc.GetInstances();
+            foreach (var o in moc)
+            {
+                var mo = (ManagementObject)o;
+                string str = mo["TotalPhysicalMemory"].ToString();//单位为 B
+                float a = long.Parse(str);
+                memoryCount = a / 1024 / 1024 / 1024;//单位换成GB
+            }
+            return memoryCount;
+        }
+
+        // 获取每一个硬盘的容量,单位GB
+        public static string GetDiskCapacity()
+        {
+            try
+            {
+                ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM win32_DiskDrive");
+                string HardDriveCapacity = "";
+                foreach (ManagementObject mo in searcher.Get())
+                {
+                    long size_B = long.Parse(mo["Size"].ToString());//
+                    float sizeGB = size_B / 1000 / 1000 / 1000;
+                    HardDriveCapacity = sizeGB.ToString() + "\n" + HardDriveCapacity;
+                }
+                return HardDriveCapacity;
+            }
+            catch
+            {
+                return "Failed to get the capacity of each disk.";
+            }
+        }
+
+    }
+}

+ 5 - 5
Welling_Motor_Debug_Tool/Version.Designer.cs

@@ -45,7 +45,7 @@
             this.label_Ver.AutoSize = true;
             this.label_Ver.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label_Ver.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
-            this.label_Ver.Location = new System.Drawing.Point(14, 58);
+            this.label_Ver.Location = new System.Drawing.Point(12, 58);
             this.label_Ver.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
             this.label_Ver.Name = "label_Ver";
             this.label_Ver.Size = new System.Drawing.Size(60, 20);
@@ -57,7 +57,7 @@
             this.label_BT.AutoSize = true;
             this.label_BT.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label_BT.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
-            this.label_BT.Location = new System.Drawing.Point(140, 58);
+            this.label_BT.Location = new System.Drawing.Point(150, 58);
             this.label_BT.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
             this.label_BT.Name = "label_BT";
             this.label_BT.Size = new System.Drawing.Size(213, 20);
@@ -68,7 +68,7 @@
             // 
             this.pictureBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
             this.pictureBox2.Image = global::Welling_Motor_Debug_Tool.Properties.Resources.about;
-            this.pictureBox2.Location = new System.Drawing.Point(19, 18);
+            this.pictureBox2.Location = new System.Drawing.Point(16, 18);
             this.pictureBox2.Name = "pictureBox2";
             this.pictureBox2.Size = new System.Drawing.Size(167, 23);
             this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -79,7 +79,7 @@
             // 
             this.button_CheckVersion.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(113)))), ((int)(((byte)(185)))));
             this.button_CheckVersion.ForeColor = System.Drawing.Color.White;
-            this.button_CheckVersion.Location = new System.Drawing.Point(378, 284);
+            this.button_CheckVersion.Location = new System.Drawing.Point(378, 18);
             this.button_CheckVersion.Name = "button_CheckVersion";
             this.button_CheckVersion.Size = new System.Drawing.Size(94, 40);
             this.button_CheckVersion.TabIndex = 19;
@@ -95,7 +95,7 @@
             this.richTextBox_Log.Location = new System.Drawing.Point(14, 81);
             this.richTextBox_Log.Name = "richTextBox_Log";
             this.richTextBox_Log.ReadOnly = true;
-            this.richTextBox_Log.Size = new System.Drawing.Size(352, 243);
+            this.richTextBox_Log.Size = new System.Drawing.Size(458, 243);
             this.richTextBox_Log.TabIndex = 20;
             this.richTextBox_Log.Text = "";
             // 

+ 12 - 5
Welling_Motor_Debug_Tool/Version.cs

@@ -15,11 +15,18 @@ namespace Welling_Motor_Debug_Tool
     public partial class Version : Form
     {
         //修改记录
-        string ChangeLog = "修改记录:\r\n" +
-            "V2.1.6\r\n" +
+        string ChangeLog = "修改记录:\r\n" + "V2.1.6\r\n" +
             "1,修改控制器内阻校准指令,增加写入存储标志;\r\n" +
-            "2,参数生成界面增加导入样机测试记录你文件功能;\r\n" +
-            "3,参数生成界面增加锁,防止误触。\r\n"
+            "2,参数生成界面增加导入样机测试记录的文件功能;\r\n" +
+            "3,参数生成界面增加锁,防止误触。\r\n\r\n" +
+            mainForm.Version + "\r\n" +
+            "1,解决系统显示缩放后,截图显示不完全的问题;\r\n" +
+            "2,允许离线使用是关闭网络定时检测;\r\n" +
+            "3,定时检测网络断开时不自动关闭,此时不允许使用,等待网络恢复;\r\n" +
+            "4,启动登录密码错误时不自动关闭,重新进入登录;\r\n" +
+            "5,部分提示框修改为自动关闭;\r\n" +
+            "6,增加读取本机信息功能;\r\n" +
+            "7,启动时自动上传登录日志,包含本机信息。\r\n"
             ;
 
         //存储路径文件
@@ -65,7 +72,7 @@ namespace Welling_Motor_Debug_Tool
                     Port = array_CfgInfo[13].ToString().Split(':')[1];
                     User = array_CfgInfo[14].ToString().Split(':')[1];
                     PassWD = array_CfgInfo[15].ToString().Split(':')[1];
-                    myFtp.FtpOption(IP, Port, User, PassWD);
+                    myFtp.FtpOption(IP, Port, User, PassWD, "admin", "ttium_admin");
                 }
                 catch (System.Exception)
                 {

+ 3 - 0
Welling_Motor_Debug_Tool/Welling_Motor_Debug_Tool.csproj

@@ -53,6 +53,7 @@
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Management" />
     <Reference Include="System.Windows.Forms.DataVisualization" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
@@ -72,6 +73,8 @@
       <DependentUpon>GenerateParams.cs</DependentUpon>
     </Compile>
     <Compile Include="Info.cs" />
+    <Compile Include="MessageBoxTimeOut.cs" />
+    <Compile Include="PC_Information.cs" />
     <Compile Include="TorqueParams.cs">
       <SubType>Form</SubType>
     </Compile>

BIN
Welling_Motor_Debug_Tool/bin/Debug/Welling_Motor_Debug_Tool_V2.1.7.exe


+ 10 - 8
Welling_Motor_Debug_Tool/ftp.cs

@@ -11,8 +11,8 @@ namespace Welling_Motor_Debug_Tool
     {
         string serverIP;
         string serverPort;
-        string userId;
-        string passWord;
+        string userId, userId_Admin;
+        string passWord, passWord_Admin;
         public bool IsNetConnected = false;
 
         /// <summary>
@@ -22,12 +22,14 @@ namespace Welling_Motor_Debug_Tool
         /// <param name="serverPort"></param>
         /// <param name="userId"></param>
         /// <param name="passWord"></param>
-        public void FtpOption(string serverIP, string serverPort, string userId, string passWord)
+        public void FtpOption(string serverIP, string serverPort, string userId, string passWord, string userID_Admin, string passWord_Admin)
         {
             this.serverIP = serverIP;
             this.serverPort = serverPort;
             this.userId = userId;
             this.passWord = passWord;
+            this.userId_Admin = userID_Admin;
+            this.passWord_Admin = passWord_Admin;
         }
 
         /// <summary>
@@ -77,7 +79,7 @@ namespace Welling_Motor_Debug_Tool
 
             Uri uri = new Uri("ftp://" + serverIP + ":" + serverPort + "/" + targetPath + "/" + Uri.EscapeDataString(fileName));
             reqFTP = (FtpWebRequest)FtpWebRequest.Create(uri);
-            reqFTP.Credentials = new NetworkCredential(userId, passWord);
+            reqFTP.Credentials = new NetworkCredential(userId_Admin, passWord_Admin);
             reqFTP.KeepAlive = false;
             reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
             reqFTP.UseBinary = true;
@@ -169,7 +171,7 @@ namespace Welling_Motor_Debug_Tool
                 FtpWebRequest reqFTP;
                 reqFTP = (FtpWebRequest)FtpWebRequest.Create(uri);
 
-                reqFTP.Credentials = new NetworkCredential(userId, passWord);
+                reqFTP.Credentials = new NetworkCredential(userId_Admin, passWord_Admin);
                 reqFTP.KeepAlive = false;
                 reqFTP.Method = WebRequestMethods.Ftp.DeleteFile;
                 reqFTP.UsePassive = false;
@@ -202,7 +204,7 @@ namespace Welling_Motor_Debug_Tool
                 FtpWebRequest reqFTP;
                 reqFTP = (FtpWebRequest)FtpWebRequest.Create(uri);
 
-                reqFTP.Credentials = new NetworkCredential(userId, passWord);
+                reqFTP.Credentials = new NetworkCredential(userId_Admin, passWord_Admin);
                 reqFTP.KeepAlive = false;
                 reqFTP.Method = WebRequestMethods.Ftp.RemoveDirectory;
                 reqFTP.UsePassive = false;
@@ -386,7 +388,7 @@ namespace Welling_Motor_Debug_Tool
                 reqFTP.Method = WebRequestMethods.Ftp.MakeDirectory;
                 reqFTP.UseBinary = true;
                 reqFTP.UsePassive = true;
-                reqFTP.Credentials = new NetworkCredential(userId,passWord);
+                reqFTP.Credentials = new NetworkCredential(userId_Admin, passWord_Admin);
                 FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
                 Stream ftpStream = response.GetResponseStream();
                 ftpStream.Close();
@@ -414,7 +416,7 @@ namespace Welling_Motor_Debug_Tool
                 reqFTP.RenameTo = newFilename;
                 reqFTP.UseBinary = true;
                 reqFTP.UsePassive = false;
-                reqFTP.Credentials = new NetworkCredential(userId,passWord);
+                reqFTP.Credentials = new NetworkCredential(userId_Admin, passWord_Admin);
                 FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
                 Stream ftpStream = response.GetResponseStream();
 

+ 50 - 40
Welling_Motor_Debug_Tool/mainForm.Designer.cs

@@ -96,6 +96,8 @@ namespace Welling_Motor_Debug_Tool
             this.电机温度ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripTextBox_ThT_Motor = new System.Windows.Forms.ToolStripTextBox();
             this.力矩传感器检验ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.uART协议ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.协议类型ToolStripMenuItem = new System.Windows.Forms.ToolStripComboBox();
             this.工具箱ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.运行信息记录ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.计算器ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -555,8 +557,7 @@ namespace Welling_Motor_Debug_Tool
             this.label107 = new System.Windows.Forms.Label();
             this.label_StarInfo = new System.Windows.Forms.Label();
             this.pictureBox2 = new System.Windows.Forms.PictureBox();
-            this.uART协议ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.协议类型ToolStripMenuItem = new System.Windows.Forms.ToolStripComboBox();
+            this.本机信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.menuStrip_Set.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.groupBox1.SuspendLayout();
@@ -802,7 +803,7 @@ namespace Welling_Motor_Debug_Tool
             // 允许ToolStripMenuItem
             // 
             this.允许ToolStripMenuItem.Name = "允许ToolStripMenuItem";
-            this.允许ToolStripMenuItem.Size = new System.Drawing.Size(128, 26);
+            this.允许ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.允许ToolStripMenuItem.Text = "允许";
             this.允许ToolStripMenuItem.Click += new System.EventHandler(this.允许ToolStripMenuItem_Click);
             // 
@@ -811,7 +812,7 @@ namespace Welling_Motor_Debug_Tool
             this.不允许ToolStripMenuItem.Checked = true;
             this.不允许ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
             this.不允许ToolStripMenuItem.Name = "不允许ToolStripMenuItem";
-            this.不允许ToolStripMenuItem.Size = new System.Drawing.Size(128, 26);
+            this.不允许ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.不允许ToolStripMenuItem.Text = "不允许";
             this.不允许ToolStripMenuItem.Click += new System.EventHandler(this.不允许ToolStripMenuItem_Click);
             // 
@@ -832,7 +833,7 @@ namespace Welling_Motor_Debug_Tool
             this.IP地址ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerIP});
             this.IP地址ToolStripMenuItem.Name = "IP地址ToolStripMenuItem";
-            this.IP地址ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.IP地址ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.IP地址ToolStripMenuItem.Text = "IP地址";
             // 
             // toolStripTextBox_ServerIP
@@ -848,7 +849,7 @@ namespace Welling_Motor_Debug_Tool
             this.端口ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerPort});
             this.端口ToolStripMenuItem.Name = "端口ToolStripMenuItem";
-            this.端口ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.端口ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.端口ToolStripMenuItem.Text = "端口";
             // 
             // toolStripTextBox_ServerPort
@@ -864,7 +865,7 @@ namespace Welling_Motor_Debug_Tool
             this.用户名ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerUser});
             this.用户名ToolStripMenuItem.Name = "用户名ToolStripMenuItem";
-            this.用户名ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.用户名ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.用户名ToolStripMenuItem.Text = "用户名";
             // 
             // toolStripTextBox_ServerUser
@@ -880,7 +881,7 @@ namespace Welling_Motor_Debug_Tool
             this.密码ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerPasswd});
             this.密码ToolStripMenuItem.Name = "密码ToolStripMenuItem";
-            this.密码ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.密码ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.密码ToolStripMenuItem.Text = "密码";
             // 
             // toolStripTextBox_ServerPasswd
@@ -896,7 +897,7 @@ namespace Welling_Motor_Debug_Tool
             this.存储路径ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerPath});
             this.存储路径ToolStripMenuItem.Name = "存储路径ToolStripMenuItem";
-            this.存储路径ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.存储路径ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.存储路径ToolStripMenuItem.Text = "存储路径";
             // 
             // toolStripTextBox_ServerPath
@@ -1174,6 +1175,28 @@ namespace Welling_Motor_Debug_Tool
             this.力矩传感器检验ToolStripMenuItem.Text = "力矩检验参数";
             this.力矩传感器检验ToolStripMenuItem.Click += new System.EventHandler(this.力矩传感器检验ToolStripMenuItem_Click);
             // 
+            // uART协议ToolStripMenuItem
+            // 
+            this.uART协议ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.协议类型ToolStripMenuItem});
+            this.uART协议ToolStripMenuItem.Name = "uART协议ToolStripMenuItem";
+            this.uART协议ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
+            this.uART协议ToolStripMenuItem.Text = "UART协议";
+            // 
+            // 协议类型ToolStripMenuItem
+            // 
+            this.协议类型ToolStripMenuItem.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.协议类型ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.协议类型ToolStripMenuItem.Items.AddRange(new object[] {
+            "5S标准",
+            "锂电2号",
+            "八方",
+            "金米特5S",
+            "JLCD"});
+            this.协议类型ToolStripMenuItem.Name = "协议类型ToolStripMenuItem";
+            this.协议类型ToolStripMenuItem.Size = new System.Drawing.Size(180, 29);
+            this.协议类型ToolStripMenuItem.SelectedIndexChanged += new System.EventHandler(this.协议类型ToolStripMenuItem_SelectedIndexChanged);
+            // 
             // 工具箱ToolStripMenuItem
             // 
             this.工具箱ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -1190,28 +1213,28 @@ namespace Welling_Motor_Debug_Tool
             // 运行信息记录ToolStripMenuItem
             // 
             this.运行信息记录ToolStripMenuItem.Name = "运行信息记录ToolStripMenuItem";
-            this.运行信息记录ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.运行信息记录ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.运行信息记录ToolStripMenuItem.Text = "自动记录";
             this.运行信息记录ToolStripMenuItem.Click += new System.EventHandler(this.记录数据ToolStripMenuItem_Click);
             // 
             // 计算器ToolStripMenuItem
             // 
             this.计算器ToolStripMenuItem.Name = "计算器ToolStripMenuItem";
-            this.计算器ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.计算器ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.计算器ToolStripMenuItem.Text = "计算器";
             this.计算器ToolStripMenuItem.Click += new System.EventHandler(this.计算器ToolStripMenuItem_Click);
             // 
             // 页面保存ToolStripMenuItem
             // 
             this.页面保存ToolStripMenuItem.Name = "页面保存ToolStripMenuItem";
-            this.页面保存ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.页面保存ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.页面保存ToolStripMenuItem.Text = "页面保存";
             this.页面保存ToolStripMenuItem.Click += new System.EventHandler(this.页面保存ToolStripMenuItem_Click);
             // 
             // 屏幕键盘ToolStripMenuItem
             // 
             this.屏幕键盘ToolStripMenuItem.Name = "屏幕键盘ToolStripMenuItem";
-            this.屏幕键盘ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.屏幕键盘ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.屏幕键盘ToolStripMenuItem.Text = "屏幕键盘";
             this.屏幕键盘ToolStripMenuItem.Click += new System.EventHandler(this.屏幕键盘ToolStripMenuItem_Click);
             // 
@@ -1219,7 +1242,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.指令调试ToolStripMenuItem.Enabled = false;
             this.指令调试ToolStripMenuItem.Name = "指令调试ToolStripMenuItem";
-            this.指令调试ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.指令调试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.指令调试ToolStripMenuItem.Text = "指令调试";
             // 
             // 查询ToolStripMenuItem
@@ -1235,14 +1258,14 @@ namespace Welling_Motor_Debug_Tool
             // 调试记录数据ToolStripMenuItem
             // 
             this.调试记录数据ToolStripMenuItem.Name = "调试记录数据ToolStripMenuItem";
-            this.调试记录数据ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
+            this.调试记录数据ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.调试记录数据ToolStripMenuItem.Text = "调试记录数据";
             this.调试记录数据ToolStripMenuItem.Click += new System.EventHandler(this.调试记录数据ToolStripMenuItem_Click);
             // 
             // 生产记录数据ToolStripMenuItem
             // 
             this.生产记录数据ToolStripMenuItem.Name = "生产记录数据ToolStripMenuItem";
-            this.生产记录数据ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
+            this.生产记录数据ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.生产记录数据ToolStripMenuItem.Text = "生产记录数据";
             this.生产记录数据ToolStripMenuItem.Click += new System.EventHandler(this.生产记录数据ToolStripMenuItem_Click);
             // 
@@ -1250,6 +1273,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.关于ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.版本ToolStripMenuItem,
+            this.本机信息ToolStripMenuItem,
             this.帮助ToolStripMenuItem,
             this.累计运行时间ToolStripMenuItem});
             this.关于ToolStripMenuItem.ForeColor = System.Drawing.Color.White;
@@ -1260,14 +1284,14 @@ namespace Welling_Motor_Debug_Tool
             // 版本ToolStripMenuItem
             // 
             this.版本ToolStripMenuItem.Name = "版本ToolStripMenuItem";
-            this.版本ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.版本ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.版本ToolStripMenuItem.Text = "版本信息";
             this.版本ToolStripMenuItem.Click += new System.EventHandler(this.版本ToolStripMenuItem_Click);
             // 
             // 帮助ToolStripMenuItem
             // 
             this.帮助ToolStripMenuItem.Name = "帮助ToolStripMenuItem";
-            this.帮助ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.帮助ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.帮助ToolStripMenuItem.Text = "查看帮助";
             // 
             // 累计运行时间ToolStripMenuItem
@@ -1275,14 +1299,14 @@ namespace Welling_Motor_Debug_Tool
             this.累计运行时间ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripMenuItem_RunTime});
             this.累计运行时间ToolStripMenuItem.Name = "累计运行时间ToolStripMenuItem";
-            this.累计运行时间ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
+            this.累计运行时间ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
             this.累计运行时间ToolStripMenuItem.Text = "运行时间";
             this.累计运行时间ToolStripMenuItem.MouseHover += new System.EventHandler(this.累计运行时间ToolStripMenuItem_MouseHover);
             // 
             // toolStripMenuItem_RunTime
             // 
             this.toolStripMenuItem_RunTime.Name = "toolStripMenuItem_RunTime";
-            this.toolStripMenuItem_RunTime.Size = new System.Drawing.Size(142, 26);
+            this.toolStripMenuItem_RunTime.Size = new System.Drawing.Size(180, 26);
             this.toolStripMenuItem_RunTime.Text = "00:00:00";
             // 
             // statusStrip1
@@ -6270,27 +6294,12 @@ namespace Welling_Motor_Debug_Tool
             this.pictureBox2.TabIndex = 16;
             this.pictureBox2.TabStop = false;
             // 
-            // uART协议ToolStripMenuItem
-            // 
-            this.uART协议ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.协议类型ToolStripMenuItem});
-            this.uART协议ToolStripMenuItem.Name = "uART协议ToolStripMenuItem";
-            this.uART协议ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
-            this.uART协议ToolStripMenuItem.Text = "UART协议";
-            // 
-            // 协议类型ToolStripMenuItem
+            // 本机信息ToolStripMenuItem
             // 
-            this.协议类型ToolStripMenuItem.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.协议类型ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.协议类型ToolStripMenuItem.Items.AddRange(new object[] {
-            "5S标准",
-            "锂电2号",
-            "八方",
-            "金米特5S",
-            "JLCD"});
-            this.协议类型ToolStripMenuItem.Name = "协议类型ToolStripMenuItem";
-            this.协议类型ToolStripMenuItem.Size = new System.Drawing.Size(180, 29);
-            this.协议类型ToolStripMenuItem.SelectedIndexChanged += new System.EventHandler(this.协议类型ToolStripMenuItem_SelectedIndexChanged);
+            this.本机信息ToolStripMenuItem.Name = "本机信息ToolStripMenuItem";
+            this.本机信息ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.本机信息ToolStripMenuItem.Text = "本机信息";
+            this.本机信息ToolStripMenuItem.Click += new System.EventHandler(this.本机信息ToolStripMenuItem_Click);
             // 
             // mainForm
             // 
@@ -6947,5 +6956,6 @@ namespace Welling_Motor_Debug_Tool
         private Label label78;
         private ToolStripMenuItem uART协议ToolStripMenuItem;
         private ToolStripComboBox 协议类型ToolStripMenuItem;
+        private ToolStripMenuItem 本机信息ToolStripMenuItem;
     }
 }

+ 91 - 17
Welling_Motor_Debug_Tool/mainForm.cs

@@ -10,12 +10,12 @@ using System.Linq;
 using System.Reflection;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices.ComTypes;
+using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading;
 using System.Web;
 using System.Windows.Forms;
 using System.Xml.Linq;
-//using static System.Windows.Forms.VisualStyles.VisualStyleElement;
 
 namespace Welling_Motor_Debug_Tool
 {
@@ -72,6 +72,8 @@ namespace Welling_Motor_Debug_Tool
         public static GenerateParams GenerateParamsForm = new GenerateParams();
         //版本信息窗口
         public static Version VersionForm = new Version();
+        //本机硬件信息
+        public string Local_HdInformation = "";
         #endregion
 
         #region 故障日志结构体定义
@@ -365,6 +367,50 @@ namespace Welling_Motor_Debug_Tool
                 ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
             }
 
+            //获取本机信息,读取时间较长,优先从本地文件获取
+            do
+            {
+                try
+                {
+                    //本地文件为空,读取信息保存
+                    if (!File.Exists(localInfo.LocalPath + localInfo.PC_InfoFileName))
+                    {
+                        Local_HdInformation = "";
+                        Local_HdInformation += "计算机名称: " + System.Environment.UserName + "\r\n";
+                        Local_HdInformation += "IP地址: " + PC_Information.GetIpAddress() + "\r\n";
+                        Local_HdInformation += "系统ID: " + PC_Information.GetSystemID() + "\r\n";
+                        Local_HdInformation += "操作系统类型: " + PC_Information.GetSystemType() + "\r\n";
+                        Local_HdInformation += "主板型号: " + PC_Information.GetBoardType() + "\r\n";
+                        Local_HdInformation += "主板厂商: " + PC_Information.GetBoardManufacturer() + "\r\n";
+                        Local_HdInformation += "主板ID: " + PC_Information.GetBIOSSerialNumber() + "\r\n";
+                        Local_HdInformation += "CPU型号: " + PC_Information.GetCpuName() + "\r\n";
+                        Local_HdInformation += "CPU厂商: " + PC_Information.GetCpuManufacturer() + "\r\n";
+                        Local_HdInformation += "CPU ID: " + PC_Information.GetCPUSerialNumber() + "\r\n";
+                        Local_HdInformation += "内存容量: " + PC_Information.GetPhysicalMemory() + " GB" + "\r\n";
+                        Local_HdInformation += "硬盘容量: " + PC_Information.GetDiskCapacity() + "\r\n";
+                        Local_HdInformation += "MAC ID: " + PC_Information.GetNetCardMACAddress().Replace(":", "-") + "\r\n";                        
+                        System.IO.File.WriteAllText(localInfo.LocalPath + localInfo.PC_InfoFileName, Local_HdInformation);
+                    }
+                    //从本地读取,计算机名和IP地址重新读
+                    else
+                    {
+                        Local_HdInformation = "";
+                        string[] fileInfo = File.ReadAllLines(localInfo.LocalPath + localInfo.PC_InfoFileName, Encoding.UTF8);
+                        fileInfo[0] = "计算机名称: " + System.Environment.UserName;
+                        fileInfo[1] = "IP地址: " + PC_Information.GetIpAddress();
+                        for (int i = 0; i < fileInfo.Length; i++)
+                            Local_HdInformation += fileInfo[i] + "\r\n";
+                        File.Delete(localInfo.LocalPath + localInfo.PC_InfoFileName);
+                        System.IO.File.WriteAllText(localInfo.LocalPath + localInfo.PC_InfoFileName, Local_HdInformation);
+                    }
+                                        
+                }
+                catch(Exception)
+                { 
+                
+                }
+            } while (false);
+
             //系统登录
             do
             {                
@@ -446,8 +492,7 @@ namespace Welling_Motor_Debug_Tool
                             tabControl2.Visible = false;
                             //隐藏提示信息
                             label_StarInfo.Visible = false;
-                            //打开参数配置框
-                            //MessageBox.Show("开发中", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                            //打开参数配置框                            
                             GenerateParamsForm.ShowDialog();
                             System.Environment.Exit(0);
                             //退出登录
@@ -608,7 +653,7 @@ namespace Welling_Motor_Debug_Tool
             }
 
             //配置网络FTP服务器
-            myFtp.FtpOption(toolStripTextBox_ServerIP.Text, toolStripTextBox_ServerPort.Text, toolStripTextBox_ServerUser.Text, toolStripTextBox_ServerPasswd.Text);
+            myFtp.FtpOption(toolStripTextBox_ServerIP.Text, toolStripTextBox_ServerPort.Text, toolStripTextBox_ServerUser.Text, toolStripTextBox_ServerPasswd.Text, "admin", "ttium_admin");
             //创建线程,定时检测网络连接状态
             Thread th = new Thread(NetworkCheck);
             th.IsBackground = true;
@@ -625,7 +670,7 @@ namespace Welling_Motor_Debug_Tool
             if (允许ToolStripMenuItem.Checked == true) //允许离线使用
             {
                 timer_1s.Enabled = false;
-                MessageBox.Show("离线使用,不检测网络状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                MessageBoxTimeOut.Show("离线使用,不检测网络状态!", "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 timer_1s.Enabled = true;
                 return;
             }
@@ -637,6 +682,22 @@ namespace Welling_Motor_Debug_Tool
                 if (Result == true)//服务器连接成功
                 {
                     myFtp.IsNetConnected = true;
+                    //上传登录日志
+                    do
+                    {
+                        //日志文件名
+                        string date = DateTime.Now.ToString("yyyy-MM-dd_HHmmss_fff");
+                        string fileName = date;
+                        //日志内容
+                        string fileInfo = Local_HdInformation;                        
+                        //保存本地
+                        if (!Directory.Exists(localInfo.LocalLogPath))
+                            Directory.CreateDirectory(localInfo.LocalLogPath);
+                        System.IO.File.WriteAllText(localInfo.LocalLogPath + fileName, fileInfo);
+                        //上传服务器
+                        myFtp.UploadFile(localInfo.LocalLogPath + fileName, "/Tools/Welling_Motor_Debug_Tool/log");
+                        
+                    } while (false);
                 }
                 else//服务器连接失败
                 {
@@ -644,13 +705,13 @@ namespace Welling_Motor_Debug_Tool
                     if ((EnterForm1.comboBox_User.Text != "管理员") && (EnterForm1.comboBox_User.Text != "FCT治具测试"))
                     {
                         timer_1s.Enabled = false;
-                        MessageBox.Show("网络断开,将自动关闭!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                        MessageBoxTimeOut.Show("网络断开,将自动关闭!", "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                         timer_1s.Enabled = true;
                         this.Close();
                     }                    
                 }
 
-                //创建定时器,定时30s检查网络
+                //创建定时器,定时10s检查网络
                 System.Timers.Timer timer_CheckNet = new System.Timers.Timer();
                 timer_CheckNet.Enabled = true;
                 timer_CheckNet.Interval = 10000;
@@ -696,7 +757,7 @@ namespace Welling_Motor_Debug_Tool
                 if ((EnterForm1.comboBox_User.Text != "管理员") && (EnterForm1.comboBox_User.Text != "FCT治具测试"))
                 {
                     timer_1s.Enabled = false;
-                    MessageBox.Show("网络断开, 请检查网络!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                    MessageBoxTimeOut.Show("网络断开, 请检查网络!", "提示", 2000, MessageBoxButtons.OK, MessageBoxIcon.Warning); //提示框自动3s关闭
                     timer_1s.Enabled = true;
                     //禁止使用
                     groupBox1.Enabled = false;
@@ -1000,7 +1061,7 @@ namespace Welling_Motor_Debug_Tool
                                 {
                                     //CDL连接成功
                                     mySerialProcess.CDL_Online_Flag = true;
-                                    MessageBox.Show("连接成功!", "提示");
+                                    MessageBoxTimeOut.Show("连接成功!", "提示", 500);
                                     groupBox1.Visible = true;
                                     groupBox3.Visible = true;
                                     tabControl2.Visible = true;
@@ -1175,7 +1236,7 @@ namespace Welling_Motor_Debug_Tool
                                     if (ACK_DisFlag == true)
                                     {
                                         timer_1s.Enabled = false;
-                                        MessageBox.Show("OK", "反馈指令", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                                        MessageBoxTimeOut.Show("OK", "反馈指令", 500, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                         timer_1s.Enabled = true;
                                         //关机反馈
                                         PowerOffAckStatus = true;
@@ -1986,7 +2047,7 @@ namespace Welling_Motor_Debug_Tool
                                 this.Invoke((EventHandler)(delegate
                                 {
                                     timer_1s.Enabled = false;
-                                    MessageBox.Show("OK", "反馈指令", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                                    MessageBoxTimeOut.Show("OK", "反馈指令", 500, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                     timer_1s.Enabled = true;
                                 }));
                             }
@@ -3125,7 +3186,7 @@ namespace Welling_Motor_Debug_Tool
                 if (PowerOffAckStatus)
                 {
                     timer_1s.Enabled = false;
-                    MessageBox.Show("已关机!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
+                    MessageBoxTimeOut.Show("已关机!", "提示", 3000, MessageBoxButtons.OK, MessageBoxIcon.None);
                     timer_1s.Enabled = true;
                 }
                 else
@@ -3280,7 +3341,7 @@ namespace Welling_Motor_Debug_Tool
                         "PCB温度 , 绕组温度 , MOS温度 , 挡位 , 灯开关 , 续航 , 平均功耗 , 单次里程 , 单次时间 , 故障码 , " +
                         "系统状态机 , 二层状态机 , 电机状态机 , 助力状态机 , D轴电流给定 , Q轴电流给定 , D轴电压给定 , Q轴电压给定 , 瞬时力矩 , 时间滤波力矩 , 踏频滤波力矩 , D轴电流反馈 , Q轴电流反馈 , 助力函数输出" + "\r\n");
                     timer_1s.Enabled = false;
-                    MessageBox.Show("开始记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    MessageBoxTimeOut.Show("开始记录", "提示", 500, MessageBoxButtons.OK, MessageBoxIcon.Information);
                     timer_1s.Enabled = true;
                     运行信息记录ToolStripMenuItem.Checked = true;
                 }
@@ -3295,7 +3356,7 @@ namespace Welling_Motor_Debug_Tool
             {
                 运行信息记录ToolStripMenuItem.Checked = false;
                 timer_1s.Enabled = false;
-                MessageBox.Show("停止记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                MessageBoxTimeOut.Show("停止记录", "提示", 500, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 timer_1s.Enabled = true;
             }
 
@@ -4369,7 +4430,7 @@ namespace Welling_Motor_Debug_Tool
                 //保存数据
                 string DataFileName = "";
                 string FileInfo = "";
-                DataFileName = Save_Path + "\\" + textBox_FacModeName.Text + "_" + textBox_FacModeNum.Text + "_记录数据" + ".txt";
+                DataFileName = Save_Path + "\\" + textBox_FacModeName.Text + "_" + textBox_FacModeNum.Text + "_记录数据" + ".txt";                
                 FileInfo += "测试计算机:\r\n" + label_Computername.Text + "\r\n";
                 FileInfo += DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n";
                 FileInfo += "\r\n";
@@ -4432,6 +4493,7 @@ namespace Welling_Motor_Debug_Tool
                 FileInfo += "EEPROM: " + ((radioButton_EE_SaveYes.Checked == true) ? "已存储" : "未存储") + "\r\n";
                 FileInfo += "SIP: " + ((radioButton_SIP_SaveYes.Checked == true) ? "已存储" : "未存储") + "\r\n";
                 FileInfo += "\r\n";
+                FileInfo += Local_HdInformation;
                 System.IO.File.WriteAllText(DataFileName, FileInfo);
                 Delay_ms(1000);
 
@@ -4466,7 +4528,7 @@ namespace Welling_Motor_Debug_Tool
                     if ((result1 & result2) == true)
                     {
                         timer_1s.Enabled = false;
-                        MessageBox.Show("数据已上传!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                        MessageBoxTimeOut.Show("数据已上传!", "提示", 1000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                         timer_1s.Enabled = true;
                     }
                     else
@@ -5506,10 +5568,11 @@ namespace Welling_Motor_Debug_Tool
             //测试记录
             LogSaveFileName = LogSavePath + "\\" + ProductInfo + "_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + "_测试记录" + ".log";
             string file_str = "";
-            file_str += "测试计算机:\r\n" + label_Computername.Text + "\r\n";
+            file_str += "测试计算机:\r\n" + label_Computername.Text + "\r\n";            
             file_str += "测试时间:\r\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n\r\n";
             file_str += "检验记录:\r\n" + richTextBox_FacModeLog.Text.Replace("\n", "\r\n") + "\r\n\r\n";
             file_str += "检验结果:\r\n" + label_FacModeResult.Text + "\r\n\r\n";
+            file_str += Local_HdInformation;
             System.IO.File.WriteAllText(LogSaveFileName, file_str);
             //上传测试记录到服务器
             if (myFtp.IsNetConnected == true)
@@ -6845,6 +6908,7 @@ namespace Welling_Motor_Debug_Tool
             file_str += "测试时间:\r\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n\r\n";
             file_str += "检验记录:\r\n" + richTextBox_CheckModeLog.Text.Replace("\n", "\r\n") + "\r\n\r\n";
             file_str += "检验结果:\r\n" + label_CheckModeResult.Text + "\r\n\r\n";
+            file_str += Local_HdInformation;
             System.IO.File.WriteAllText(LogSaveFileName, file_str);
             //上传测试记录到服务器
             if (myFtp.IsNetConnected == true)
@@ -7801,5 +7865,15 @@ namespace Welling_Motor_Debug_Tool
             Code[1] = 0x00;
             mySerialProcess.SendCmd((ushort)0x7FF, (byte)0x16, (ushort)0x7702, Code);
         }
+
+        /// <summary>
+        /// 显示本机信息
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void 本机信息ToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            MessageBox.Show(Local_HdInformation, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
+        }
     }
 }

+ 1 - 1
Welling_Motor_Debug_Tool/mainForm.resx

@@ -127,7 +127,7 @@
     <value>275, 17</value>
   </metadata>
   <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>49</value>
+    <value>46</value>
   </metadata>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

BIN
Welling_Motor_Debug_Tool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.AssemblyReference.cache


+ 1 - 1
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
-8a674c7d77b6f0034a665ef7b4d1a4159c31d964766e277831f268fc135f7ba3
+7d07050510310e55bf8550d9eca9cee89d28efbe0ae4d90d40193d6cce53ea30

BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.GenerateResource.cache


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.exe


BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.pdb