using System; using System.Collections; using System.IO; using System.Data; using Cosmos.Common; using Cosmos.UserFrame; using Cosmos.CommonManager; using Cosmos.ServiceProvider; using Cosmos.BaseFrame; using System.Diagnostics; using System.Linq; using System.Text; namespace Cosmos.Service { public class PosConfigSync : IServiceUs { private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출 private PosStatus m_cPosStatus = new PosStatus(); //기본정보 참조 private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체) protected IDataCommonUs m_cDataCommon = null; // 판매공통 모듈 private readonly string m_FIELD_DIV = "|"; private readonly string m_LINE_DIV = "#~"; public PosConfigSync() { m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보 m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON); } /// /// 실행 /// /// /// public string Execute(string[] aParam) { string sRet = UserCom.RST_ERR; string sSendData = ""; try { //0:복원저장 구분, 1: 파일명 if (aParam[0] == ItemConst.POS_CONFIG_TYPE.LOAD) //복원 { sRet = GetExecuteIrtPosConfigSync(aParam[1]); } else if (aParam[0] == ItemConst.POS_CONFIG_TYPE.SAVE) //저장 { //데이터생성 sSendData = GetConfigData(aParam[1]); if (sSendData.Length > 2) sRet = SetExecuteIrtPosConfigSync("", sSendData.Substring(2)); } } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return sRet; } #region 전문 송/수신 /// /// 전문송신 /// /// /// private string SetExecuteIrtPosConfigSync(string sFileName, string sConfigData) { string sRet = UserCom.RST_ERR; int iRecvTimeOut = 10000; Hashtable htRecvData = new Hashtable(); Hashtable htSendData = new Hashtable(); try { // 조회 htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.POS_CONFIG_UPLOAD); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.POS_NO, m_cPosStatus.Base.PosNo); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.INQ_DIV, ItemConst.POS_CONFIG_INQ_DIV.SAVE); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.FILE_NM, sFileName.ToUpper()); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.USER_ID, m_cPosStatus.Base.CashierNo); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.CONFIG_DATA, sConfigData); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.RES_CD, ""); sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.BizInqPort, iRecvTimeOut, htSendData, ref htRecvData); if (sRet != UserCom.RST_OK) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "CONFIG SEND FAIL : " + sRet); return sRet; } if (htRecvData[Column.IQ_POS_SPEC.DATA.RES_CD].ToString() == "00") { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "CONFIG SEND SUCCESS"); sRet = UserCom.RST_OK; } else { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "CONFING SEND FAIL RSN_CD : " + htRecvData[Column.IQ_POS_SPEC.DATA.RES_CD].ToString()); } } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return sRet; } /// /// 전문 수신 /// /// /// private string GetExecuteIrtPosConfigSync(string sFileName) { string sRet = UserCom.RST_ERR; int iRecvTimeOut = 10000; Hashtable htRecvData = new Hashtable(); Hashtable htSendData = new Hashtable(); try { // 조회 htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.POS_CONFIG_UPLOAD); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.POS_NO, m_cPosStatus.Base.PosNo); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.INQ_DIV, sFileName == "" ? ItemConst.POS_CONFIG_INQ_DIV.LOAD_ALL : ItemConst.POS_CONFIG_INQ_DIV.LOAD_ONE); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.FILE_NM, sFileName.ToUpper()); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.USER_ID, m_cPosStatus.Base.CashierNo); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.CONFIG_DATA, ""); htSendData.Add(Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.RES_CD, ""); sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.BizInqPort, iRecvTimeOut, htSendData, ref htRecvData); if (sRet != UserCom.RST_OK) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "CONFIG RECV FAIL : " + sRet); return sRet; } if (htRecvData[Column.IQ_POS_SPEC.DATA.RES_CD].ToString() == "00") { sRet = GetConfigDataParser(htRecvData[Column.IQ_STR_EQUP_CHECKSAVE_LIST_INQ.DATA.CONFIG_DATA].ToString()); } else if (htRecvData[Column.IQ_POS_SPEC.DATA.RES_CD].ToString() == "01") { sRet = UserCom.RST_IGNORE; } else { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "CONFIG RECV FAIL RSN_CD : " + htRecvData[Column.IQ_POS_SPEC.DATA.RES_CD].ToString()); } } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return sRet; } /// /// 응답데이터 파서 /// /// /// private string GetConfigDataParser(string sConfigData) { string sRet = UserCom.RST_ERR; try { string[] aRecvData = sConfigData.Split(new string[] { m_LINE_DIV }, StringSplitOptions.RemoveEmptyEntries); //CmMessage m_PosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig); //CmMessage m_PosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo); //CmMessage m_PosDevice = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosDevice); //CmMessage m_CommPort = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.CommPort); CmMessage m_PosConfig = null; CmMessage m_PosSaleInfo = null; CmMessage m_PosDevice = null; CmMessage m_CommPort = null; for (int iRow = 0; iRow < aRecvData.Length; iRow++) { string[] aTagData = aRecvData[iRow].Split(new string[] { m_FIELD_DIV }, StringSplitOptions.None); if (aTagData.Length == 5) { if (string.IsNullOrEmpty(aRecvData[0]) == false && string.IsNullOrEmpty(aRecvData[1]) == false && string.IsNullOrEmpty(aRecvData[2]) == false && string.IsNullOrEmpty(aRecvData[3]) == false) { CmMessage m_tmpCmMsg = null; if (aTagData[0] == PosConst.INI_FILE_NAME.PosConfig.ToUpper()) { if (m_PosConfig == null) m_PosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig); m_tmpCmMsg = m_PosConfig; } else if (aTagData[0] == PosConst.INI_FILE_NAME.PosSaleInfo.ToUpper()) { if (m_PosSaleInfo == null) m_PosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo); m_tmpCmMsg = m_PosSaleInfo; } else if (aTagData[0] == PosConst.INI_FILE_NAME.PosDevice.ToUpper()) { if (m_PosDevice == null) m_PosDevice = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosDevice); m_tmpCmMsg = m_PosDevice; } else if (aTagData[0] == PosConst.INI_FILE_NAME.CommPort.ToUpper()) { if (m_CommPort == null) m_CommPort = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.CommPort); m_tmpCmMsg = m_CommPort; } else { continue; } if (m_tmpCmMsg != null) m_tmpCmMsg.GetMessage(aTagData[1]).MakeMessageOverWrite(aTagData[2], aTagData[3]); } } else { //Debug.Print(aRecvData[iRow]); } } // 구조상 한번에 저장해야함! if (m_PosConfig != null) { m_PosConfig.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig); } if (m_PosSaleInfo != null) { m_PosSaleInfo.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo); } if (m_PosDevice != null) { m_PosDevice.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosDevice); } if (m_CommPort != null) { m_CommPort.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.CommPort); } sRet = UserCom.RST_OK; } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.ToString()); } return sRet; } #endregion #region 전송데이터 생성 /// /// 전송데이터 생성 /// /// 전송파일 /// private string GetConfigData(string sFileName) { string sRetData = string.Empty; try { //전송 대상 배열 담기 string[,] arrList = new string[,] { // 파일명 ,메인태그 ,서브태그 ,암호화구분 // PosConfig.INI // { PosConst.INI_FILE_NAME.PosConfig ,"POS" ,"CmpCd" ,"0" } //,{ PosConst.INI_FILE_NAME.PosConfig ,"POS" ,"BrandDiv" ,"0" } //,{ PosConst.INI_FILE_NAME.PosConfig ,"POS" ,"BrandCd" ,"0" } //,{ PosConst.INI_FILE_NAME.PosConfig ,"POS" ,"StoreNo" ,"0" } //,{ PosConst.INI_FILE_NAME.PosConfig ,"POS" ,"PosNo" ,"0" } { PosConst.INI_FILE_NAME.PosConfig ,"POS" ,"LogLevel" ,"0" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"POS" ,"LogoUpload" ,"0" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"POS" ,"MasterDown" ,"0" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"DATABASE" ,"LocalSource" ,"1" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"DATABASE" ,"LocalCatalog" ,"1" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"DATABASE" ,"LocalUserID" ,"1" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"DATABASE" ,"LocalPassword" ,"1" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"GLOBAL" ,"CultureID" ,"0" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"GLOBAL" ,"Country" ,"0" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"GLOBAL" ,"Font" ,"0" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"GLOBAL" ,"FontFix" ,"0" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"SERVER" ,"CommSvrIp" ,"0" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"SERVER" ,"FtpConnType" ,"0" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"PRINT" ,"TextLogoMsg1" ,"0" } ,{ PosConst.INI_FILE_NAME.PosConfig ,"PRINT" ,"TextLogoMsg2" ,"0" } // PosSaleInfo.INI //,{ PosConst.INI_FILE_NAME.PosSaleInfo,"POSOPEN" ,"OpenClose" ,"0" } //,{ PosConst.INI_FILE_NAME.PosSaleInfo,"POSOPEN" ,"SaleDate" ,"0" } //,{ PosConst.INI_FILE_NAME.PosSaleInfo,"POSOPEN" ,"OpenDateTime" ,"0" } //,{ PosConst.INI_FILE_NAME.PosSaleInfo,"POSOPEN" ,"CloseDateTime" ,"0" } //,{ PosConst.INI_FILE_NAME.PosSaleInfo,"PGMVER" ,"ProgramVer10" ,"0" } //,{ PosConst.INI_FILE_NAME.PosSaleInfo,"PGMVER" ,"ProgramVerSeq10" ,"0" } //,{ PosConst.INI_FILE_NAME.PosSaleInfo,"POSOPEN" ,"MstDownDate" ,"0" } //,{ PosConst.INI_FILE_NAME.PosSaleInfo,"MSGNO" ,"TradeNo" ,"0" } //,{ PosConst.INI_FILE_NAME.PosSaleInfo,"MSGNO" ,"RegNo" ,"0" } //,{ PosConst.INI_FILE_NAME.PosSaleInfo,"MSGNO" ,"StartTradeNo" ,"0" } //,{ PosConst.INI_FILE_NAME.PosSaleInfo,"MSGNO" ,"MsgSeqNo" ,"0" } // PosDevice.INI ,{ PosConst.INI_FILE_NAME.PosDevice ,"POSPRINTER" ,"UseFlag" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"POSPRINTER" ,"Controller" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"POSPRINTER" ,"SerialPortNumber" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"POSPRINTER" ,"SerialBaudRate" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"POSPRINTER" ,"Model" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SIGNPAD" ,"UseFlag" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SIGNPAD" ,"SerialPortNumber" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SIGNPAD" ,"SerialBaudRate" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SIGNPAD" ,"Model" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SIGNPAD" ,"AutoFlag" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SIGNPAD" ,"MinCnt" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SIGNPAD" ,"TimeOut" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CASHDRAWER" ,"UseFlag" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CASHDRAWER" ,"CashDrawerType" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CASHDRAWER" ,"SerialPortNumber" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CASHDRAWER" ,"SerialBaudRate" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SCALE" ,"UseFlag" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SCALE" ,"SerialPortNumber" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SCALE" ,"SerialBaudRate" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SCALEPOLEDISP","UseFlag" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SCALEPOLEDISP","SerialPortNumber" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"SCALEPOLEDISP","SerialBaudRate" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"ICREADER" ,"UseFlag" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"ICREADER" ,"SerialPortNumber" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"ICREADER" ,"SerialBaudRate" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"ICREADER" ,"Model" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CATTERMINAL" ,"UseFlag" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CATTERMINAL" ,"SerialPortNumber" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CATTERMINAL" ,"SerialBaudRate" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CATTERMINAL" ,"Model" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CATTERMINAL" ,"TimeOut" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"LABELPRINTER" ,"UseFlag" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"LABELPRINTER" ,"SerialPortNumber" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"LABELPRINTER" ,"SerialBaudRate" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"LABELPRINTER" ,"Model" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CDP" ,"UseFlag" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CDP" ,"Controller" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CDP" ,"SerialPortNumber" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CDP" ,"SerialBaudRate" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"CDP" ,"Model" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"MSR" ,"Controller" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"MSR" ,"SerialPortNumber" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"MSR" ,"SerialBaudRate" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"MSR" ,"Model" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"MSR" ,"STX" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"MSR" ,"ETX" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"MSR" ,"UseFlag" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"LGEMPRF" ,"SerialPortNumber" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"LGEMPRF" ,"SerialBaudRate" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"LGEMPRF" ,"Model" ,"0" } ,{ PosConst.INI_FILE_NAME.PosDevice ,"LGEMPRF" ,"UseFlag" ,"0" } // CommPort.INI ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"SignLogPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"SysInfoPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"TranPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"JrnlPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"TranInqPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"MissChkPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"PayInqPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"BizInqPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"MstPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"PayLogPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"AppLogPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"EtcTranPort" ,"0" } ,{ PosConst.INI_FILE_NAME.CommPort ,"SERVER" ,"ScaleLogPort" ,"0" } }; for (int iRow = 0; iRow <= arrList.GetLength(0) - 1; iRow++) { if (string.IsNullOrEmpty(arrList[iRow, 0]) == false && (sFileName == "" || sFileName == arrList[iRow, 0])) { CmMessage cmsFile = null; cmsFile = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + arrList[iRow, 0]); if (cmsFile != null) sRetData += DataFormat(arrList[iRow, 0].ToUpper(), arrList[iRow, 1], arrList[iRow, 2], CmUtil.StringNullEmpty(GetConfigInfo(cmsFile, arrList[iRow, 1], arrList[iRow, 2])), arrList[iRow, 3]); } } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.ToString()); } return sRetData; } /// /// 설정 파일 읽기 /// /// /// /// /// private string GetConfigInfo(CmMessage cCfgInfo, string sGroup, string sValueName) { return GetConfigInfo(cCfgInfo, sGroup, sValueName, ""); } private string GetConfigInfo(CmMessage cCfgInfo, string sGroup, string sValueName, string sDefault) { try { string sValue = cCfgInfo.GetMessage(sGroup).GetMessageValue(sValueName); if (sValue == null) return sDefault; else return sValue; } catch { } return sDefault; } #endregion #region 조회 데이터 포멧팅 /// /// 조회 데이터 치환 /// /// /// private string DataReplace(string sInData) { string sData = ""; try { sData = sInData.Replace(m_FIELD_DIV, "").Replace(m_LINE_DIV, "").Replace("\n", ""); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.ToString()); } return sData; } /// /// 전송 데이터 포멧팅 /// /// /// /// /// /// private string DataFormat(string sFileName, string sMainTag, string sSubTag, string sValue, string sCrypt) { string sRetData = string.Empty; try { sRetData = string.Format("{5}{1}{0}{2}{0}{3}{0}{4}", m_FIELD_DIV, sFileName, sMainTag, sSubTag, DataReplace(sValue), m_LINE_DIV); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.ToString()); } return sRetData; } #endregion } }