private void btnConvert_Click(object sender, EventArgs e)
 {
     if (!File.Exists(txtSrc.Text))
     {
         MessageBox.Show("File not found!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     try
     {
         using (var reader = new StreamReader(txtSrc.Text, true))
             using (var writer = new StreamWriter(txtDest.Text, false))
             {
                 if (chkLineByLine.Checked)
                 {
                     while (!reader.EndOfStream)
                     {
                         string line = reader.ReadLine();
                         line = PersianLeftToRightText.CorrectPersinRtlToDisplayLtr(line);
                         writer.WriteLine(line);
                     }
                 }
                 else
                 {
                     var file = reader.ReadToEnd();
                     file = PersianLeftToRightText.CorrectPersinRtlToDisplayLtr(file);
                     writer.Write(file);
                 }
             }
         MessageBox.Show("Convertion is done.", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #2
0
 private void txtLTR_TextChanged(object sender, EventArgs e)
 {
     txtLTRFa.Text = PersianLeftToRightText.CorrectPersinRtlToDisplayLtr(txtLTR.Text);
 }
Exemple #3
0
 void Do()
 {
     txtLTRFa.Text = PersianLeftToRightText.CorrectPersinRtlToDisplayLtr(txtRTL.Text);
     txtLTR.Text   = txtRTL.Text;
 }