예제 #1
0
        public void translate(ref ProgressBar progressBar, ref RichTextBox textUrdu, ref RichTextBox textEnglish)
        {
            arabicWords = new Stack <string>();
            outPut      = string.Empty;
            outPut     += preText;
            string[] lines = textUrdu.Text.Split('\n');

            progressBar.Value   = 0;            // Reset The progress bar to start
            progressBar.Maximum = lines.Length; // The percentage of the totel lines equal to the totel lines

            foreach (var line in lines)
            {
                if (line.Contains("\""))
                {
                    bool isLitral             = true;
                    int  const_str_start_ind  = line.IndexOf("\"") + 1;
                    int  const_str_ending_ind = line.LastIndexOf("\"");
                    outPut += "wcout";
                    for (int i = 0; i < line.Length; i++)
                    {
                        if (i > const_str_start_ind && i < const_str_ending_ind)
                        {
                            arabicWords.Push(charMap.convertUniCode(line[i]));
                        }
                        else
                        {
                            while (arabicWords.Count > 0)
                            {
                                outPut += arabicWords.Pop();
                            }
                            //string nonLitrel = string.Empty;
                            //while (outPut[i] != '"')
                            //{
                            //    nonLitrel += outPut[i];
                            //}
                            charWrap(line[i], ref isLitral);
                        }
                    }
                }
                else
                {
                    wrapWord(line);
                }
                outPut += "\n";
                progressBar.Increment(1);  //Increament in progress-barr
            }

            fileOutput = outPut;// + postText;
            fileOutput = fileOutput.Insert(fileOutput.LastIndexOf('}'), postText);
            fileOutput = fileOutput.Insert(fileOutput.LastIndexOf('{') + 1, "\n _setmode(_fileno(stdout), _O_U16TEXT);");
            //outPut += "}";//postText;
            textEnglish.Text = outPut;
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            CharMap charmap = new CharMap();

            MessageBox.Show(charmap.convertUniCode('ا'));
        }