Ejemplo n.º 1
0
        public void setBtnColor(byte _kind)
        {
            mode = _kind;
            this.btnMic.BackColor = Color.Black;
            this.btnRec.BackColor = Color.Black;

            if (AdengUtil.INIReadValueString(this.setting, "siren1", this.IniFilePath) != string.Empty)
            {
                msgTime[0] = AdengUtil.INIReadValueString(this.setting, "siren1", this.IniFilePath);
            }

            if (AdengUtil.INIReadValueString(this.setting, "siren2", this.IniFilePath) != string.Empty)
            {
                msgTime[1] = AdengUtil.INIReadValueString(this.setting, "siren2", this.IniFilePath);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 데이터 초기화
        /// </summary>
        private void init()
        {
            this.ComPortCB.Text  = AdengUtil.INIReadValueString(this.setting, this.portNum, this.IniFilePath);
            this.BaudRateCB.Text = AdengUtil.INIReadValueString(this.setting, this.baudRate, this.IniFilePath);
            this.DataBitsCB.Text = AdengUtil.INIReadValueString(this.setting, this.dataBits, this.IniFilePath);
            string p = AdengUtil.INIReadValueString(this.setting, this.parity, this.IniFilePath);

            this.StopBitCB.Text    = AdengUtil.INIReadValueString(this.setting, this.stopBit, this.IniFilePath);
            this.UdpIpTB.Text      = AdengUtil.INIReadValueString(this.setting, this.udpIp, this.IniFilePath);
            this.UdpPortTB.Text    = AdengUtil.INIReadValueString(this.setting, this.udpPort, this.IniFilePath);
            this.TcpIpTB.Text      = AdengUtil.INIReadValueString(this.setting, this.tcpIp, this.IniFilePath);
            this.TcpPortTB.Text    = AdengUtil.INIReadValueString(this.setting, this.tcpPort, this.IniFilePath);
            this.TcpSvrIpTB.Text   = AdengUtil.INIReadValueString(this.setting, this.tcpSvrIp, this.IniFilePath);
            this.TcpSvrPortTB.Text = AdengUtil.INIReadValueString(this.setting, this.tcpSvrPort, this.IniFilePath);

            //parity = 0이면 Parity.None
            //parity = 1이면 Parity.Even
            //parity = 2이면 Parity.Odd
            this.ParityCB.Text = (p == "2") ? "홀수" : (p == "1") ? "짝수" : "없음";
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 옵션 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void optionOToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (this.optionForm = new DBMngOption())
            {
                this.optionForm.OnDbSettingDataEvt += new EventHandler <DbSettingDataEvtArgs>(optionForm_OnDbSettingDataEvt);
                this.optionForm.OnTcpSocketEvt     += new EventHandler <TcpSocketEventArgs>(optionForm_OnTcpSocketEvt);
                this.optionForm.OnTcpSettingEvt    += new EventHandler <TcpSettingEventArgs>(optionForm_OnTcpSettingEvt);
                this.optionForm.OnLogSettingEvt    += new EventHandler <LogSettingEventArgs>(optionForm_OnLogSettingEvt);
                this.optionForm.OnUdpSettingEvt    += new EventHandler <TcpSettingEventArgs>(optionForm_OnUdpSettingEvt);

                //DB
                this.optionForm.DbIp  = AdengUtil.INIReadValueString(this.setting, this.DBIP, this.IniFilePath);
                this.optionForm.DbSid = AdengUtil.INIReadValueString(this.setting, this.DBSID, this.IniFilePath);
                this.optionForm.DbId  = AdengUtil.INIReadValueString(this.setting, this.DBID, this.IniFilePath);
                this.optionForm.DbPw  = AdengUtil.INIReadValueString(this.setting, this.DBPW, this.IniFilePath);
                this.optionForm.Db8i  = (AdengUtil.INIReadValueString(this.setting, this.Oracle8i, this.IniFilePath) == "T" ? true : false);

                //TCP
                this.optionForm.TcpIp    = AdengUtil.INIReadValueString(this.setting, this.TCPIP, this.IniFilePath);
                this.optionForm.TcpPort  = AdengUtil.INIReadValueString(this.setting, this.TCPPort, this.IniFilePath);
                this.optionForm.TcpState = this.tcpState;

                //UDP
                this.optionForm.UdpIp   = AdengUtil.INIReadValueString(this.setting, this.UDPIP, this.IniFilePath);
                this.optionForm.UdpPort = AdengUtil.INIReadValueString(this.setting, this.UDPPort, this.IniFilePath);

                //LOG
                this.optionForm.LogCheckBox = (AdengUtil.INIReadValueString(this.setting, this.LogFlag, this.IniFilePath) == "T" ? true : false);

                //ShowDialog
                this.optionForm.ShowDialog();

                this.optionForm.OnDbSettingDataEvt -= new EventHandler <DbSettingDataEvtArgs>(optionForm_OnDbSettingDataEvt);
                this.optionForm.OnTcpSocketEvt     -= new EventHandler <TcpSocketEventArgs>(optionForm_OnTcpSocketEvt);
                this.optionForm.OnTcpSettingEvt    -= new EventHandler <TcpSettingEventArgs>(optionForm_OnTcpSettingEvt);
                this.optionForm.OnLogSettingEvt    -= new EventHandler <LogSettingEventArgs>(optionForm_OnLogSettingEvt);
                this.optionForm.OnUdpSettingEvt    -= new EventHandler <TcpSettingEventArgs>(optionForm_OnUdpSettingEvt);
            }
        }
Ejemplo n.º 4
0
        public OrderSelLiveSiren()
        {
            InitializeComponent();

            label2.Text = LangPack.GetSelSiren();
            btnMic.Text = LangPack.GetSiren1();
            btnRec.Text = LangPack.GetSiren2();

            try
            {
                if (AdengUtil.INIReadValueString(this.setting, "siren1", this.IniFilePath) != string.Empty)
                {
                    msgTime[0] = AdengUtil.INIReadValueString(this.setting, "siren1", this.IniFilePath);
                }

                if (AdengUtil.INIReadValueString(this.setting, "siren2", this.IniFilePath) != string.Empty)
                {
                    msgTime[1] = AdengUtil.INIReadValueString(this.setting, "siren2", this.IniFilePath);
                }

                if (!(System.IO.File.Exists(Util.file_Siren + "siren_1.wav")))
                {
                    this.LameMp3ToWav(Util.file_Siren + "siren_1.mp3", Util.file_Siren + "siren_1.wav");
                }

                if (!(System.IO.File.Exists(Util.file_Siren + "siren_2.wav")))
                {
                    this.LameMp3ToWav(Util.file_Siren + "siren_2.mp3", Util.file_Siren + "siren_2.wav");
                }
            }
            catch (Exception ex)
            {
                AdengUtil.INIWriteValueString(this.setting, "siren1", msgTime[0], IniFilePath);
                AdengUtil.INIWriteValueString(this.setting, "siren2", msgTime[1], IniFilePath);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 재접속을 위한 메소드
        /// </summary>
        /// <returns></returns>
        private bool TryConnect()
        {
            try
            {
                string ip       = AdengUtil.INIReadValueString(this.setting, this.DBIP, this.IniFilePath);
                string sid      = AdengUtil.INIReadValueString(this.setting, this.DBSID, this.IniFilePath);
                string id       = AdengUtil.INIReadValueString(this.setting, this.DBID, this.IniFilePath);
                string psw      = AdengUtil.INIReadValueString(this.setting, this.DBPW, this.IniFilePath);
                bool   support8 = (AdengUtil.INIReadValueString(this.setting, this.Oracle8i, this.IniFilePath) == "T") ? true : false;

                if (this.dataMng.OracleConnect(ip, sid, id, psw, support8) == false)
                {
                    throw new Exception(string.Format("{0}, {1}, {2}, {3}, {4}", ip, sid, id, psw, support8));
                }

                return(true);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("TryConnect - " + ex.Message);
            }

            return(false);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 키 값 읽기
 /// </summary>
 /// <param name="keyName"></param>
 /// <returns>키 설정 값</returns>
 private string ReadKeyValue(string sectionName, string keyName)
 {
     return(AdengUtil.INIReadValueString(sectionName, keyName, INI_PATH));
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 초기화
        /// </summary>
        private void init()
        {
            //디렉토리가 있는지 체크..
            if (!Directory.Exists(this.IniFileDirectoryPath))
            {
                Directory.CreateDirectory(IniFileDirectoryPath);
            }

            //파일이 있는지 체크..없으면 파일 생성
            if (!File.Exists(IniFilePath))
            {
                AdengUtil.INIWriteValueString(this.setting, this.DBIP, "58.181.17.58", IniFilePath);
                AdengUtil.INIWriteValueString(this.setting, this.DBSID, "orcl", IniFilePath);
                AdengUtil.INIWriteValueString(this.setting, this.DBID, "mews33", IniFilePath);
                AdengUtil.INIWriteValueString(this.setting, this.DBPW, "mews", IniFilePath);
                AdengUtil.INIWriteValueString(this.setting, this.Oracle8i, "F", IniFilePath);
                AdengUtil.INIWriteValueString(this.setting, this.TCPIP, "127.0.0.1", IniFilePath);
                AdengUtil.INIWriteValueString(this.setting, this.TCPPort, "9009", IniFilePath);
                AdengUtil.INIWriteValueString(this.setting, this.LogFlag, "F", IniFilePath);
                AdengUtil.INIWriteValueString(this.setting, this.UDPIP, "127.0.0.1", IniFilePath);
                AdengUtil.INIWriteValueString(this.setting, this.UDPPort, "7001", IniFilePath);
            }

            //tcp client socket 생성
            this.clientSoc                  = TCPModClient.getTCPModClient();
            this.clientSoc.evConnected     += new TCPModClient.ConnectedHandler(clientSoc_evConnected);
            this.clientSoc.evConnectFailed += new TCPModClient.ConnectedFailedHandler(clientSoc_evConnectFailed);
            this.clientSoc.evDisconnected  += new TCPModClient.DisconnectedHandler(clientSoc_evDisconnected);
            this.clientSoc.evReceived      += new TCPModClient.ReceivedHandler(clientSoc_evReceived);
            this.clientSoc.evSendFailed    += new TCPModClient.SendFailedHandler(clientSoc_evSendFailed);
            this.clientSoc.evTimeout       += new TCPModClient.TimeOutHandler(clientSoc_evTimeout);

            //udp socket 생성
            try
            {
                this.udpSoc = new AdengUdpSocket(AdengUtil.INIReadValueString(this.setting, this.UDPIP, this.IniFilePath),
                                                 int.Parse(AdengUtil.INIReadValueString(this.setting, this.UDPPort, this.IniFilePath)));
                this.udpSoc.recvEvtHandler += new RecvEvtHandler(udpSoc_recvEvtHandler);
                this.SetLogListBox("UDP Success!");
            }
            catch (Exception ex)
            {
                this.SetLogListBox("UDP Fail!");
            }

            //data Manager 생성
            this.dataMng = DBMngDataMng.getInstance();
            this.dataMng.OnTermStateTCPSendEvt += new EventHandler <TermStateTCPSendEvtArgs>(dataMng_OnTermStateTCPSendEvt);

            //queue 생성
            this.insertQ = new Queue <PrtBase>();

            try
            {
                //로그 셋팅 값을 가져온다.
                this.logState = (AdengUtil.INIReadValueString(this.setting, this.LogFlag, IniFilePath) == "T" ? true : false);

                //TCP 연결
                this.localTcpIp   = AdengUtil.INIReadValueString(this.setting, this.TCPIP, this.IniFilePath);
                this.localTcpPort = int.Parse(AdengUtil.INIReadValueString(this.setting, this.TCPPort, this.IniFilePath));
                this.clientSoc.ConnectTo(this.localTcpIp, this.localTcpPort);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("MewsMain.init - " + ex.Message);
            }

            //폴링 데이터 처리
            PrtBase p9 = PrtMng.GetPrtObject(9);

            p9.MakeData();
            byte[] buff = PrtMng.MakeFrame(p9);
            this.clientSoc.BtPoll = buff;

            //기초데이터 로드 (단말)
            if (this.TryConnect())
            {
                if (this.dataMng.InitDataLoad())
                {
                    this.SetLogListBox("Init Data Load Success!");
                }
                else
                {
                    this.SetLogListBox("Init Data Load Fail (DB Read Fail!)");
                }
            }
            else
            {
                this.SetLogListBox("Init Data Load Fail (DB Connect Fail!)");
            }

            //처리한 큐 카운트를 라벨에 셋팅한다.
            this.procCountTD = new Thread(new ThreadStart(this.SetDataProcCnt));
            this.procCountTD.IsBackground = true;
            this.procCountTD.Start();

            //큐처리
            this.proc.runAsyncProcess += new InvokeValue(proc_runAsyncProcess);
            this.proc.Start();

            //프로그램 제목 최신 버전 표시
            this.Text += version1;

            //시작 로그
            if (this.logState)
            {
                MTextLog.WriteTextLog(true, this.Text + " START");
            }
        }