Add xmldoc

This commit is contained in:
Kurt 2022-01-08 09:54:32 -08:00
parent 9bddc89c07
commit b96e2cacd7
14 changed files with 63 additions and 24 deletions

View file

@ -1,5 +1,8 @@
namespace PKHeX.Core namespace PKHeX.Core
{ {
/// <summary>
/// Indicates or coerces values pertaining to <see cref="Species.Wurmple"/> and its branched evolutions.
/// </summary>
public static class WurmpleUtil public static class WurmpleUtil
{ {
/// <summary> /// <summary>

View file

@ -33,15 +33,15 @@ public static class StringConverter
/// <summary> /// <summary>
/// Gets the bytes for a Generation specific string according to the input parameters. /// Gets the bytes for a Generation specific string according to the input parameters.
/// </summary> /// </summary>
/// <param name="destBuffer"></param> /// <param name="destBuffer">Span of bytes to write encoded string data</param>
/// <param name="value">Decoded string.</param> /// <param name="value">Decoded string.</param>
/// <param name="maxLength">Maximum length of the input <see cref="value"/></param> /// <param name="maxLength">Maximum length of the input <see cref="value"/></param>
/// <param name="option"></param> /// <param name="option">Buffer pre-formatting option</param>
/// <param name="generation">Generation string format</param> /// <param name="generation">Generation string format</param>
/// <param name="jp">Encoding is Japanese</param> /// <param name="jp">Encoding is Japanese</param>
/// <param name="isBigEndian">Encoding is Big Endian</param> /// <param name="isBigEndian">Encoding is Big Endian</param>
/// <param name="language">Language specific conversion (Chinese)</param> /// <param name="language">Language specific conversion (Chinese)</param>
/// <returns>Encoded data.</returns> /// <returns>Count of bytes written to the <see cref="destBuffer"/>.</returns>
public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, StringConverterOption option, public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, StringConverterOption option,
int generation, bool jp, bool isBigEndian, int language = 0) => generation switch int generation, bool jp, bool isBigEndian, int language = 0) => generation switch
{ {

View file

@ -127,11 +127,11 @@ public static class StringConverter12
/// <summary> /// <summary>
/// Converts a string to Generation 1 encoded data. /// Converts a string to Generation 1 encoded data.
/// </summary> /// </summary>
/// <param name="destBuffer"></param> /// <param name="destBuffer">Span of bytes to write encoded string data</param>
/// <param name="value">Decoded string.</param> /// <param name="value">Decoded string.</param>
/// <param name="maxLength">Maximum length of the input <see cref="value"/></param> /// <param name="maxLength">Maximum length of the input <see cref="value"/></param>
/// <param name="jp">Data destination is Japanese.</param> /// <param name="jp">Data destination is Japanese.</param>
/// <param name="option"></param> /// <param name="option">Buffer pre-formatting option</param>
/// <returns>Encoded data.</returns> /// <returns>Encoded data.</returns>
public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, bool jp, public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, bool jp,
StringConverterOption option = StringConverterOption.Clear50) StringConverterOption option = StringConverterOption.Clear50)

View file

@ -66,9 +66,9 @@ public static class StringConverter2KOR
/// Converts a string to Generation 1 encoded data. /// Converts a string to Generation 1 encoded data.
/// </summary> /// </summary>
/// <param name="value">Decoded string.</param> /// <param name="value">Decoded string.</param>
/// <param name="destBuffer"></param> /// <param name="destBuffer">Span of bytes to write encoded string data</param>
/// <param name="maxLength">Maximum length of the input <see cref="value"/></param> /// <param name="maxLength">Maximum length of the input <see cref="value"/></param>
/// <param name="option"></param> /// <param name="option">Buffer pre-formatting option</param>
/// <returns>Encoded data.</returns> /// <returns>Encoded data.</returns>
public static int SetString(ReadOnlySpan<char> value, Span<byte> destBuffer, int maxLength, StringConverterOption option = StringConverterOption.Clear50) public static int SetString(ReadOnlySpan<char> value, Span<byte> destBuffer, int maxLength, StringConverterOption option = StringConverterOption.Clear50)
{ {

View file

@ -38,7 +38,7 @@ public static class StringConverter3
/// <param name="value">Decoded string.</param> /// <param name="value">Decoded string.</param>
/// <param name="maxLength">Maximum length of the input <see cref="value"/></param> /// <param name="maxLength">Maximum length of the input <see cref="value"/></param>
/// <param name="jp">String destination is Japanese font.</param> /// <param name="jp">String destination is Japanese font.</param>
/// <param name="option"></param> /// <param name="option">Buffer pre-formatting option</param>
/// <returns>Encoded data.</returns> /// <returns>Encoded data.</returns>
public static int SetString(Span<byte> buffer, ReadOnlySpan<char> value, int maxLength, bool jp, public static int SetString(Span<byte> buffer, ReadOnlySpan<char> value, int maxLength, bool jp,
StringConverterOption option = StringConverterOption.ClearFF) StringConverterOption option = StringConverterOption.ClearFF)

View file

@ -3,6 +3,9 @@ using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core; namespace PKHeX.Core;
/// <summary>
/// Logic for converting a <see cref="string"/> for Generation 3 GameCube games.
/// </summary>
public static class StringConverter3GC public static class StringConverter3GC
{ {
private const char TerminatorBigEndian = (char)0; // GC private const char TerminatorBigEndian = (char)0; // GC
@ -31,7 +34,7 @@ public static class StringConverter3GC
} }
/// <summary>Gets the bytes for a Big Endian string.</summary> /// <summary>Gets the bytes for a Big Endian string.</summary>
/// <param name="destBuffer"></param> /// <param name="destBuffer">Span of bytes to write encoded string data</param>
/// <param name="value">Decoded string.</param> /// <param name="value">Decoded string.</param>
/// <param name="maxLength">Maximum length of the input <see cref="value"/></param> /// <param name="maxLength">Maximum length of the input <see cref="value"/></param>
/// <param name="option">Option to clear the buffer. Only <see cref="StringConverterOption.ClearZero"/> is recognized.</param> /// <param name="option">Option to clear the buffer. Only <see cref="StringConverterOption.ClearZero"/> is recognized.</param>

View file

@ -40,10 +40,10 @@ public static class StringConverter4
} }
/// <summary>Gets the bytes for a 4th Generation String</summary> /// <summary>Gets the bytes for a 4th Generation String</summary>
/// <param name="destBuffer"></param> /// <param name="destBuffer">Span of bytes to write encoded string data</param>
/// <param name="value">Decoded string.</param> /// <param name="value">Decoded string.</param>
/// <param name="maxLength">Maximum length of the input <see cref="value"/></param> /// <param name="maxLength">Maximum length of the input <see cref="value"/></param>
/// <param name="option"></param> /// <param name="option">Buffer pre-formatting option</param>
/// <returns>Encoded data.</returns> /// <returns>Encoded data.</returns>
public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength,
StringConverterOption option = StringConverterOption.ClearZero) StringConverterOption option = StringConverterOption.ClearZero)

View file

@ -4,6 +4,9 @@ using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core; namespace PKHeX.Core;
/// <summary>
/// Logic for converting a <see cref="string"/> for Generation 4 GameCube games.
/// </summary>
public static class StringConverter4GC public static class StringConverter4GC
{ {
private const ushort Terminator = 0xFFFF; private const ushort Terminator = 0xFFFF;
@ -41,10 +44,10 @@ public static class StringConverter4GC
/// <summary> /// <summary>
/// Converts a string to Generation 4 Big Endian encoded character data. /// Converts a string to Generation 4 Big Endian encoded character data.
/// </summary> /// </summary>
/// <param name="destBuffer"></param> /// <param name="destBuffer">Span of bytes to write encoded string data</param>
/// <param name="value">String to be converted.</param> /// <param name="value">String to be converted.</param>
/// <param name="maxLength">Maximum length of string</param> /// <param name="maxLength">Maximum length of string</param>
/// <param name="option"></param> /// <param name="option">Buffer pre-formatting option</param>
/// <returns>Byte array containing encoded character data</returns> /// <returns>Byte array containing encoded character data</returns>
public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength,
StringConverterOption option = StringConverterOption.ClearZero) StringConverterOption option = StringConverterOption.ClearZero)
@ -102,9 +105,9 @@ public static class StringConverter4GC
/// </summary> /// </summary>
/// <remarks>Used by the Save File's internal strings.</remarks> /// <remarks>Used by the Save File's internal strings.</remarks>
/// <param name="value">String to be converted.</param> /// <param name="value">String to be converted.</param>
/// <param name="destBuffer"></param> /// <param name="destBuffer">Span of bytes to write encoded string data</param>
/// <param name="maxLength">Maximum length of string</param> /// <param name="maxLength">Maximum length of string</param>
/// <param name="option"></param> /// <param name="option">Buffer pre-formatting option</param>
/// <returns>Byte array containing encoded character data</returns> /// <returns>Byte array containing encoded character data</returns>
public static int SetStringUnicode(ReadOnlySpan<char> value, Span<byte> destBuffer, int maxLength, StringConverterOption option = StringConverterOption.ClearZero) public static int SetStringUnicode(ReadOnlySpan<char> value, Span<byte> destBuffer, int maxLength, StringConverterOption option = StringConverterOption.ClearZero)
{ {

View file

@ -4,6 +4,9 @@ using System.Linq;
namespace PKHeX.Core; namespace PKHeX.Core;
/// <summary>
/// Utility Logic for converting Generation 4 character encoding.
/// </summary>
public static class StringConverter4Util public static class StringConverter4Util
{ {
/// <summary> /// <summary>

View file

@ -3,6 +3,9 @@ using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core; namespace PKHeX.Core;
/// <summary>
/// Logic for converting a <see cref="string"/> for Generation 5 games.
/// </summary>
public static class StringConverter5 public static class StringConverter5
{ {
private const char TerminatorFFFF = (char)0xFFFF; private const char TerminatorFFFF = (char)0xFFFF;
@ -31,10 +34,10 @@ public static class StringConverter5
} }
/// <summary>Gets the bytes for a Generation 5 string.</summary> /// <summary>Gets the bytes for a Generation 5 string.</summary>
/// <param name="destBuffer"></param> /// <param name="destBuffer">Span of bytes to write encoded string data</param>
/// <param name="value">Decoded string.</param> /// <param name="value">Decoded string.</param>
/// <param name="maxLength">Maximum length of the input <see cref="value"/></param> /// <param name="maxLength">Maximum length of the input <see cref="value"/></param>
/// <param name="option"></param> /// <param name="option">Buffer pre-formatting option</param>
/// <returns>Encoded data.</returns> /// <returns>Encoded data.</returns>
public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength,
StringConverterOption option = StringConverterOption.ClearZero) StringConverterOption option = StringConverterOption.ClearZero)

View file

@ -3,6 +3,10 @@ using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core; namespace PKHeX.Core;
/// <summary>
/// Logic for converting a <see cref="string"/> for Generation 6 games.
/// </summary>
/// <remarks>Customized Unicode glyph remapping for visual display</remarks>
public static class StringConverter6 public static class StringConverter6
{ {
private const ushort TerminatorNull = 0; private const ushort TerminatorNull = 0;
@ -31,10 +35,10 @@ public static class StringConverter6
} }
/// <summary>Gets the bytes for a Generation 6 string.</summary> /// <summary>Gets the bytes for a Generation 6 string.</summary>
/// <param name="destBuffer"></param> /// <param name="destBuffer">Span of bytes to write encoded string data</param>
/// <param name="value">Decoded string.</param> /// <param name="value">Decoded string.</param>
/// <param name="maxLength">Maximum length of the input <see cref="value"/></param> /// <param name="maxLength">Maximum length of the input <see cref="value"/></param>
/// <param name="option"></param> /// <param name="option">Buffer pre-formatting option</param>
/// <returns>Encoded data.</returns> /// <returns>Encoded data.</returns>
public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength,
StringConverterOption option = StringConverterOption.ClearZero) StringConverterOption option = StringConverterOption.ClearZero)

View file

@ -3,6 +3,10 @@ using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core; namespace PKHeX.Core;
/// <summary>
/// Logic for converting a <see cref="string"/> for Generation 7 games.
/// </summary>
/// <remarks>Customized Unicode glyph remapping for visual display. Chinese Species names use a special range of characters -- <see cref="StringConverter7ZH"/>.</remarks>
public static class StringConverter7 public static class StringConverter7
{ {
private const ushort TerminatorNull = 0; private const ushort TerminatorNull = 0;
@ -34,11 +38,11 @@ public static class StringConverter7
} }
/// <summary>Gets the bytes for a Generation 7 string.</summary> /// <summary>Gets the bytes for a Generation 7 string.</summary>
/// <param name="destBuffer"></param> /// <param name="destBuffer">Span of bytes to write encoded string data</param>
/// <param name="value">Decoded string.</param> /// <param name="value">Decoded string.</param>
/// <param name="maxLength">Maximum length of the input <see cref="value"/></param> /// <param name="maxLength">Maximum length of the input <see cref="value"/></param>
/// <param name="language">Language specific conversion (Chinese)</param> /// <param name="language">Language specific conversion (Chinese)</param>
/// <param name="option"></param> /// <param name="option">Buffer pre-formatting option</param>
/// <param name="chinese">Chinese string remapping should be attempted</param> /// <param name="chinese">Chinese string remapping should be attempted</param>
/// <returns>Encoded data.</returns> /// <returns>Encoded data.</returns>
public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, int language, public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, int language,

View file

@ -3,6 +3,10 @@ using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core; namespace PKHeX.Core;
/// <summary>
/// Logic for converting a <see cref="string"/> for Generation 8 games.
/// </summary>
/// <remarks>Also used by LGP/E; this encoding is essentially the same as Generation 6's.</remarks>
public static class StringConverter8 public static class StringConverter8
{ {
private const ushort TerminatorNull = 0; private const ushort TerminatorNull = 0;
@ -31,10 +35,10 @@ public static class StringConverter8
} }
/// <summary>Gets the bytes for a Generation 7-Beluga string.</summary> /// <summary>Gets the bytes for a Generation 7-Beluga string.</summary>
/// <param name="destBuffer"></param> /// <param name="destBuffer">Span of bytes to write encoded string data</param>
/// <param name="value">Decoded string.</param> /// <param name="value">Decoded string.</param>
/// <param name="maxLength">Maximum length of the input <see cref="value"/></param> /// <param name="maxLength">Maximum length of the input <see cref="value"/></param>
/// <param name="option"></param> /// <param name="option">Buffer pre-formatting option</param>
/// <returns>Encoded data.</returns> /// <returns>Encoded data.</returns>
public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, public static int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength,
StringConverterOption option = StringConverterOption.ClearZero) StringConverterOption option = StringConverterOption.ClearZero)

View file

@ -1,10 +1,22 @@
namespace PKHeX.Core; namespace PKHeX.Core;
/// <summary>
/// String Buffer pre-formatting option
/// </summary>
public enum StringConverterOption public enum StringConverterOption
{ {
/// <summary> Does not do any operation on the buffer. </summary>
None, None,
/// <summary> Zeroes out the entire buffer. </summary>
ClearZero, ClearZero,
/// <summary> Fills the entire buffer with 0x50; used by Generation 1/2 string encoding. </summary>
Clear50, Clear50,
/// <summary> Fills the entire buffer with 0x7F; used by Generation 1/2 Stadium to space over for the next line. </summary>
Clear7F, Clear7F,
/// <summary> Fills the entire buffer with 0xFF; used by Generation 3-5 which use 0xFF/0xFFFF as their terminator. </summary>
ClearFF, ClearFF,
} }