コード例 #1
0
ファイル: ProcessorShould.cs プロジェクト: Vedmax/01-quality
 public void GetOpenTag()
 {
     var proc = new Processor("_ololo_", 0);
     var openTag = new Tag(0, "_");
     var tags = proc.FindFontTags();
     var res = proc.GetOpenTag(tags);
     Assert.AreEqual(res, openTag);
 }
コード例 #2
0
ファイル: Processor.cs プロジェクト: Vedmax/01-quality
 public string GetMissingText(int lastIndex, Tag openTag)
 {
     return Text.Substring(lastIndex ,openTag.Index - lastIndex);
 }
コード例 #3
0
ファイル: ProcessorShould.cs プロジェクト: Vedmax/01-quality
 public void NotGetInsideTag()
 {
     var proc = new Processor("ol_olo", 1);
     var openTag = new Tag(0, "_");
     var tags = proc.FindFontTags();
     var res = proc.GetOpenTag(tags);
     Assert.Null(res);
 }
コード例 #4
0
ファイル: Processor.cs プロジェクト: Vedmax/01-quality
 public void DeleteUsedTags(Tag closeTag, Queue<Tag> tags)
 {
     while (tags.Count != 0 && tags.Peek().Index <= closeTag.Index)
         tags.Dequeue();
 }
コード例 #5
0
ファイル: Processor.cs プロジェクト: Vedmax/01-quality
 public string JoinTagsAndText(Tag openTag, Tag closeTag, string substring)
 {
     return "<" + SignatureOfTags[openTag.Type] + ">" + substring + "</" + SignatureOfTags[closeTag.Type] + ">";
 }
コード例 #6
0
ファイル: Processor.cs プロジェクト: Vedmax/01-quality
 public string GetSubstringBetweenTags(Tag openTag, Tag closeTag)
 {
     var endOfOpenTag = openTag.Index + openTag.Length;
     var substr = Text.Substring(endOfOpenTag, closeTag.Index - endOfOpenTag);
     if (closeTag.Type != "`")
         substr = new Processor(substr, 1).MarkText();
     return substr;
 }
コード例 #7
0
ファイル: Processor.cs プロジェクト: Vedmax/01-quality
 public Tag GetPairTag(Tag openTag, Queue<Tag> tags)
 {
     try
     {
         return tags
             .ToList()
             .Where(x => x.Index != 0)
             .Where(x => Text[x.Index - 1] != '\\')
             .Where(x => x.Length + x.Index == Text.Length ||
                 char.IsWhiteSpace(Text[x.Index + x.Length]) || char.IsPunctuation(Text[x.Index + x.Length]))
             .First(x => x.Index > openTag.Index && string.Equals(x.Type, openTag.Type));
     }
     catch (Exception)
     {
         return null;
     }
 }
コード例 #8
0
ファイル: Tag.cs プロジェクト: Vedmax/01-quality
 protected bool Equals(Tag other)
 {
     return Index == other.Index && string.Equals(Type, other.Type) && Length == other.Length;
 }