public bool saveToDevice() { // save try { // load ModelAppDevice device = new ModelAppDevice(); if (null != device) { // 프로그램 실행중에만 의미있게 함 Kons.ShopCallpass.AppMain.AppCore.Instance.getAppDoc().m_is_use_save_order_input = m_is_use_save_order_input; Kons.ShopCallpass.AppMain.AppCore.Instance.getAppDoc().m_is_use_send_order_input = m_is_use_send_order_input; // 장치에 저장하지 않고 일회성으로만 사용하게 바꾸면서 주석처리 //device.writeConfigLong(CONFIG_SECTION, "is_use_save_order_input", m_is_use_save_order_input); // 저장하지 않고 일회성으로만 사용한다. //device.writeConfigLong(CONFIG_SECTION, "is_use_send_order_input", m_is_use_send_order_input); // 저장하지 않고 일회성으로만 사용한다. } } catch (Exception ex) { Kons.ShopCallpass.AppMain.AppCore.detectException(ex.Message); } return(true); }
public bool saveToDevice() { // save bool is_success = false; try { // id tag String id_tag = "_" + m_config_id.ToString(); // load ModelAppDevice device = new ModelAppDevice(); if (null != device) { device.writeConfigLong(CONFIG_SECTION, "is_use" + id_tag, m_is_use); device.writeConfigLong(CONFIG_SECTION, "is_install" + id_tag, m_is_install); device.writeConfigString(CONFIG_SECTION, "input_type" + id_tag, m_input_type); device.writeConfigString(CONFIG_SECTION, "input_port_num" + id_tag, m_input_port_num); device.writeConfigLong(CONFIG_SECTION, "input_port_baud" + id_tag, m_input_port_baud); device.writeConfigString(CONFIG_SECTION, "listen_port_num" + id_tag, m_listen_port_num); device.writeConfigLong(CONFIG_SECTION, "listen_port_baud" + id_tag, m_listen_port_baud); device.writeConfigString(CONFIG_SECTION, "conn_print_port_num" + id_tag, m_conn_print_port_num); } } catch (Exception ex) { Kons.ShopCallpass.AppMain.AppCore.detectException(ex.Message); } return(is_success); }
// ---------------------------------------------------------- parent event handler // public void saveDlgObjectData() { // controls -> object setDlgControlDataToObjects(); // save m_running_etc_config.saveToDevice(); ModelAppDevice device = new ModelAppDevice(); string keyName = "Callpass"; string assemblyLocation = /*System.Reflection.Assembly.GetExecutingAssembly().Location;*/ Application.ExecutablePath.ToString(); // Or the EXE path. if (checkBox1.Checked) { // Set Auto-start. if (!IsAutoStartEnabled(keyName, assemblyLocation)) { SetAutoStart(keyName, assemblyLocation); Utility.Utility.LogWrite("자동실행 ON"); } device.writeConfigString("AUTORUNNING", "auto_running", "1"); } else { // Unset Auto-start. if (IsAutoStartEnabled(keyName, assemblyLocation)) { UnSetAutoStart(keyName); Utility.Utility.LogWrite("자동실행 OFF"); } device.writeConfigString("AUTORUNNING", "auto_running", "0"); } }
// ---------------------------------------------------------- parent event handler // public void saveDlgObjectData() { if (ctr_chk_use_print_ouput_0.Checked || ctr_chk_use_print_ouput_1.Checked || ctr_chk_use_print_ouput_2.Checked || ctr_chk_use_print_ouput_3.Checked) { if (checkBox1.Checked) { FormPopupNotify.Show(this.Owner, "시리얼 포트와 USB포트를 동시에 사용할 수 없습니다. 확인 해 주십시오.", "알림"); return; } } ModelAppDevice device = new ModelAppDevice(); if (null != device) { if (comboBox1.SelectedItem != null) { device.writeConfigLong("CONFIG_PRINT_OUTPUT", "is_use_usb_printer", checkBox1.Checked ? 1 : 0); device.writeConfigString("CONFIG_PRINT_OUTPUT", "usb_printer_name", comboBox1.SelectedItem.ToString()); } } // controls -> object setDlgControlDataToObjects(); // save if (m_config_list.isVailedData()) { m_config_list.saveObjectAll(); } else { FormPopupNotify.Show(this.Owner, "프린트 포트가 중복으로 지정 되었습니다. 확인 해 주십시오.", "알림"); } }
// -------------------------------------- // public bool loadFromDevice(int _obj_key) { // init initObj(); // load bool is_success = false; try { // id m_config_id = _obj_key; // id tag String id_tag = "_" + m_config_id.ToString(); // load ModelAppDevice device = new ModelAppDevice(); if (null != device) { m_is_use = device.readConfigLong(CONFIG_SECTION, "is_use" + id_tag); m_print_connect_type = device.readConfigString(CONFIG_SECTION, "print_connect_type" + id_tag); m_print_port_num = device.readConfigString(CONFIG_SECTION, "input_port_num" + id_tag); m_print_port_baud = device.readConfigLong(CONFIG_SECTION, "input_port_baud" + id_tag); } } catch (Exception ex) { Kons.ShopCallpass.AppMain.AppCore.detectException(ex.Message); } return(is_success); }
public static string EncodingToStringFitness(int _sender, byte[] _target) { ModelAppDevice device = new ModelAppDevice(); string characterSet = ""; string value = ""; switch (_sender) { case 10: characterSet = device.readConfigString("BEMINENCODING", "bemin_encoding"); break; case 21: characterSet = device.readConfigString("OKPOSENCODING", "okpos_encoding"); break; case 26: characterSet = device.readConfigString("DELGENENCODING", "delgen_encoding"); break; case 27: characterSet = device.readConfigString("POSFEEDENCODING", "posfeed_encoding"); break; case 31: characterSet = device.readConfigString("EASYPOSENCODING", "easypos_encoding"); break; case 32: characterSet = device.readConfigString("YOGIYOENCODING", "yogiyo_encoding"); break; case 33: characterSet = device.readConfigString("BEDALTONGENCODING", "bedaltong_encoding"); break; case 98: characterSet = device.readConfigString("ETCENCODING", "etc_encoding"); break; } switch (characterSet) { case "EUC-KR": value = Encoding.Default.GetString(_target); break; case "UTF-8": value = Encoding.UTF8.GetString(_target); break; } return(value); }
// ---------------------------------------------------------- basic method // public FormDlgConfigRunningEtc(Form _parnet = null) { setBaseFormData(_parnet, null, DLG_TYPE.TYPE_NORMAL); InitializeComponent(); ModelAppDevice device = new ModelAppDevice(); if (device.readConfigString("AUTORUNNING", "auto_running") == "0") { checkBox1.Checked = false; } else if (device.readConfigString("AUTORUNNING", "auto_running") == "1") { checkBox1.Checked = true; } }
public static int CheckSender() { ModelAppDevice device = new ModelAppDevice(); string val = device.readConfigString("TEMP_PORTNAME", "temp_portName"); int num = 0; for (int i = 0; i < 4; i++) { if (val.Equals(device.readConfigString("CONFIG_ORDER_INPUT", "listen_port_num_" + i.ToString()))) { num = Int32.Parse(device.readConfigString("CONFIG_ORDER_INPUT", "input_type_" + i.ToString())); } } return(num); }
static public string getSaveFileName(IWin32Window _owner, string _filter) { SaveFileDialog dlg_file = new SaveFileDialog(); if (null != dlg_file) { ModelAppDevice device = new ModelAppDevice(); dlg_file.Filter = _filter; dlg_file.InitialDirectory = device.getConfigLastOpenPath(); dlg_file.Title = "저장할 이름을 입력해주세요"; if (DialogResult.OK == dlg_file.ShowDialog(_owner)) { return(dlg_file.FileName); } } return(""); }
// ---------------------------------------------------------- basic method // public FormDlgConfigPrintOutput(Form _parnet = null) { setBaseFormData(null, null, DLG_TYPE.TYPE_NORMAL); InitializeComponent(); try { ModelAppDevice device = new ModelAppDevice(); var printerQuery = new ManagementObjectSearcher("SELECT * from Win32_Printer"); foreach (var printer in printerQuery.Get()) { var name = printer.GetPropertyValue("Name"); comboBox1.Items.Add(name.ToString()); } ManagementObjectSearcher usbPrinterSearcher = new ManagementObjectSearcher(@"Select * From Win32_USBHub"); foreach (ManagementObject Port in usbPrinterSearcher.Get()) { if (Port.GetPropertyValue("DeviceID").ToString().Contains("USB\\VID")) { comboBox1.Items.Add(Port.GetPropertyValue("Name").ToString()); } } for (int i = 0; i < comboBox1.Items.Count; i++) { if (device != null) { if (comboBox1.Items[i].ToString() == device.readConfigString("CONFIG_PRINT_OUTPUT", "usb_printer_name")) { comboBox1.SelectedItem = comboBox1.Items[i]; break; } } } checkBox1.Checked = Int32.Parse(device.readConfigString("CONFIG_PRINT_OUTPUT", "is_use_usb_printer")) == 1 ? true : false; } catch (Exception ex) { Kons.ShopCallpass.AppMain.AppCore.detectException(ex.Message); } }
protected void setParserType(PARSER_TYPE _parser_type) { ModelAppDevice device = new ModelAppDevice(); if (device != null) { string temp = device.readConfigString("TEMP_PORTNAME", "temp_portname"); Debug.WriteLine("들어온 포트 temp : " + temp); for (int i = 0; i < 4; i++) { if (temp == device.readConfigString("CONFIG_ORDER_INPUT", "listen_port_num_" + i.ToString())) { Debug.WriteLine("읽어온 포트 temp : " + device.readConfigString("CONFIG_ORDER_INPUT", "input_type_" + i.ToString())); m_parser_type = (PARSER_TYPE)Int32.Parse(device.readConfigString("CONFIG_ORDER_INPUT", "input_type_" + i.ToString())); } } } //m_parser_type = _parser_type; }
private void onDataReceivedSerialPort(object sender, SerialDataReceivedEventArgs e) { Utility.Utility.LogWrite("onDataReceivedSerialPort1"); lock (m_recv_lock) { Utility.Utility.LogWrite("onDataReceivedSerialPort2"); System.Array.Clear(m_recv_buf, 0, m_recv_buf.Length); int total_read_len = 0; int read_len = 0; Utility.Utility.LogWrite("첫 m_serial_port.BytesToRead : " + m_serial_port.BytesToRead); while (m_serial_port.BytesToRead > 0) { Utility.Utility.LogWrite("BytesToRead : " + m_serial_port.BytesToRead); Utility.Utility.LogWrite("onDataReceivedSerialPort3"); read_len = ((total_read_len + m_serial_port.BytesToRead) < m_recv_buf.Length ? m_serial_port.BytesToRead : (m_recv_buf.Length - total_read_len)); m_serial_port.Read(m_recv_buf, total_read_len, read_len); ModelAppDevice device = new ModelAppDevice(); device.writeConfigString("TEMP_PORTNAME", "temp_portName", m_serial_port.PortName); Utility.Utility.LogWrite("리드 직후 m_recv_buf : " + EncodingToStringFitness(CheckSender(), m_recv_buf)); Utility.Utility.LogWrite("리드 직후 m_recv_buf 출력 횟수 : " + (++count3) + " _read_buf.Length : " + m_recv_buf.Length + " total_read_len : " + total_read_len + " read_len : " + read_len); ByteArrayToFile(Environment.GetLogicalDrives().ElementAt(0) + @"\CallPass_log\OriginalBinary.txt", m_recv_buf); Utility.Utility.LogWrite("onDataReceivedSerialPort4"); total_read_len += read_len; Utility.Utility.LogWrite("read_len : " + read_len + " total_read_len : " + total_read_len); } // 받은 데이터 중 처리할(시작,종료) 프로토톨로 찾아서 받은 버퍼에 저장 해 둔다. onReceivedData(m_recv_buf, 0, total_read_len); } }
// ---------------------------------------------------------- // public void connectSerialPorts() { // ---------------------------------- // disconnect disconnectSerialPorts(); Utility.Utility.LogWrite("connectSerialPorts"); // ---------------------------------- // input config if (null == m_pool_input_config) { m_pool_input_config = new PoolConfigOrderInput(Kons.ShopCallpass.AppMain.AppCore.ORDER_INPUT_CONFIG_COUNT); } m_pool_input_config.loadObjectAll(); // connect to order-input port m_order_input_listen_serial_port_list = new SerialPortOrderInput[m_pool_input_config.COUNT]; for (int i = 0; i < m_order_input_listen_serial_port_list.Length; i++) { try { ObjConfigOrderInput input_config = m_pool_input_config.getObject(i); if (null != input_config && input_config.IS_USE) { int input_type = Kons.Utility.KnUtil.parseInt32(input_config.m_input_type); Utility.Utility.LogWrite("input_type : " + input_type); ParserOrderInputBase parser = null; switch (ParserOrderInputBase.obtainParserType(input_type)) { case ParserOrderInputBase.PARSER_TYPE.BAEMIN: parser = new ParserOrderInputCommon(); break; case ParserOrderInputBase.PARSER_TYPE.OKPOS: parser = new ParserOrderInputCommon(); break; case ParserOrderInputBase.PARSER_TYPE.DELGEN: parser = new ParserOrderInputCommon(); break; case ParserOrderInputBase.PARSER_TYPE.POSFEED: parser = new ParserOrderInputCommon(); break; case ParserOrderInputBase.PARSER_TYPE.EASYPOS: parser = new ParserOrderInputCommon(); break; case ParserOrderInputBase.PARSER_TYPE.YOGIYO: parser = new ParserOrderInputCommon(); break; case ParserOrderInputBase.PARSER_TYPE.BEDALTONG: parser = new ParserOrderInputCommon(); break; case ParserOrderInputBase.PARSER_TYPE.ETC: parser = new ParserOrderInputCommon(); break; } // 입력포트 시작 - 읽기(listen) 대기 포트번호를 가지고 열어둔다 m_order_input_listen_serial_port_list[i] = new SerialPortOrderInput(input_config.m_listen_port_num, input_config.m_listen_port_baud, parser, input_config.m_conn_print_port_num); Utility.Utility.LogWrite("parser : " + parser); m_order_input_listen_serial_port_list[i].Notify += onNotifyOrderInputSerialPort; m_order_input_listen_serial_port_list[i].connectSerialPort(); Utility.Utility.LogWrite("가즈아!!"); // dictionary m_dic_order_input_listen_serial_port.Add(input_config.m_listen_port_num, m_order_input_listen_serial_port_list[i]); // count m_connected_input_port_count++; } } catch (Exception err) { Utility.Utility.LogWrite("connectSerialPorts여기서 예외 발생함 : " + err.Message); ModelAppDevice device = new ModelAppDevice(); device.writeLog(err.Message); } } }
public static void Main() { //TCP #region //TcpClient client = null; //try //{ // //한글처리를 위한 인코딩 // Encoding encode = Encoding.GetEncoding("KS_C_5601-1987"); // //TcpClient를 이용하여 서버의 5001번 포트로 접속 // client = new TcpClient(); // client.Connect("localhost", 5001); // NetworkStream stream = client.GetStream(); // StreamReader readerStream = new StreamReader(stream, encode); // string sendstr = ""; // byte[] senddata = new byte[200]; // ClientHandler1 cHandler = new ClientHandler1(); // //서버로 부터 날아오는 메세지 처리를 위한 쓰레드 생성 // //계속 대기해야 하므로 쓰레드로 처리 // Thread clientThread = new Thread(new ThreadStart(cHandler.runClient)); // clientThread.Start(); // cHandler.readerStream = readerStream; //} //catch (Exception ex) //{ // Console.WriteLine(ex.ToString()); //} //finally //{ // //client.Close(); //} #endregion DownloadCheck(); OperatingSystem os = System.Environment.OSVersion; Version v = os.Version; Utility.LogWrite("major : " + v.Major + " minor : " + v.Minor); if (fileLocate == null) { try { if (Environment.Is64BitOperatingSystem) { Utility.LogWrite("com0com download version windows 64bit"); WebClient myWebClient = new WebClient(); myWebClient.DownloadFile("http://175.198.102.230:8016/bServer/res/b2b/Windows7-64bit.exe.exe", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Windows7-64bit.exe"); Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Windows7-64bit.exe"); } else { Utility.LogWrite("com0com download version windows 32bit"); WebClient myWebClient = new WebClient(); myWebClient.DownloadFile("http://175.198.102.230:8016/bServer/res/b2b/Windows7-32bit.exe.exe", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Windows7-32bit.exe"); Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Windows7-32bit.exe"); } } catch (Exception e) { Utility.LogWrite("com0com zone exception : " + e.Message); } } else { Utility.LogWrite("com0com 설치되어 있음."); } Utility.LogWrite("complete com0com"); ModelAppDevice device = new ModelAppDevice(); string pa = Application.StartupPath + "Kons.ShopCallpass_cfg.ini"; Utility.LogWrite(pa); // ini파일 있는지 체크 후 없으면 초기화 if (!File.Exists(Application.StartupPath + @"\Kons.ShopCallpass_cfg.ini")) { Utility.LogWrite("구성파일 초기화"); device.writeConfigString("v1.0", "", ""); device.writeConfigString("APP_VERSION", "app_version", Kons.ShopCallpass.AppMain.AppCore.Instance.getAppVersion().ToString()); device.writeConfigLong("CONFIG_ORDER_INPUT", "is_enroll_bemin", 1); device.writeConfigLong("CONFIG_ORDER_INPUT", "is_enroll_yogiyo", 1); device.writeConfigLong("CONFIG_ORDER_INPUT", "is_enroll_pos", 1); device.writeConfigLong("FORM_MAIN", "optimization_mode", 0); for (int i = 0; i < 4; i++) { device.writeConfigLong("CONFIG_ORDER_INPUT", "is_use_" + i.ToString(), 0); device.writeConfigLong("CONFIG_ORDER_INPUT", "is_install_" + i.ToString(), 0); device.writeConfigString("CONFIG_ORDER_INPUT", "input_type_" + i.ToString(), "99"); device.writeConfigString("CONFIG_ORDER_INPUT", "input_port_num_" + i.ToString(), "-"); device.writeConfigLong("CONFIG_ORDER_INPUT", "input_port_baud_" + i.ToString(), 9600); device.writeConfigString("CONFIG_ORDER_INPUT", "listen_port_num_" + i.ToString(), "-"); device.writeConfigLong("CONFIG_ORDER_INPUT", "listen_port_baud_" + i.ToString(), 9600); device.writeConfigString("CONFIG_ORDER_INPUT", "conn_print_port_num_" + i.ToString(), "COM1"); } for (int i = 0; i < 4; i++) { device.writeConfigLong("CONFIG_PRINT_OUTPUT", "is_use_" + i.ToString(), 0); device.writeConfigString("CONFIG_PRINT_OUTPUT", "print_connect_type_" + i.ToString(), "0"); device.writeConfigString("CONFIG_PRINT_OUTPUT", "input_port_num_" + i.ToString(), "-"); device.writeConfigLong("CONFIG_PRINT_OUTPUT", "input_port_baud_" + i.ToString(), 9600); } device.writeConfigLong("CONFIG_PRINT_OUTPUT", "is_use_usb_printer", 0); device.writeConfigString("CONFIG_PRINT_OUTPUT", "usb_printer_name", "-"); device.writeConfigString("AUTORUNNING", "auto_running", "1"); device.writeConfigString("UNWANTEDKEYWORD", "unwanted_keyword", "매장용+주방+마 감+내점"); device.writeConfigString("ORDER_NUM", "order_num", "nnnnnnnnnnnnnn+B?????????"); device.writeConfigString("COST", "cost", "n,nnn+nn,nnn+nnn,nnn+n,nnn,nnn"); device.writeConfigString("CALL_NUM", "call_num", "nn-nnn-nnnn+nn-nnnn-nnnn+nnn-nnn-nnnn+nnn-nnnn-nnnn+nnnn-nnn-nnnn+nnnn-nnnn-nnnn+nn)nnn-nnnn+nn)-nnnn-nnnn+nnn)nnn-nnnn+nnn)nnnn-nnnn+nnnn)nnn-nnnn+nnnn)nnnn-nnnn+nnnnnnnnnnnn+010nnnnnnnn+nnn-nnnnn-nnnn"); device.writeConfigString("ADDRESS", "address", "가산"); device.writeConfigString("PAYMENT_OPTION", "payment_option", "사전결제 여부: 0+사전결제 여부: O+요기요결제완료"); device.writeConfigString("ORDER_DATE", "order_date", "y/m/d T:M+y-m-d(w) T:M+y-m-d(w) T:M+y년m월d일(w) 오후T:M+y년m월d일(w) 오전T:M"); device.writeConfigString("EXCLUSIVEKEYWORD", "exclusive_keyword", "서울시 중구 세종대로39 7층+02)2054-8341+02-2054-8341+! a! a+!+2aEMB+---+서울 중구 세종대로 39+서울상공회의"); device.writeConfigString("TEMP_PORTNAME", "temp_portName", ""); device.writeConfigString("BEMINENDCHAR", "bemin_end_char", "0D1B69"); device.writeConfigString("EASYPOSENDCHAR", "easypos_end_char", "1B6D"); device.writeConfigString("YOGIYOENDCHAR", "yogiyo_end_char", "5601"); device.writeConfigString("OKPOSENDCHAR", "okpos_end_char", "1B69"); device.writeConfigString("DELGENENDCHAR", "delgen_end_char", "1B69"); device.writeConfigString("POSFEEDENDCHAR", "posfeed_end_char", "1B40"); device.writeConfigString("BEDALTONGENDCHAR", "bedaltong_end_char", "1B6D"); device.writeConfigString("ETCENDCHAR", "etc_end_char", "1B69"); device.writeConfigString("INTERVALREMOVEBINARYKEY", "interval_remove_binary_key", "2400001D7630302C~2D2D2D"); device.writeConfigString("BEMINREQUESTLINE", "bemin_request_line", "배달 요청사항:,밑,1"); device.writeConfigString("YOGIYOREQUESTLINE", "yogiyo_request_line", "연락처,밑,2"); device.writeConfigString("EASYPOSREQUESTLINE", "easypos_request_line", "#"); device.writeConfigString("DELGENREQUESTLINE", "delgen_request_line", "#"); device.writeConfigString("OKPOSREQUESTLINE", "okpos_request_line", "#"); device.writeConfigString("POSFEEDREQUESTLINE", "posfeed_request_line", "#"); device.writeConfigString("BEDALTONGREQUESTLINE", "bedaltong_request_line", "#"); device.writeConfigString("ETCREQUESTLINE", "etc_request_line", "#"); device.writeConfigString("BEMINENCODING", "bemin_encoding", "EUC-KR"); device.writeConfigString("YOGIYOENCODING", "yogiyo_encoding", "EUC-KR"); device.writeConfigString("EASYPOSENCODING", "easypos_encoding", "EUC-KR"); device.writeConfigString("DELGENENCODING", "delgen_encoding", "EUC-KR"); device.writeConfigString("OKPOSENCODING", "okpos_encoding", "EUC-KR"); device.writeConfigString("POSFEEDENCODING", "posfeed_encoding", "EUC-KR"); device.writeConfigString("BEDALTONGENCODING", "bedaltong_encoding", "EUC-KR"); device.writeConfigString("ETCENCODING", "etc_encoding", "EUC-KR"); device.writeConfigString("STOREMAPPINGCHECK", "store_mapping_check", "0"); const string ADDRESSENDCHAR = "ADDRESSENDCHAR"; device.writeConfigString(ADDRESSENDCHAR, "bemin_addr_end_char", "(도로명)"); device.writeConfigString(ADDRESSENDCHAR, "yogiyo_addr_end_char", "연락처:"); device.writeConfigString(ADDRESSENDCHAR, "easypos_addr_end_char", "a0"); device.writeConfigString(ADDRESSENDCHAR, "delgen_addr_end_char", "#"); device.writeConfigString(ADDRESSENDCHAR, "okpos_addr_end_char", "#"); device.writeConfigString(ADDRESSENDCHAR, "posfeed_addr_end_char", "#"); device.writeConfigString(ADDRESSENDCHAR, "bedaltong_addr_end_char", "#"); device.writeConfigString(ADDRESSENDCHAR, "etc_addr_end_char", "#"); const string REQUESTEXCLUSIVEKEY = "REQUESTEXCLUSIVEKEY"; device.writeConfigString(REQUESTEXCLUSIVEKEY, "bemin_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "yogiyo_request_exclusive_key", "메뉴명"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "easypos_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "delgen_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "okpos_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "posfeed_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "bedaltong_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "etc_request_exclusive_key", "#"); } else { string text = ""; int euckrCodepage = 51949; System.Text.Encoding euckr = System.Text.Encoding.GetEncoding(euckrCodepage); using (StreamReader file = new StreamReader(Application.StartupPath + @"\Kons.ShopCallpass_cfg.ini", Encoding.Default)) { string firstLine = file.ReadLine(); if (!firstLine.Contains("[v")) { string temp = file.ReadToEnd(); Console.WriteLine(temp); text = "[v1.0]\n"; text += temp; } } if (text != "") { File.WriteAllText(Application.StartupPath + @"\Kons.ShopCallpass_cfg.ini", text); device.writeConfigLong("CONFIG_ORDER_INPUT", "is_enroll_bemin", 1); device.writeConfigLong("CONFIG_ORDER_INPUT", "is_enroll_yogiyo", 1); device.writeConfigLong("CONFIG_ORDER_INPUT", "is_enroll_pos", 1); device.writeConfigLong("FORM_MAIN", "optimization_mode", 0); device.writeConfigLong("CONFIG_PRINT_OUTPUT", "is_use_usb_printer", 0); device.writeConfigString("CONFIG_PRINT_OUTPUT", "usb_printer_name", "-"); device.writeConfigString("AUTORUNNING", "auto_running", "1"); device.writeConfigString("UNWANTEDKEYWORD", "unwanted_keyword", "매장용+주방+마 감+내점"); device.writeConfigString("ORDER_NUM", "order_num", "nnnnnnnnnnnnnn+B?????????"); device.writeConfigString("COST", "cost", "n,nnn+nn,nnn+nnn,nnn+n,nnn,nnn"); device.writeConfigString("CALL_NUM", "call_num", "nn-nnn-nnnn+nn-nnnn-nnnn+nnn-nnn-nnnn+nnn-nnnn-nnnn+nnnn-nnn-nnnn+nnnn-nnnn-nnnn+nn)nnn-nnnn+nn)-nnnn-nnnn+nnn)nnn-nnnn+nnn)nnnn-nnnn+nnnn)nnn-nnnn+nnnn)nnnn-nnnn+nnnnnnnnnnnn+010nnnnnnnn+nnn-nnnnn-nnnn"); device.writeConfigString("ADDRESS", "address", "가산"); device.writeConfigString("PAYMENT_OPTION", "payment_option", "사전결제 여부: 0+사전결제 여부: O+요기요결제완료"); device.writeConfigString("ORDER_DATE", "order_date", "y/m/d T:M+y-m-d(w) T:M+y-m-d(w) T:M+y년m월d일(w) 오후T:M+y년m월d일(w) 오전T:M"); device.writeConfigString("EXCLUSIVEKEYWORD", "exclusive_keyword", "서울시 중구 세종대로39 7층+02)2054-8341+02-2054-8341+! a! a+!+2aEMB+---+서울 중구 세종대로 39+서울상공회의"); device.writeConfigString("TEMP_PORTNAME", "temp_portName", ""); device.writeConfigString("BEMINENDCHAR", "bemin_end_char", "0D1B69"); device.writeConfigString("EASYPOSENDCHAR", "easypos_end_char", "1B6D"); device.writeConfigString("YOGIYOENDCHAR", "yogiyo_end_char", "5601"); device.writeConfigString("OKPOSENDCHAR", "okpos_end_char", "1B69"); device.writeConfigString("DELGENENDCHAR", "delgen_end_char", "1B69"); device.writeConfigString("POSFEEDENDCHAR", "posfeed_end_char", "1B40"); device.writeConfigString("BEDALTONGENDCHAR", "bedaltong_end_char", "1B6D"); device.writeConfigString("ETCENDCHAR", "etc_end_char", "1B69"); device.writeConfigString("INTERVALREMOVEBINARYKEY", "interval_remove_binary_key", "2400001D7630302C~2D2D2D"); device.writeConfigString("BEMINREQUESTLINE", "bemin_request_line", "배달 요청사항:,밑,1"); device.writeConfigString("YOGIYOREQUESTLINE", "yogiyo_request_line", "연락처,밑,2"); device.writeConfigString("EASYPOSREQUESTLINE", "easypos_request_line", "#"); device.writeConfigString("DELGENREQUESTLINE", "delgen_request_line", "#"); device.writeConfigString("OKPOSREQUESTLINE", "okpos_request_line", "#"); device.writeConfigString("POSFEEDREQUESTLINE", "posfeed_request_line", "#"); device.writeConfigString("BEDALTONGREQUESTLINE", "bedaltong_request_line", "#"); device.writeConfigString("ETCREQUESTLINE", "etc_request_line", "#"); device.writeConfigString("BEMINENCODING", "bemin_encoding", "EUC-KR"); device.writeConfigString("YOGIYOENCODING", "yogiyo_encoding", "EUC-KR"); device.writeConfigString("EASYPOSENCODING", "easypos_encoding", "EUC-KR"); device.writeConfigString("DELGENENCODING", "delgen_encoding", "EUC-KR"); device.writeConfigString("OKPOSENCODING", "okpos_encoding", "EUC-KR"); device.writeConfigString("POSFEEDENCODING", "posfeed_encoding", "EUC-KR"); device.writeConfigString("BEDALTONGENCODING", "bedaltong_encoding", "EUC-KR"); device.writeConfigString("ETCENCODING", "etc_encoding", "EUC-KR"); device.writeConfigString("STOREMAPPINGCHECK", "store_mapping_check", "0"); const string ADDRESSENDCHAR = "ADDRESSENDCHAR"; device.writeConfigString(ADDRESSENDCHAR, "bemin_addr_end_char", "(도로명)"); device.writeConfigString(ADDRESSENDCHAR, "yogiyo_addr_end_char", "연락처:"); device.writeConfigString(ADDRESSENDCHAR, "easypos_addr_end_char", "a0"); device.writeConfigString(ADDRESSENDCHAR, "delgen_addr_end_char", "#"); device.writeConfigString(ADDRESSENDCHAR, "okpos_addr_end_char", "#"); device.writeConfigString(ADDRESSENDCHAR, "posfeed_addr_end_char", "#"); device.writeConfigString(ADDRESSENDCHAR, "bedaltong_addr_end_char", "#"); device.writeConfigString(ADDRESSENDCHAR, "etc_addr_end_char", "#"); const string REQUESTEXCLUSIVEKEY = "REQUESTEXCLUSIVEKEY"; device.writeConfigString(REQUESTEXCLUSIVEKEY, "bemin_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "yogiyo_request_exclusive_key", "메뉴명"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "easypos_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "delgen_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "okpos_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "posfeed_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "bedaltong_request_exclusive_key", "#"); device.writeConfigString(REQUESTEXCLUSIVEKEY, "etc_request_exclusive_key", "#"); } Utility.LogWrite("구성파일 이미 설치되어 있음"); } if (device.readConfigLong("STOREMAPPINGCHECK", "store_mapping_check") == 1) { string company_type = device.readConfigString("CONFIG_LAST_DELIVERY_REQUEST_INFO", "delivery_company_type"); string store_pno = device.readConfigString("CONFIG_STORE_API_INFO", "store_pno_" + company_type); string store_name = device.readConfigString("CONFIG_STORE_API_INFO", "store_name_" + company_type); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("store_name", store_name); dic.Add("store_pno", store_pno); FormFile f1 = new FormFile(); //f1.Name = store_name + store_pno; f1.Name = "iniFile"; f1.FilePath = "Kons.ShopCallpass_cfg.ini"; f1.ContentType = "text/ini"; f1.Stream = null; dic.Add("iniFile", f1); FormFile f2 = new FormFile(); f2.Name = "binaryFile"; f2.FilePath = @"C:\CallPass_log\OriginalBinary.txt"; f2.ContentType = "text/txt"; f2.Stream = null; dic.Add("binaryFile", f2); FormFile f3 = new FormFile(); f3.Name = "CallpassLog"; f3.FilePath = @"C:\CallPass_log\CallpassLog.log"; f3.ContentType = "text/log"; f3.Stream = null; dic.Add("CallpassLog", f3); try { string returnStr = PostMultipart("http://175.198.102.230:8016/bServer/moaBtwoB/versionCehck.do", dic); //string returnStr = PostMultipart("http://*****:*****@"\CallPass_log\CallpassLog.log")) { File.Delete(Environment.GetLogicalDrives().ElementAt(0) + @"\CallPass_log\CallpassLog.log"); } if (File.Exists(Environment.GetLogicalDrives().ElementAt(0) + @"\CallPass_log\OriginalBinary.txt")) { File.Delete(Environment.GetLogicalDrives().ElementAt(0) + @"\CallPass_log\OriginalBinary.txt"); } // ------------------------ DevExpress enviroment BonusSkins.Register(); SkinManager.EnableFormSkins(); SkinManager.EnableMdiFormSkins(); //UserLookAndFeel.Default.SetSkinStyle("Office 2010 Blue"); // DevExpress Style, Office 2013, VS2010, Office 2010 Blue, Office 2013 // AppConfig 파일 참조 UserLookAndFeel.Default.SetSkinStyle("Visual Studio 2013 Blue"); // 전체 폰트 지정 DevExpress.XtraEditors.WindowsFormsSettings.DefaultFont = new Font("Gulim", 9F); // 스타일 Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ApplicationExit += new EventHandler(ExApplicationExit); // 시작 Application.Run(Kons.ShopCallpass.AppMain.AppCore.Instance.initInstance()); }
private void ctr_btn_req_store_del_Click(object sender, EventArgs e) { String req_store_pno = ctr_tbx_store_pno.Text.Trim().Replace("-", ""); if (0 >= req_store_pno.Length) { FormPopupNotify.Show(this.Owner, "먼저 사업자번호를 입력 해 주십시오.", "알림"); return; } // 이미매핑되어 있는지 확인 if (0 == m_store_reg_info.m_store_id.Length) { FormPopupNotify.Show(this.Owner, "해제할 매핑정보가 없습니다.", "알림"); return; } else { if (DialogResult.Yes != MessageBox.Show(this.Owner, "이미 설정하신 매핑정보를 해제 하시겠습니까? \r\n해제 시 해당 주문연동이 중지됩니다.", "확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { return; } } // 매핑해제 요청 ObjApiReqStoreDelResult res_store_del = requestShopDel(m_store_api_info.m_store_pno, m_store_reg_info.m_store_id); if (null == res_store_del) { FormPopupNotify.Show(this.Owner, "상점 매핑해제 요청 중 알수 없는 오류가 발생 하였습니다.", "알림"); return; } if (0 == res_store_del.m_ret_cd && 0 < res_store_del.m_store_id.Length) { m_store_api_info.deleteOnDevice(); m_store_api_info.initObj(); m_store_reg_info.deleteOnDevice(); m_store_reg_info.initObj(); ModelAppDevice device = new ModelAppDevice(); device.writeConfigString("STOREMAPPINGCHECK", "store_mapping_check", "0"); FormPopupNotify.Show(this.Owner, "매핑해제 성공하였습니다. 확인 해 주십시오.", "알림"); } else if (0 < res_store_del.m_ret_msg.Length) { FormPopupNotify.Show(this.Owner, res_store_del.m_ret_msg, "알림"); return; } else { switch (res_store_del.m_ret_cd) { case 1: FormPopupNotify.Show(this.Owner, "인증키가 잘못되었습니다. ( 인증키 오류 )", "알림"); return; case 2: FormPopupNotify.Show(this.Owner, "상점코드가 중복등록 되었습니다. ( 상점 코드 중복 )", "알림"); return; } } // set control setDlgObjectDataToControls(); }
// 시작문자를 찾아서 이후부터 저장버퍼에 저장한다. // 시작을 했다면 종료문자를 찾아서 메시지 보내고 이후 앞 부분을 저장 해 둔다 private int saveReadData(byte[] _read_buf, int _read_offset, int _read_length) { Utility.Utility.LogWrite("saveReadData"); int copy_offset = 0; Utility.Utility.LogWrite("saveReadData _read_buf : \n" + EncodingToStringFitness(CheckSender(), _read_buf) + "\n"); Utility.Utility.LogWrite("saveReadData _read_buf 출력 횟수 : " + (++count) + " _read_buf.Length : " + _read_buf.Length + " _read_length : " + _read_length); ModelAppDevice device = new ModelAppDevice(); string val = device.readConfigString("TEMP_PORTNAME", "temp_portName"); int inputType = 0; for (int i = 0; i < 4; i++) { if (val.Equals(device.readConfigString("CONFIG_ORDER_INPUT", "listen_port_num_" + i.ToString()))) { inputType = Int32.Parse(device.readConfigString("CONFIG_ORDER_INPUT", "input_type_" + i.ToString())); } } Utility.Utility.LogWrite("inputType : " + inputType); int index = 0; switch (inputType) { case 10: index = 0; break; case 21: index = 4; break; case 26: index = 3; break; case 27: index = 5; break; case 31: index = 2; break; case 32: index = 1; break; case 33: index = 6; break; case 98: index = 7; break; } string str = device.readConfigString(CONFIG_SECTION[index], keyValues[index]); Utility.Utility.LogWrite("str : " + str); PROTOCOL_EOD = ConvertByteArray(str); Utility.Utility.LogWrite("PROTOCOL_EOD: " + PROTOCOL_EOD); PROTOCOL_TMP = new byte[PROTOCOL_EOD.Length]; bool is_receive_eod = false; int copy_length = 0; Utility.Utility.LogWrite("isWaitDataEnd() : " + isWaitDataEnd()); if (isWaitDataEnd()) { copy_length += PROTOCOL_SOD.Length; // 시작문자 부분은 건너뛰고 검색을 시작하므로 아래 +1 이 안되는 부분이기 때문에 먼저 대해준다. int isOptimizationMode = device.readConfigLong("FORM_MAIN", "optimization_mode"); for (int i = (copy_offset + PROTOCOL_SOD.Length); i < (_read_length - PROTOCOL_EOD.Length + 1); i++) { Array.Copy(_read_buf, _read_offset + i, PROTOCOL_TMP, 0, PROTOCOL_TMP.Length); if (isOptimizationMode == 0) { //log지우면안됨!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Utility.Utility.LogWrite("PROTOCOL_TMP:" + ConvertByteToHexString(PROTOCOL_TMP) + " eod:" + ConvertByteToHexString(PROTOCOL_EOD)); } if (PROTOCOL_TMP.SequenceEqual(PROTOCOL_EOD)) { is_receive_eod = true; copy_length += PROTOCOL_TMP.Length; Utility.Utility.LogWrite("끝문자 i위치 : " + i); Utility.Utility.LogWrite("기타 파서 전용 이프문"); break; } copy_length += 1; } Utility.Utility.LogWrite("끝문자체크is_receive_eod : " + is_receive_eod); if (!is_receive_eod) // 못찾았으면 검색한 길이만큼 더해 준다 { copy_length += (PROTOCOL_EOD.Length - 1); } } else { is_receive_eod = true; // 종료를 찾는 것이 아니면 받은만큼이 종료이기 때문에... copy_length = _read_length; } Utility.Utility.LogWrite("copy_length > (m_save_buf.Length - m_save_len) : " + (copy_length > (m_save_buf.Length - m_save_len))); // 복사할 버퍼의 남은크기 확인 if (copy_length > (m_save_buf.Length - m_save_len)) { resetSaveBuf(); // 버퍼가 가득찬 경우 받은것을 파기한다. return(copy_offset + copy_length); } // 복사할 길이를 찾아서 저장 버퍼에 복사한다. System.Array.Copy(_read_buf, _read_offset + copy_offset, m_save_buf, m_save_len, copy_length); m_save_len += copy_length; Utility.Utility.LogWrite("m_save_buf : " + EncodingToStringFitness(CheckSender(), m_save_buf)); Utility.Utility.LogWrite("m_save_len : " + m_save_len); Utility.Utility.LogWrite("m_save_buf 출력 횟수 : " + (++count2) + " m_save_buf.Length : " + m_save_buf.Length + " m_save_len : " + m_save_len); Utility.Utility.LogWrite("is_receive_eod : " + is_receive_eod); // 상위로 메시지 보내고 버퍼 초기화 if (is_receive_eod) { Utility.Utility.LogWrite("m_parser : " + m_parser); if (null != m_parser) { string tmp = device.readConfigString("UNWANTEDKEYWORD", "unwanted_keyword"); Utility.Utility.LogWrite("tmp : " + tmp); string[] exclusivePatterns = tmp.Split('+'); Utility.Utility.LogWrite("exclusivePatterns.Length : " + exclusivePatterns.Length); for (int i = 0; i < exclusivePatterns.Length; i++) { Utility.Utility.LogWrite("exclusivePatterns[i] : " + exclusivePatterns[i]); } bool flag = false; for (int i = 0; i < exclusivePatterns.Length; i++) { flag = EncodingToStringFitness(CheckSender(), m_save_buf).Contains(exclusivePatterns[i]); if (flag) { break; } } ObjOrder recv_order = null; if (prevPaper != EncodingToStringFitness(CheckSender(), m_save_buf)) { Utility.Utility.LogWrite("apple"); if (!flag) { Utility.Utility.LogWrite("grape"); recv_order = m_parser.parsingInputOrderRawData(m_save_buf, m_save_len); } } //Utility.Utility.LogWrite("recv_order : " + recv_order); if (null != recv_order) { // 주문에 print 정보 저장 recv_order.setRawDataForPrint(m_print_output_port_num, m_save_buf, 0, m_save_len); bool isThisDataToRegister = false; Utility.Utility.LogWrite("inputType : " + inputType); switch (inputType) { case 10: if (device.readConfigLong("CONFIG_ORDER_INPUT", "is_enroll_bemin") == 1) { isThisDataToRegister = true; Utility.Utility.LogWrite("배민꺼 : " + inputType); } break; case 32: if (device.readConfigLong("CONFIG_ORDER_INPUT", "is_enroll_yogiyo") == 1) { isThisDataToRegister = true; Utility.Utility.LogWrite("요기요꺼 : " + inputType); } break; default: if (device.readConfigLong("CONFIG_ORDER_INPUT", "is_enroll_pos") == 1) { isThisDataToRegister = true; Utility.Utility.LogWrite("포스기 : " + inputType); } break; } if (isThisDataToRegister && prevPaper != EncodingToStringFitness(CheckSender(), m_save_buf)) { if (!flag) { Utility.Utility.LogWrite("가나다라"); prevPaper = EncodingToStringFitness(CheckSender(), m_save_buf); sendMyNotify(SERIAL_PORT_NOTIFY_WHAT.ORDER_OBJECT, recv_order); } } } } if (device.readConfigString("CONFIG_PRINT_OUTPUT", "is_use_usb_printer") == "1") { ByteArrayToFile(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\saveBuf" + (count4++).ToString() + ".txt", m_save_buf); } // 받은길이 초기화 resetSaveBuf(); } // 처리한 메시지 길이 반환 return(copy_offset + copy_length); }