Ejemplo n.º 1
0
        private void btn_Tran_Click(object sender, EventArgs e)
        {
            txtHiddenCount.Text = string.Empty;
            txtHiddenKey.Text   = string.Empty;
            errMsg = new List <string>();
            Input  = txt_Input.Text;

            #region - 字串檢核 -
            try
            {
                try
                {
                    richtxt_Output.Text = Input.Replace(@"""", @"\""");
                    resetFocus();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(SystemMsg.format(ex.Message));
            }
            #endregion
        }
Ejemplo n.º 2
0
 private void btn_Compress_Click(object sender, EventArgs e)
 {
     txtHiddenCount.Text = string.Empty;
     txtHiddenKey.Text   = string.Empty;
     try {
         richtxt_Output.Text = Compress(txt_Input.Text);
         resetFocus();
     }
     catch (Exception ex) {
         MessageBox.Show(SystemMsg.serializer(ex.Message));
     }
 }
Ejemplo n.º 3
0
        private void btn_toJson_Click(object sender, EventArgs e)
        {
            txtHiddenCount.Text = string.Empty;
            txtHiddenKey.Text   = string.Empty;
            errMsg = new List <string>();
            Input  = txt_Input.Text;

            #region - 字串檢核 -
            try
            {
                Input = Setting.ReplaceExtra(Input);
                //排版字符
                if (!string.IsNullOrWhiteSpace(txt_Split.Text))
                {
                    Input = Input.Replace(txt_Split.Text, string.Concat(txt_Split.Text, Setting.LINE));
                }
                if (Input.IndexOf("{") > -1)
                {
                    try
                    {
                        richtxt_Output.Text = PraseToJson(Input);
                        //dll 問題
                        //var jsonObj = JsonConvert.DeserializeObject(Input);
                        //richtxt_Output.Text = JsonConvert.SerializeObject(jsonObj, Newtonsoft.Json.Formatting.Indented);
                    }
                    catch
                    {
                        richtxt_Output.Text = Input;
                    }
                }
                else
                {
                    try
                    {
                        string _formatStr = FormatXml(Input);
                        richtxt_Output.Text = _formatStr.Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>", "");
                    } catch {
                        richtxt_Output.Text = Input;
                    }
                }
                resetFocus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(SystemMsg.format(ex.Message));
            }
            #endregion
        }
Ejemplo n.º 4
0
        private void Export(ExportType type)
        {
            string action = "匯出";

            try {
                string txtPath = string.Concat(@"E:\Data\Desktop\", txt_ExportName.Text, ".", type.ToString());

                using (StreamWriter sw = new StreamWriter(txtPath))
                {
                    sw.Write(richtxt_Output.Text);
                }
                MessageBox.Show(SystemMsg.succeed(action));
            } catch (Exception ex) {
                MessageBox.Show(SystemMsg.fail(action, ex.ToString()));
            }
        }
Ejemplo n.º 5
0
 private void btn_DeCompress_Click(object sender, EventArgs e)
 {
     txtHiddenCount.Text = string.Empty;
     txtHiddenKey.Text   = string.Empty;
     try {
         string _decompressStr = Decompress(txt_Input.Text);
         _decompressStr      = Setting.ReplaceExtra(_decompressStr);
         _decompressStr      = FormatXml(_decompressStr);
         richtxt_Output.Text = _decompressStr.Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>", "");
         resetFocus();
     }
     catch (Exception ex)
     {
         MessageBox.Show(SystemMsg.serializer(ex.Message));
     }
 }
Ejemplo n.º 6
0
 private void myClick(object sender, EventArgs e)
 {
     try
     {
         richTxt_Output.SelectionColor = Color.YellowGreen;
         richTxt_Output.Text           = formatDate(((Button)sender).AccessibleName);
         //StringFormat(((Button)sender).AccessibleName);
         SetRichTextBoxColor(richTxt_Output);
         lbl_Name.Text          = ((Button)sender).Text;
         richTxt_Output.Visible = true;
         SetLocation(panel_Btn);
     }
     catch (Exception ex)
     {
         MessageBox.Show(SystemMsg.exception(ex.ToString()));
     }
 }
Ejemplo n.º 7
0
        private void btn_Trans_Click(object sender, EventArgs e)
        {
            string action = "匯出";

            //E:\Data\Desktop\1602771667677_GTZXXE_YEHCHIAYUMR.rtf
            try
            {
                string path        = txt_Path.Text;
                string fileContent = FileToString(txt_Path.Text); //轉64

                //匯出成txt
                string txtPath = string.Concat(txt_Path.Text.Split('.')[0], ".txt");
                using (StreamWriter sw = new StreamWriter(txtPath))
                {
                    sw.Write(fileContent);
                }
                lbl_output.Text = SystemMsg.succeed(action);
            }
            catch (Exception ex) {
                lbl_output.Text = SystemMsg.fail(action, ex.Message);
            }
        }
Ejemplo n.º 8
0
        private void MongoForm_Load(object sender, EventArgs e)
        {
            Menu menu = new Menu(menu_panel, this);

            menu.drawButton();
            try
            {
                //Step 1.取得檔案
                List <JsonPara> _menu       = new List <JsonPara>();
                string          FilePath    = @"../doc/MongoJson.txt";
                string          _strFromtxt = string.Empty;
                using (StreamReader sr = new StreamReader(FilePath, Encoding.Default))
                {
                    string line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        _strFromtxt += line;
                    }
                }
                _menu = JsonConvert.DeserializeObject <List <JsonPara> >(_strFromtxt);
                _menu = _menu.OrderBy(o => o.Orderby).ToList(); //Order By


                //Step 2.處理BTN
                showOnPanel(_menu);

                //其他有的沒的
                btn_Copy.FlatAppearance.BorderSize = 0;
                //btn_Copy.BackgroundImageLayout = ImageLayout.None;
                btn_Copy.FlatStyle = FlatStyle.Flat;
            }
            catch (Exception ex)
            {
                MessageBox.Show(SystemMsg.serializer(ex.ToString()));
            }
        }