public static int CheckAddress() { //SerialPortCommunication NewConnection = new SerialPortCommunication(); if (myserialport.IsOpen == true) { myserialport.Close(); } textBox1.Text = "Uploading..."; comInit(); //bslReset(false); bslReset(true); //txPasswd(passwdFile); SerialPortCommunication.txPasswd2(passwdFile); TextWriter tw = new StreamWriter(UploadedFileName); bslTxRx(BSL_RXBLK, 0x007F, 0x0002, null, blkin); int d = 1; string s = blkin[d].ToString("x2"); if (s == "a3") { return 1; } return 0; }