private void InputBox_TextChanged(object sender, TextChangedEventArgs e) { int caret = InputBox.SelectionStart; switch ((Language)LanguageOption.SelectedIndex) { case CoptLib.Language.Coptic: InputBox.Text = CopticInterpreter.ConvertFont(InputBox.Text, CopticFont.CsAvvaShenouda, CopticFont.CopticUnicode); break; } InputBox.SelectionStart = caret; }
static void Main(string[] args) { string logPath = @"C:\Users\jjask\Desktop\log.txt"; Console.OutputEncoding = System.Text.Encoding.Unicode; var parameters = ParseArgs(args); CopticFont sourceFont = CopticFont.CsAvvaShenouda; CopticFont targetFont = CopticFont.CopticUnicode; if (parameters.ContainsKey("source-font")) { sourceFont = CopticFont.Fonts.Find((f) => f.Name == parameters["source-font"]); } if (parameters.ContainsKey("target-font")) { targetFont = CopticFont.Fonts.Find((f) => f.Name == parameters["target-font"]); } string output = ""; if (parameters.ContainsKey("source-txt")) { try { output = CopticInterpreter.ConvertFont( File.ReadAllText(parameters["source-file"]), sourceFont, targetFont ); } catch (FileNotFoundException) { Console.Error.WriteLine("Unable to read the source file"); } } else if (parameters.ContainsKey("")) { output = CopticInterpreter.ConvertFont( parameters[""], sourceFont, targetFont ); } else if (parameters.ContainsKey("source-csv")) { try { // Get the column to convert int columnNum = 0; if (parameters.ContainsKey("csv-column")) { columnNum = Int32.Parse(parameters["csv-column"]); } // Read the specified column List <string> inputText = new List <string>(); var table = ReadCsvFile(parameters["source-csv"]); foreach (List <string> row in table) { inputText.Add(row[columnNum]); } // Convert each line foreach (string input in inputText) { output += CopticInterpreter.ConvertFont( input, sourceFont, targetFont ); output += "\r\n"; } } catch (FileNotFoundException) { Console.Error.WriteLine("Unable to read the source file"); } } Console.WriteLine(output); File.WriteAllText(logPath, output, System.Text.Encoding.Unicode); }
/// <summary> /// Initializes the specified key /// </summary> /// <param name="btn">The key to initialize</param> /// <param name="keytype">Language to load: eng / copt / arabic + ":sft"</param> /// <param name="index"></param> private void InitKey(Button btn, Language language, bool shift, int index) { switch (language) { #region English case CoptLib.Language.English: if (shift) { if (EnglishSft[index] != null) { btn.Visibility = Visibility.Visible; btn.Content = EnglishSft[index]; } else { btn.Visibility = Visibility.Collapsed; } } else { if (English[index] != null) { btn.Visibility = Visibility.Visible; btn.Content = English[index]; } else { btn.Visibility = Visibility.Collapsed; } } return; #endregion #region Coptic case CoptLib.Language.Coptic: if (shift) { if (CopticSft[index] != null) { btn.Visibility = Visibility.Visible; btn.Content = CopticInterpreter.ConvertFont(EnglishSft[index], CopticFont.CsAvvaShenouda, CopticFont.CopticUnicode); } else { btn.Visibility = Visibility.Collapsed; } } else { if (Coptic[index] != null) { btn.Visibility = Visibility.Visible; var vals = CopticFont.CopticUnicode.Charmap.Values.ToList(); btn.Content = CopticInterpreter.ConvertFont(English[index], CopticFont.CsAvvaShenouda, CopticFont.CopticUnicode); } else { btn.Visibility = Visibility.Collapsed; } } return; #endregion #region Arabic case CoptLib.Language.Arabic: if (!shift) { if (ArabicSft[index] != null) { btn.Visibility = Visibility.Visible; btn.Content = ArabicSft[index]; } else { btn.Visibility = Visibility.Collapsed; } } else { if (Arabic[index] != null) { btn.Visibility = Visibility.Visible; btn.Content = Arabic[index]; } else { btn.Visibility = Visibility.Collapsed; } } return; #endregion } }