コード例 #1
0
        public bool TryFormat(ref StringReader input, StringBuilder output, FormatterParams formatterParams)
        {
            if (input.current != open)
            {
                return(false);
            }
            StringReader stringReader = input.Copy();
            SubString    subString    = stringReader.ReadContent(open, close);

            subString.Trim();
            int position             = stringReader.position;
            List <IParserRule> rules = m_rules;
            int count = rules.Count;

            for (int i = 0; i < count; i++)
            {
                StringReader input2 = new StringReader(input.text);
                input2.position = subString.startIndex;
                input2.SetLimit(subString.endIndex);
                if (rules[i].TryFormat(ref input2, output, formatterParams))
                {
                    input.position = position;
                    return(true);
                }
            }
            return(false);
        }
コード例 #2
0
        private static KeywordCondition GetCondition(SubString attributes)
        {
            KeywordCondition keywordCondition = (KeywordCondition)0;

            attributes.Trim();
            StringReader stringReader = new StringReader(attributes);

            while (stringReader.hasNext)
            {
                if (stringReader.NextEquals("transfer"))
                {
                    stringReader.position += "transfer".Length;
                    keywordCondition      |= KeywordCondition.Transfer;
                }
                else if (stringReader.NextEquals("deckbuild"))
                {
                    stringReader.position += "deckbuild".Length;
                    keywordCondition      |= KeywordCondition.EditDeck;
                }
                else
                {
                    stringReader.position++;
                }
            }
            return(keywordCondition);
        }
コード例 #3
0
 private static void Append(SubString text, StringBuilder output, FormatterParams formatterParams, string value)
 {
     text.Trim();
     formatterParams.additionnalRules = new IParserRule[1]
     {
         new ReplaceNumber(value)
     };
     formatterParams.formatter.AppendFormat(text, output, formatterParams);
 }
コード例 #4
0
        string TrimParagraph(string Text)
        {
            string Paragraph = string.Empty;

            foreach (string SubString in Text.Split('\n'))
            {
                if (Paragraph != string.Empty)
                {
                    Paragraph += " ";
                }

                Paragraph += SubString.Trim();
            }

            return(Paragraph);
        }