예제 #1
0
        private static CyrResult DeclineIgnoreSuffix(CyrPhrase decliner, string phrase, params string[] ignoreSuffixesStart)
        {
            int openSymbolIndex = phrase.IndexOfAny(ignoreSuffixesStart);

            if (openSymbolIndex == -1)
            {
                return(CaseTools.Decline(decliner, phrase));
            }

            string parenthesisExpr       = phrase.Substring(openSymbolIndex, phrase.Length - openSymbolIndex);
            string parenthesisLessPhrase = phrase.Remove(openSymbolIndex, phrase.Length - openSymbolIndex);

            CyrResult result = CaseTools.Decline(decliner, parenthesisLessPhrase);

            if (result == null)
            {
                return(null);
            }

            foreach (CasesEnum labelCase in Enum.GetValues(typeof(CasesEnum)))
            {
                result.Set(labelCase, result.Get(labelCase) + parenthesisExpr);
            }

            return(result);
        }
예제 #2
0
        private static void ReadDeclination(CyrResult declinationResult)
        {
            int cursorPos = -1;

            foreach (CasesEnum labelCase in Enum.GetValues(typeof(CasesEnum)))
            {
                Console.Write($" {labelCase,15}: ");
                declinationResult.Set(labelCase, SmartConsole.EditLine(declinationResult.Get(labelCase), cursorPos, out cursorPos));
            }
        }