Esempio n. 1
0
 string PrfNormStr(string mark)
 {
     string type = string.Empty;
     pars = Lib.GetParsStr(Profile);
     switch (mark)
     {
         case "I":
             if (PrfSub("Б", "b%", "", out type)) goto OK_I;
             if (PrfSub("Б", "б%", "", out type)) goto OK_I;
             if (PrfSub("К", "k%A", "А", out type)) goto OK_I;
             if (PrfSub("К", "k%", "", out type)) goto OK_I;
             if (PrfSub("Ш", "h%", "", out type)) goto OK_I;
             if (PrfSub("Ш", "ш%", "", out type)) goto OK_I;
             if (PrfSub("Д", "d%A", "А", out type)) goto OK_I;
             if (PrfSub("У", "y%A", "А", out type)) goto OK_I;
             if (PrfSub("М", "м%", "", out type)) goto OK_I;
             if (PrfSub("С", "с%", "", out type)) goto OK_I;
             OK_I: mark += pars[0] + type;
             if (type == "" && pars.Count != 1
                 || Regex.IsMatch(type, @"\d") && pars.Count != 2) error(pars);
             break;
         case "[":
             if (PrfSub("[", "aY", "аУ", out type)) goto OK_U;
             if (PrfSub("[", "y", "У", out type)) goto OK_U;
             if (PrfSub("[", "ap", "аП", out type)) goto OK_U;
             if (PrfSub("[", "p", "П", out type)) goto OK_U;
             if (PrfSub("[", "e", "Э", out type)) goto OK_U;
             if (PrfSub("[", "l", "Л", out type)) goto OK_U;
             if (PrfSub("[", "ca", "Cа", out type)) goto OK_U;
             if (PrfSub("[", "cb", "Cб", out type)) goto OK_U;
             if (PrfSub("[", "c", "C", out type)) goto OK_U;
             OK_U: mark += pars[0] + type;
             if (pars.Count != 1) error(pars);
             break;
         case "L":
             if (pars.Count == 2) mark += pars[0] + "x" + pars[1];
             if (pars.Count == 3) mark += pars[0] + "x" + pars[1] + "x" + pars[2];
             if (pars.Count != 2 && pars.Count != 3) error(pars);
             break;
         case "—":
             if (pars.Count == 1) mark += pars[0];
             if (pars.Count == 2)
             {
                 double p0 = Lib.ToDouble(pars[0]);
                 double p1 = Lib.ToDouble(pars[1]);
                 if (p0 < p1) mark += pars[0] + "x" + pars[1];
                 else mark += pars[1] + "x" + pars[0];
             }
             break;
         case "Гн.[]":
         case "Гн.":
             if (pars.Count == 2) mark = "Гн." + pars[0] + "x" + pars[1].Replace(".0", "");
             if (pars.Count == 3)
             {
                 if(pars[0] == pars[1]) mark = "Гн." + pars[0] + "x" + pars[2].Replace(".0", "");
                 else mark = "Гн.[]" + pars[0] + "x" + pars[1] + "x" + pars[2].Replace(".0", "");
             }
             if (pars.Count != 2 && pars.Count != 3) error(pars);
             break;
         case "TK":
         case "TP":
             if(pars.Count >= 2) mark += pars[0] + "x" + pars[1];
             if (pars.Count == 3) mark += "x" + pars[2];
             if (pars.Count != 2 && pars.Count != 3) error(pars);
             break;
         case "IFC_BREP":
             if(pars.Count == 1) mark += "-" + pars[0];
             if (pars.Count > 1) error(pars);
             break;
         default: error(pars); break;
     }
     return mark;
 }