private void button_compare_Click(object sender, EventArgs e) { try { Image img_capture = ImageProc.ImageCrop(GetDataGridSelectPID(dataGridView1_IDInfo.CurrentCell.RowIndex), eImagetype.name); string strFilePath = ImageProc.m_strFilePath + GetDataGridSelectID(dataGridView1_IDInfo.CurrentCell.RowIndex) + ".bmp"; bool bEqual = true; if (new FileInfo(strFilePath).Exists == false) { Log_move.Format("file : " + strFilePath + "가 없습니다."); throw new Exception(); } else { bEqual = ImageProc.ImageCompare(strFilePath, new Bitmap(img_capture)); } string str = "File : " + strFilePath + " 와 Process ID" + GetDataGridSelectID(dataGridView1_IDInfo.CurrentCell.RowIndex) + "와 비교 " + (bEqual ? "같다" : "다르다"); Log_move.Format(str); } catch (Exception ex) { } }
private bool InputInfoProgram(int nIndex, int nID) { bool bRet = false; try { string strID = GetDataGridSelectID(nIndex); SendKeys.SendWait(dataGridView_Info.Rows[nIndex].Cells["ID"].Value.ToString()); ProcessControl.keyInput(Keys.Tab, 250); SendKeys.SendWait(dataGridView_Info.Rows[nIndex].Cells["PW"].Value.ToString()); ProcessControl.keyInput(Keys.Enter); int nTry = 0; do { Image img_capture = ImageProc.ImageCrop(nID, eImagetype.name); string strFilePath = ImageProc.m_strIDInfo + GetDataGridSelectID(nIndex) + ".bmp"; if (File.Exists(strFilePath) == false) { logs.Format("이미지 없음 저장필요"); bRet = true; Thread.Sleep(500); Connectingcheck(nID); Thread.Sleep(500); } else { bRet = ImageProc.ImageCompare(strFilePath, new Bitmap(img_capture)); } if (bRet == true) { break; } else { Connectingcheck(nID); } Thread.Sleep(200);//Task.Delay(1000); } while (nTry++ < 10); } catch (Exception e) { logs.Format(e.ToString()); bRet = false; } return(bRet); }
private void Connectingcheck(int nID) { bool bConnecting = false; try { string strFilePath = ImageProc.m_strLogin + "6.bmp"; Image img_Connecting = ImageProc.ImageCrop(nID, eImagetype.isconnected); bConnecting = ImageProc.ImageCompare(strFilePath, new Bitmap(img_Connecting)); if (bConnecting) { ProcessControl.keyInput(Keys.Enter); ProcessControl.keyInput(Keys.Enter, 400); } } catch (Exception e) { } }
private bool ImageCompareSeq(string strPath, eImagetype imagetype, int nID, int nTry = 10, int nSleepTime = 100) { bool bRet = false; try { int n = 0; do { bRet = ImageProc.ImageCompare(strPath, new Bitmap(ImageProc.ImageCrop(nID, imagetype))); if (bRet == true) { break; } Thread.Sleep(nSleepTime);//Task.Delay(1000); } while (n++ < nTry); } catch (Exception e) { logs.Format(e.ToString()); bRet = false; } return(bRet); }
private bool CompareID(int nIndex) { bool bCheck = false; try { Image img_capture = ImageProc.ImageCrop(GetDataGridSelectPID(dataGridView1_IDInfo.CurrentCell.RowIndex), eImagetype.name); string strFilePath = ImageProc.m_strFilePath + GetDataGridSelectID(dataGridView1_IDInfo.CurrentCell.RowIndex) + ".bmp"; if (new FileInfo(strFilePath).Exists == false) { Log_move.Format("file : " + strFilePath + "가 없습니다."); } else { bCheck = ImageProc.ImageCompare(strFilePath, new Bitmap(img_capture)); } } catch (Exception) { } return(bCheck); }