Пример #1
0
        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);
        }
Пример #2
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, "프린트 포트가 중복으로 지정 되었습니다. 확인 해 주십시오.", "알림");
            }
        }
Пример #3
0
        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());
        }