Преглед на файлове

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 32
             byte ret = 0;
33 33
             Crc16 crc = new Crc16();
34 34
             byte length,crcindex;
35
-            length = data[2];
35
+            try
36
+            {
37
+                length = data[2];
38
+            }
39
+            catch
40
+            {
41
+                return ret;
42
+            }
36 43
             crcindex = (byte)(length + 1);
37 44
             ret = crc.STH30_CheckCrc(data,length,data[crcindex]);
38 45
 
@@ -42,7 +49,14 @@ namespace Basic_Terminal
42 49
         public void Recv_dataCheck(object fileDownload, byte[] data)
43 50
         {
44 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 60
             if (fileDownload != null)
47 61
             {
48 62
                 this.fileDownload = (Update_Serial)fileDownload;

+ 5 - 0
Basic_Terminal/Func/Serial.cs

@@ -197,5 +197,10 @@ namespace Basic_Terminal
197 197
             if(this.Debug.Created)
198 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 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 56
             byte[] tempdata = new byte[5];
57 57
             this.ofd = (OpenFileDialog)ofd;
58 58
             this.serial = (Serial)serial;
59 59
             //파일오픈창 생성 및 설정
60 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 65
             DialogResult dr = this.ofd.ShowDialog();
@@ -158,9 +158,11 @@ namespace Basic_Terminal
158 158
                     /*ownload_Bar.ShowDialog();*/
159 159
                     this.download_Bar.Invoke(new StringSend(this.download_Bar.Progressbar), "0 %");
160 160
                     //download_Bar.Progressbar("0 %");
161
-
161
+                    this.download_Bar.Progressbar_gauge_zero();
162 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 166
                     /*Update_label.Text = "0%";
165 167
                     Update_label.Visible = false;
166 168
                     progressBar1.Visible = false;

+ 5 - 0
Basic_Terminal/Wnd/Debug.cs

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

+ 1 - 1
Basic_Terminal/Wnd/Main_Form.cs

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