瀏覽代碼

Data Index 예외 처리 / ASCII To HEX로 변환 메서드 추가 / 탐색창 binary , bin 파일 동시 search 수정 / Percent 표시 예외 처러 추가 / 다음다운로드 시 게이지 초기화하도록 수정

파일 탐색 메서드에서 serial 메모리 값으로 받도록 수정
YJ 6 年之前
父節點
當前提交
e690a8f46a

+ 16 - 2
Basic_Terminal/Func/Data_Handler.cs

@@ -32,7 +32,14 @@ namespace Basic_Terminal
32
             byte ret = 0;
32
             byte ret = 0;
33
             Crc16 crc = new Crc16();
33
             Crc16 crc = new Crc16();
34
             byte length,crcindex;
34
             byte length,crcindex;
35
-            length = data[2];
35
+            try
36
+            {
37
+                length = data[2];
38
+            }
39
+            catch
40
+            {
41
+                return ret;
42
+            }
36
             crcindex = (byte)(length + 1);
43
             crcindex = (byte)(length + 1);
37
             ret = crc.STH30_CheckCrc(data,length,data[crcindex]);
44
             ret = crc.STH30_CheckCrc(data,length,data[crcindex]);
38
 
45
 
@@ -42,7 +49,14 @@ namespace Basic_Terminal
42
         public void Recv_dataCheck(object fileDownload, byte[] data)
49
         public void Recv_dataCheck(object fileDownload, byte[] data)
43
         {
50
         {
44
             Boolean Header_Check;
51
             Boolean Header_Check;
45
-            byte Crc_Check,seq = data[1];
52
+            byte Crc_Check, seq;
53
+            try
54
+            {
55
+                seq = data[1];
56
+            }
57
+            catch {
58
+                return;
59
+            }
46
             if (fileDownload != null)
60
             if (fileDownload != null)
47
             {
61
             {
48
                 this.fileDownload = (Update_Serial)fileDownload;
62
                 this.fileDownload = (Update_Serial)fileDownload;

+ 5 - 0
Basic_Terminal/Func/Serial.cs

@@ -197,5 +197,10 @@ namespace Basic_Terminal
197
             if(this.Debug.Created)
197
             if(this.Debug.Created)
198
                 this.Debug.hex_to_ascii_radiobuttonConvert();
198
                 this.Debug.hex_to_ascii_radiobuttonConvert();
199
         }
199
         }
200
+        public void debug_asciitohexConvert()
201
+        {
202
+            if (this.Debug.Created)
203
+                this.Debug.ascii_to_hex_radiobuttonConvert();
204
+        }
200
     }
205
     }
201
 }
206
 }

+ 7 - 5
Basic_Terminal/Func/Update_Serial.cs

@@ -51,15 +51,15 @@ namespace Basic_Terminal
51
         /***
51
         /***
52
 *Data File open
52
 *Data File open
53
 ***/
53
 ***/
54
-        public string ShowFileOpenDialog(object serial, object ofd)
54
+        public string ShowFileOpenDialog(ref Serial serial, object ofd)
55
         {
55
         {
56
             byte[] tempdata = new byte[5];
56
             byte[] tempdata = new byte[5];
57
             this.ofd = (OpenFileDialog)ofd;
57
             this.ofd = (OpenFileDialog)ofd;
58
             this.serial = (Serial)serial;
58
             this.serial = (Serial)serial;
59
             //파일오픈창 생성 및 설정
59
             //파일오픈창 생성 및 설정
60
             this.ofd.Title = "업데이터 파일 탐색기";
60
             this.ofd.Title = "업데이터 파일 탐색기";
61
-            this.ofd.FileName = "*.binary";
62
-            this.ofd.Filter = "binary 파일 (*.binary) | *.binary; |bin 파일 (*.bin) | *.bin; | 모든 파일 (*.*) | *.*";
61
+            this.ofd.FileName = "*.bin";
62
+            this.ofd.Filter = "binary 파일 (*.binary,*.bin) | *.binary;, *.bin; | 모든 파일 (*.*) | *.*";
63
 
63
 
64
             //파일 오픈창 로드
64
             //파일 오픈창 로드
65
             DialogResult dr = this.ofd.ShowDialog();
65
             DialogResult dr = this.ofd.ShowDialog();
@@ -158,9 +158,11 @@ namespace Basic_Terminal
158
                     /*ownload_Bar.ShowDialog();*/
158
                     /*ownload_Bar.ShowDialog();*/
159
                     this.download_Bar.Invoke(new StringSend(this.download_Bar.Progressbar), "0 %");
159
                     this.download_Bar.Invoke(new StringSend(this.download_Bar.Progressbar), "0 %");
160
                     //download_Bar.Progressbar("0 %");
160
                     //download_Bar.Progressbar("0 %");
161
-
161
+                    this.download_Bar.Progressbar_gauge_zero();
162
                     this.download_Bar.FormClosed(this.download_Bar);
162
                     this.download_Bar.FormClosed(this.download_Bar);
163
-                   
163
+                    this.serial.debug_asciitohexConvert();
164
+                    FirmSendingcnt = PreFirmSendingcnt = FirmCurrcnt = FirmTotalcnt = pretempupdateret = Data_Request_Val = 0;
165
+      
164
                     /*Update_label.Text = "0%";
166
                     /*Update_label.Text = "0%";
165
                     Update_label.Visible = false;
167
                     Update_label.Visible = false;
166
                     progressBar1.Visible = false;
168
                     progressBar1.Visible = false;

+ 5 - 0
Basic_Terminal/Wnd/Debug.cs

@@ -165,5 +165,10 @@ namespace Basic_Terminal
165
             radioButton_hex.Checked = true;
165
             radioButton_hex.Checked = true;
166
             radioButton_ascii.Checked = false;
166
             radioButton_ascii.Checked = false;
167
         }
167
         }
168
+        public void ascii_to_hex_radiobuttonConvert()
169
+        {
170
+            radioButton_ascii.Checked = true;
171
+            radioButton_hex.Checked = false;
172
+        }
168
     }
173
     }
169
 }
174
 }

+ 9 - 1
Basic_Terminal/Wnd/Download_bar.cs

@@ -20,6 +20,10 @@ namespace Basic_Terminal
20
         {
20
         {
21
             Update_label.Text = val;
21
             Update_label.Text = val;
22
         }
22
         }
23
+        public void Progressbar_gauge_zero()
24
+        {
25
+            Firm_Progressbar.Value = 0;
26
+        }
23
         public new void FormClosed(object form)
27
         public new void FormClosed(object form)
24
         {
28
         {
25
             Download_bar download_Bar = (Download_bar)form;
29
             Download_bar download_Bar = (Download_bar)form;
@@ -42,7 +46,11 @@ namespace Basic_Terminal
42
         {
46
         {
43
             CheckForIllegalCrossThreadCalls = false;
47
             CheckForIllegalCrossThreadCalls = false;
44
             Firm_Progressbar.PerformStep();
48
             Firm_Progressbar.PerformStep();
45
-            Update_label.Text = val + "%";
49
+            try
50
+            {
51
+                Update_label.Text = val + "%";
52
+            }
53
+            catch { }
46
         }
54
         }
47
         public int Update_get()
55
         public int Update_get()
48
         {
56
         {

+ 1 - 1
Basic_Terminal/Wnd/Main_Form.cs

@@ -31,7 +31,7 @@ namespace Basic_Terminal
31
             //FileDownload file = new FileDownload();
31
             //FileDownload file = new FileDownload();
32
             if (Ascii_checkBox.Checked == true)
32
             if (Ascii_checkBox.Checked == true)
33
                 Ascii_checkBox.Checked = false;
33
                 Ascii_checkBox.Checked = false;
34
-            file.ShowFileOpenDialog(serial, ofd);
34
+            file.ShowFileOpenDialog(ref serial, ofd);
35
         }
35
         }
36
         private void Crc16_Check_Click(object sender, EventArgs e)
36
         private void Crc16_Check_Click(object sender, EventArgs e)
37
         {
37
         {