public string GetString(int Offset, int Count) => StringConverter4.GetBEString4(Data, Offset, Count);
/// <summary> /// Converts bytes to a string according to the input parameters. /// </summary> /// <param name="data">Encoded data</param> /// <param name="generation">Generation string format</param> /// <param name="jp">Encoding is Japanese</param> /// <param name="bigendian">Encoding is BigEndian</param> /// <param name="count">Length of data to read.</param> /// <param name="offset">Offset to read from</param> /// <returns>Decoded string.</returns> public static string GetString(byte[] data, int generation, bool jp, bool bigendian, int count, int offset = 0) { if (bigendian) { return(generation == 3 ? StringConverter3.GetBEString3(data, offset, count) : StringConverter4.GetBEString4(data, offset, count)); } switch (generation) { case 1: case 2: return(StringConverter12.GetString1(data, offset, count, jp)); case 3: return(StringConverter3.GetString3(data, offset, count, jp)); case 4: return(StringConverter4.GetString4(data, offset, count)); case 5: return(GetString5(data, offset, count)); case 6: return(GetString6(data, offset, count)); default: return(GetString7(data, offset, count)); } }
public override string GetString(byte[] data, int offset, int length) => StringConverter4.GetBEString4(data, offset, length);
/// <summary> /// Converts bytes to a string according to the input parameters. /// </summary> /// <param name="data">Encoded data</param> /// <param name="generation">Generation string format</param> /// <param name="jp">Encoding is Japanese</param> /// <param name="isBigEndian">Encoding is Big Endian</param> /// <param name="count">Length of data to read.</param> /// <param name="offset">Offset to read from</param> /// <returns>Decoded string.</returns> public static string GetString(byte[] data, int generation, bool jp, bool isBigEndian, int count, int offset = 0) { if (isBigEndian) { return(generation == 3 ? StringConverter3.GetBEString3(data, offset, count) : StringConverter4.GetBEString4(data, offset, count)); } return(generation switch { 1 or 2 => StringConverter12.GetString1(data, offset, count, jp), 3 => StringConverter3.GetString3(data, offset, count, jp), 4 => StringConverter4.GetString4(data, offset, count), 5 => GetString5(data, offset, count), 6 => GetString6(data, offset, count), 7 => GetString7(data, offset, count), _ => GetString7b(data, offset, count), });
public string GetString(int offset, int count) => StringConverter4.GetBEString4(Data, offset, count);