Ejemplo n.º 1
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.º 2
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);
            }
        }