예제 #1
0
 internal string getTranslationTable(Language brailleLanguage, BrailleContraction brailleContraction, BrailleFormat dots)
 {
     List<String> tables = GetTranslationTables();
     string contractionTable = "", eightDotTable = "";
     string searchContraction = "", searchDots = "8";
     switch (brailleContraction)
     {
         case BrailleContraction.grade0: searchContraction = "g0"; break;
         case BrailleContraction.grade1: searchContraction = "g1"; break;
         case BrailleContraction.grade2: searchContraction = "g2"; break;
         default: break;
     }
     string[] langTables = this.tableMapping[brailleLanguage];
     if (langTables.Length == 1)
         contractionTable = langTables[0];
     else
         foreach (string s in langTables)
         {
             if (dots.Equals(BrailleFormat.eightdot) && s.ToLowerInvariant().Contains(searchDots))
                 eightDotTable = s;
             if (s.ToLowerInvariant().Contains(searchContraction))
             {
                 if (tables.Contains(s))
                     contractionTable = s;
             }
             else contractionTable = langTables[0];
         }
     if (eightDotTable != "" && !contractionTable.Contains(searchDots))
         return contractionTable + ", " + eightDotTable;
     else
         return contractionTable;
 }
예제 #2
0
        internal string getTranslationTable(Language brailleLanguage, BrailleContraction brailleContraction, BrailleFormat dots)
        {
            List <String> tables = GetTranslationTables();
            string        contractionTable = "", eightDotTable = "";
            string        searchContraction = "", searchDots = "8";

            switch (brailleContraction)
            {
            case BrailleContraction.grade1: searchContraction = "g1"; break;

            case BrailleContraction.grade2: searchContraction = "g2"; break;

            default: break;
            }
            string[] langTables = tableMapping[brailleLanguage];
            if (langTables.Length == 1)
            {
                contractionTable = langTables[0];
            }
            else
            {
                foreach (string s in langTables)
                {
                    if (dots.Equals(BrailleFormat.eightdot) && s.ToLowerInvariant().Contains(searchDots))
                    {
                        eightDotTable = s;
                    }
                    if (s.ToLowerInvariant().Contains(searchContraction))
                    {
                        if (tables.Contains(s))
                        {
                            contractionTable = s;
                        }
                    }
                    else
                    {
                        contractionTable = langTables[0];
                    }
                }
            }
            if (eightDotTable != "" && !contractionTable.Contains(searchDots))
            {
                return(contractionTable + ", " + eightDotTable);
            }
            else
            {
                return(contractionTable);
            }
        }