// -------------------------------------- // 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); }
// ---------------------------------------------------------- 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); }
// ---------------------------------------------------------- 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); } }
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); }
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; }
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 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); }