예제 #1
0
        /// <summary>
        /// Formats the specified entry and returns it as string.
        /// </summary>
        /// <param name="entry">The entry.</param>
        /// <returns>The specified entry as string.</returns>
        public string Format(MoveTextEntry entry)
        {
            var writer = new StringWriter();

            Format(entry, writer);
            return(writer.ToString());
        }
예제 #2
0
        /// <summary>
        /// Formats the specified entry and returns it as string.
        /// </summary>
        /// <param name="entry">The entry.</param>
        /// <returns>The specified entry as string.</returns>
        public string Format(MoveTextEntry entry)
        {
            var writer = new StringWriter();

            Format(entry, writer);

            var myString = writer.ToString();

            byte[] bytes = Encoding.Default.GetBytes(myString);
            return(Encoding.UTF8.GetString(bytes));
        }
예제 #3
0
 /// <summary>
 /// Formats the specified move text entry and writes it to the text writer.
 /// </summary>
 /// <param name="entry">The entry.</param>
 /// <param name="writer">The writer.</param>
 public void Format(MoveTextEntry entry, TextWriter writer)
 {
     switch (entry.Type)
     {
         case MoveTextEntryType.MovePair:
             FormatPair((MovePairEntry)entry, writer);
             return;
         case MoveTextEntryType.SingleMove:
             FormatHalfMove((HalfMoveEntry)entry, writer);
             return;
         case MoveTextEntryType.RecursiveAnnotationVariation:
             FormatRAVEntry((RAVEntry)entry, writer);
             return;
         case MoveTextEntryType.GameEnd:
         case MoveTextEntryType.Comment:
         case MoveTextEntryType.NumericAnnotationGlyph:
             writer.Write(entry.ToString());
             return;
     }
 }
예제 #4
0
        /// <summary>
        /// Formats the specified move text entry and writes it to the text writer.
        /// </summary>
        /// <param name="entry">The entry.</param>
        /// <param name="writer">The writer.</param>
        public void Format(MoveTextEntry entry, TextWriter writer)
        {
            switch (entry.Type)
            {
            case MoveTextEntryType.MovePair:
                FormatPair((MovePairEntry)entry, writer);
                return;

            case MoveTextEntryType.SingleMove:
                FormatHalfMove((HalfMoveEntry)entry, writer);
                return;

            case MoveTextEntryType.RecursiveAnnotationVariation:
                FormatRavEntry((RavEntry)entry, writer);
                return;

            case MoveTextEntryType.GameEnd:
            case MoveTextEntryType.Comment:
            case MoveTextEntryType.NumericAnnotationGlyph:
                writer.Write(entry.ToString());
                return;
            }
        }
예제 #5
0
 /// <summary>
 /// Formats the specified entry and returns it as string.
 /// </summary>
 /// <param name="entry">The entry.</param>
 /// <returns>The specified entry as string.</returns>
 public string Format(MoveTextEntry entry)
 {
     var writer = new StringWriter();
     Format(entry, writer);
     return writer.ToString();
 }