private void Form1_Load(object sender, EventArgs e) { Application.ApplicationExit += new EventHandler(Application_ApplicationExit); srchWrd = objUtil.getAppCfg("srchWrd"); captureWrd = objUtil.getAppCfg("captureWrd"); exceptWrd = objUtil.getAppCfg("exceptWrd"); if (srchWrd == null || captureWrd == null || exceptWrd == null) { MessageBox.Show("검색어 오류"); this.Close(); } else { srchWrd_arr = objUtil.Split(srchWrd, "|"); captureWrd_arr = objUtil.Split(captureWrd, "|"); exceptWrd_arr = objUtil.Split(exceptWrd, "|"); } myNotify = new NotifyIcon(); myNotify.BalloonTipText = "최소화..."; myNotify.BalloonTipTitle = "자게캡쳐"; myNotify.BalloonTipIcon = ToolTipIcon.Info; myNotify.Icon = this.Icon; myNotify.MouseClick += new MouseEventHandler(myNotify_MouseClick); radioButton1.Checked = true; }
public string INSERT_DB(System.Data.SqlClient.SqlConnection dbCon, System.Data.SqlClient.SqlTransaction TRX, string tbName, string cols, string vals) { int i; string Result = ""; StringBuilder strBuilder = new StringBuilder(); System.Collections.ArrayList arrCols = new System.Collections.ArrayList(); System.Collections.ArrayList arrVals = new System.Collections.ArrayList(); arrCols.AddRange(objUtil.Split(cols, "|")); arrVals.AddRange(objUtil.Split(vals, "|")); strBuilder.Append("INSERT INTO " + tbName); strBuilder.Append(" ("); for (i = 0; i < arrCols.Count; i++) { if (i > 0) { strBuilder.Append(", "); } strBuilder.Append(objUtil.toDb(arrCols[i].ToString())); } strBuilder.Append(") VALUES ("); for (i = 0; i < arrVals.Count; i++) { if (i > 0) { strBuilder.Append(", "); } strBuilder.Append("'"); strBuilder.Append(objUtil.toDb(arrVals[i].ToString().Replace("%/", "|"))); strBuilder.Append("'"); } strBuilder.Append(")"); objUtil.writeLog("INSERT_DB QUERY : " + strBuilder.ToString()); try { Result = objDB.ExecuteNonQuery(dbCon, TRX, strBuilder.ToString()); } catch (Exception e) { objUtil.writeLog("ERR CMN INSERT [" + tbName + "] " + "[" + cols + "] " + "[" + vals + "]"); objUtil.writeLog("ERR CMN INSERT QUERY : " + strBuilder.ToString()); objUtil.writeLog("ERR CMN INSERT MSG : " + e.ToString()); Result = "FAIL"; } return(Result); }
public string DELETE_DB(System.Data.SqlClient.SqlConnection dbCon, System.Data.SqlClient.SqlTransaction TRX, string tbName, string Wcols, string Wvals) { int i; string Result = ""; StringBuilder strBuilder = new StringBuilder(); libCommon.clsDB objDB = new libCommon.clsDB(); libCommon.clsUtil objUtil = new libCommon.clsUtil(); System.Collections.ArrayList arrWCols = new System.Collections.ArrayList(); System.Collections.ArrayList arrWVals = new System.Collections.ArrayList(); arrWCols.AddRange(objUtil.Split(Wcols, "|")); arrWVals.AddRange(objUtil.Split(Wvals, "|")); strBuilder.Append("DELETE FROM " + tbName); strBuilder.Append(" WHERE "); for (i = 0; i < arrWCols.Count; i++) { if (i > 0) { strBuilder.Append(" AND "); } strBuilder.Append("["); strBuilder.Append(objUtil.toDb(arrWCols[i].ToString())); strBuilder.Append("]"); strBuilder.Append(" = "); strBuilder.Append("'"); strBuilder.Append(objUtil.toDb(arrWVals[i].ToString())); strBuilder.Append("'"); } try { Result = objDB.ExecuteNonQuery(dbCon, TRX, strBuilder.ToString()); } catch (Exception e) { objUtil.writeLog("ERR CMN DELETE [" + tbName + "] " + "[" + Wcols + "] " + "[" + Wvals + "]"); objUtil.writeLog("ERR CMN DELETE QUERY : " + strBuilder.ToString()); objUtil.writeLog("ERR CMN DELETE MSG : " + e.ToString()); Result = "FAIL"; } return(Result); }
/// <summary> /// 해당path에서 일정 패턴의 파일 목록 반환 /// </summary> /// <param name="path"></param> /// <param name="srchOption">서브디렉토리 포함 여부</param> /// <param name="srchPattern">";"로 구분된 복수의 패턴</param> /// <returns></returns> private void getFileList(string path, SearchOption objSrchoption, string srchPattern) { libCommon.clsUtil objUtil = new libCommon.clsUtil(); System.Collections.ArrayList arrList = new ArrayList(); string[] fileExts = objUtil.Split(srchPattern, ";"); for (int i = 0; i < fileExts.Length; i++) { string[] files = Directory.GetFiles(path, fileExts[i], objSrchoption); string statusStr1 = string.Format("STEP:{0}/{1}...", i + 1, fileExts.Length); string statusStr2 = "0/0"; if (files.Length > 0) { for (int j = 0; j < files.Length; j++) { getEXIFinfo(files[j]); if (j % 10 == 0 || j == files.Length - 1) { statusStr2 = string.Format("{0}/{1}", j + 1, files.Length); libMyUtil.clsThread.SetLabel(this.status, statusStr1 + statusStr2); } } } libMyUtil.clsThread.SetTextBox(this.textBox1, statusStr1 + statusStr2 + "\r\n"); } }
public void delDupe(StringBuilder stackBuilder, StringBuilder srcBuilder) { libCommon.clsUtil objUtil = new libCommon.clsUtil(); string[] srcText; int i; srcText = objUtil.Split(srcBuilder.ToString(), "\r\n"); for (i = 0; i < srcText.Length; i++) { if (stackBuilder.ToString().IndexOf(srcText[i]) < 0) { stackBuilder.AppendLine(srcText[i]); } } }
private void genPropertyList() { libCommon.clsUtil objUtil = new libCommon.clsUtil(); string propertyList = @"Artist|0x013B, BitsPerSample|0x0102, Compression|0x0103, CellWidth|0x0108, CellHeight|0x0109, ColorMap|0x0140, ColorTransferFunction|0x501A, ChrominanceTable|0x5091, Copyright|0x8298, DocumentName|0x010D, DateTime|0x0132, DotRange|0x0150, EquipMake|0x010F, EquipModel|0x0110, ExtraSamples|0x0152, ExifExposureTime|0x829A, ExifFNumber|0x829D, ExifIFD|0x8769, ExifExposureProg|0x8822, ExifSpectralSense|0x8824, ExifISOSpeed|0x8827, ExifOECF|0x8828, ExifVer|0x9000, ExifDTOrig|0x9003, ExifDTDigitized|0x9004, ExifCompConfig|0x9101, ExifCompBPP|0x9102, ExifShutterSpeed|0x9201, ExifAperture|0x9202, ExifBrightness|0x9203, ExifExposureBias|0x9204, ExifMaxAperture|0x9205, ExifSubjectDist|0x9206, ExifMeteringMode|0x9207, ExifLightSource|0x9208, ExifFlash|0x9209, ExifFocalLength|0x920A, ExifMakerNote|0x927C, ExifUserComment|0x9286, ExifDTSubsec|0x9290, ExifDTOrigSS|0x9291, ExifDTDigSS|0x9292, ExifFPXVer|0xA000, ExifColorSpace|0xA001, ExifPixXDim|0xA002, ExifPixYDim|0xA003, ExifRelatedWav|0xA004, ExifInterop|0xA005, ExifFlashEnergy|0xA20B, ExifSpatialFR|0xA20C, ExifFocalXRes|0xA20E, ExifFocalYRes|0xA20F, ExifFocalResUnit|0xA210, ExifSubjectLoc|0xA214, ExifExposureIndex|0xA215, ExifSensingMethod|0xA217, ExifFileSource|0xA300, ExifSceneType|0xA301, ExifCfaPattern|0xA302, FillOrder|0x010A, FreeOffset|0x0120, FreeByteCounts|0x0121, FrameDelay|0x5100, GpsVer|0x0000, GpsLatitudeRef|0x0001, GpsLatitude|0x0002, GpsLongitudeRef|0x0003, GpsLongitude|0x0004, GpsAltitudeRef|0x0005, GpsAltitude|0x0006, GpsGpsTime|0x0007, GpsGpsSatellites|0x0008, GpsGpsStatus|0x0009, GpsGpsMeasureMode|0x000A, GpsGpsDop|0x000B, GpsSpeedRef|0x000C, GpsSpeed|0x000D, GpsTrackRef|0x000E, GpsTrack|0x000F, GpsImgDirRef|0x0010, GpsImgDir|0x0011, GpsMapDatum|0x0012, GpsDestLatRef|0x0013, GpsDestLat|0x0014, GpsDestLongRef|0x0015, GpsDestLong|0x0016, GpsDestBearRef|0x0017, GpsDestBear|0x0018, GpsDestDistRef|0x0019, GpsDestDist|0x001A, GpsIFD|0x8825, GrayResponseUnit|0x0122, GrayResponseCurve|0x0123, Gamma|0x0301, GridSize|0x5011, GlobalPalette|0x5102, HostComputer|0x013C, HalftoneHints|0x0141, HalftoneLPI|0x500A, HalftoneLPIUnit|0x500B, HalftoneDegree|0x500C, HalftoneShape|0x500D, HalftoneMisc|0x500E, HalftoneScreen|0x500F, ImageWidth|0x0100, ImageHeight|0x0101, ImageDescription|0x010E, InkSet|0x014C, InkNames|0x014D, ICCProfileDescriptor|0x0302, ImageTitle|0x0320, IndexBackground|0x5103, IndexTransparent|0x5104, ICCProfile|0x8773, JPEGProc|0x0200, JPEGInterFormat|0x0201, JPEGInterLength|0x0202, JPEGRestartInterval|0x0203, JPEGLosslessPredictors|0x0205, JPEGPointTransforms|0x0206, JPEGQTables|0x0207, JPEGDCTables|0x0208, JPEGACTables|0x0209, JPEGQuality|0x5010, LuminanceTable|0x5090, LoopCount|0x5101, MinSampleValue|0x0118, MaxSampleValue|0x0119, NewSubfileType|0x00FE, NumberOfInks|0x014E, Orientation|0x0112, PhotometricInterp|0x0106, PlanarConfig|0x011C, PageName|0x011D, PageNumber|0x0129, Predictor|0x013D, PrimaryChromaticities|0x013F, PrintFlags|0x5005, PrintFlagsVersion|0x5006, PrintFlagsCrop|0x5007, PrintFlagsBleedWidth|0x5008, PrintFlagsBleedWidthScale|0x5009, PixelUnit|0x5110, PixelPerUnitX|0x5111, PixelPerUnitY|0x5112, PaletteHistogram|0x5113, RowsPerStrip|0x0116, ResolutionUnit|0x0128, REFBlackWhite|0x0214, ResolutionXUnit|0x5001, ResolutionYUnit|0x5002, ResolutionXLengthUnit|0x5003, ResolutionYLengthUnit|0x5004, SubfileType|0x00FF, StripOffsets|0x0111, SamplesPerPixel|0x0115, StripBytesCount|0x0117, SoftwareUsed|0x0131, SampleFormat|0x0153, SMinSampleValue|0x0154, SMaxSampleValue|0x0155, SRGBRenderingIntent|0x0303, ThreshHolding|0x0107, T4Option|0x0124, T6Option|0x0125, TransferFunction|0x012D, TileWidth|0x0142, TileLength|0x0143, TileOffset|0x0144, TileByteCounts|0x0145, TargetPrinter|0x0151, TransferRange|0x0156, ThumbnailFormat|0x5012, ThumbnailWidth|0x5013, ThumbnailHeight|0x5014, ThumbnailColorDepth|0x5015, ThumbnailPlanes|0x5016, ThumbnailRawBytes|0x5017, ThumbnailSize|0x5018, ThumbnailCompressedSize|0x5019, ThumbnailData|0x501B, ThumbnailImageWidth|0x5020, ThumbnailImageHeight|0x5021, ThumbnailBitsPerSample|0x5022, ThumbnailCompression|0x5023, ThumbnailPhotometricInterp|0x5024, ThumbnailImageDescription|0x5025, ThumbnailEquipMake|0x5026, ThumbnailEquipModel|0x5027, ThumbnailStripOffsets|0x5028, ThumbnailOrientation|0x5029, ThumbnailSamplesPerPixel|0x502A, ThumbnailRowsPerStrip|0x502B, ThumbnailStripBytesCount|0x502C, ThumbnailResolutionX|0x502D, ThumbnailResolutionY|0x502E, ThumbnailPlanarConfig|0x502F, ThumbnailResolutionUnit|0x5030, ThumbnailTransferFunction|0x5031, ThumbnailSoftwareUsed|0x5032, ThumbnailDateTime|0x5033, ThumbnailArtist|0x5034, ThumbnailWhitePoint|0x5035, ThumbnailPrimaryChromaticities|0x5036, ThumbnailYCbCrCoefficients|0x5037, ThumbnailYCbCrSubsampling|0x5038, ThumbnailYCbCrPositioning|0x5039, ThumbnailRefBlackWhite|0x503A, ThumbnailCopyRight|0x503B, WhitePoint|0x013E, XResolution|0x011A, XPosition|0x011E, YResolution|0x011B, YPosition|0x011F, YCbCrCoefficients|0x0211, YCbCrSubsampling|0x0212, YCbCrPositioning|0x0213"; DT = new DataTable(); string[] property_arr = objUtil.Split(propertyList.Replace("\r\n", ""), ","); DT.Columns.Add("ID"); DT.Columns.Add("Name"); for (int i = 0; i < property_arr.Length; i++) { DT.Rows.Add(); DT.Rows[i][0] = objUtil.Split(property_arr[i], "|")[1]; DT.Rows[i][1] = objUtil.Split(property_arr[i], "|")[0]; } }
/// <summary> /// /// </summary> /// <param name="strFilePath">엑셀 파일 경로</param> /// <param name="QUERY"></param> /// <param name="maxRow">0이면 전체 행 가져오기</param> private static DataSet readExcelData(string strFilePath, string QUERY, int maxRow) { libCommon.clsUtil objUtil = new libCommon.clsUtil(); OleDbConnection oleDBCon = null; StringBuilder strBuilder = new StringBuilder(); DataSet DS = new DataSet(); string strProvider; string[] Temp; string[] sheetName; string[] columnName; string strQuery; int i; int j; Temp = objUtil.Split(strFilePath, "."); //파일경로가 올바르면 실행 if (Temp.Length > 0) { if (Temp[Temp.Length - 1].Equals("xlsx")) { strProvider = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + strFilePath + "; Extended Properties=Excel 12.0"; } else { strProvider = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + strFilePath + "; Extended Properties=Excel 8.0"; } try { oleDBCon = new OleDbConnection(strProvider); //접속 oleDBCon.Open(); //쉬트 네임 가져오기 sheetName = getSheetName(oleDBCon); if (sheetName == null) { return(DS); } if (QUERY.Length > 0) { strQuery = QUERY; using (OleDbCommand oleDBCom = new OleDbCommand(strQuery, oleDBCon)) { using (OleDbDataReader oleReader = oleDBCom.ExecuteReader()) { DS.Tables.Add(); DS.Tables[0].Load(oleReader); } } } else { for (i = 0; i < sheetName.Length; i++) { //컬럼명 가져오기 columnName = getColumnName(oleDBCon, sheetName[i]); if (columnName == null) { return(DS); } if (maxRow > 0) { strQuery = "SELECT TOP " + maxRow.ToString() + " * FROM [" + sheetName[i] + "]"; } else { strQuery = "SELECT * FROM [" + sheetName[i] + "]"; } //값이 없는 행은 제거하는 조건 추가 for (j = 0; j < columnName.Length; j++) { if (j == 0) { strBuilder.Append(" WHERE"); } else { strBuilder.Append(" OR"); } strBuilder.Append(string.Format(" [{0}.{1}] IS NOT NULL", sheetName[i], columnName[0])); } strQuery += strBuilder.ToString(); using (OleDbCommand oleDBCom = new OleDbCommand(strQuery, oleDBCon)) { using (OleDbDataReader oleReader = oleDBCom.ExecuteReader()) { DS.Tables.Add(); DS.Tables[i].Load(oleReader); } } } } } catch (Exception ex) { objUtil.writeLog("ERR READ EXCEL" + "\r\n" + ex.ToString()); } if (oleDBCon != null) { oleDBCon.Close(); oleDBCon.Dispose(); } } return(DS); }