mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-04-25 16:20:08 -05:00
Did some variable name refactors.
This commit is contained in:
parent
7a462f3901
commit
2bfc9edd9b
|
|
@ -314,7 +314,7 @@ namespace PkmnFoundations.Data
|
|||
|
||||
data = new byte[16];
|
||||
reader.GetBytes(14, 0, data, 0, 16);
|
||||
result.TrainerName = new String4(data);
|
||||
result.TrainerName = new EncodedString4(data);
|
||||
data = null;
|
||||
|
||||
result.TrainerOT = reader.GetUInt16(15);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace PkmnFoundations.Structures
|
|||
/// <summary>
|
||||
/// 16 bytes
|
||||
/// </summary>
|
||||
public String4 TrainerName;
|
||||
public EncodedString4 TrainerName;
|
||||
|
||||
public ushort TrainerOT;
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ namespace PkmnFoundations.Structures
|
|||
TimeDeposited = TimestampToDate(BitConverter.ToUInt64(data, 0xF8));
|
||||
TimeWithdrawn = TimestampToDate(BitConverter.ToUInt64(data, 0x100));
|
||||
PID = BitConverter.ToInt32(data, 0x108);
|
||||
TrainerName = new String4(data, 0x10C, 0x10);
|
||||
TrainerName = new EncodedString4(data, 0x10C, 0x10);
|
||||
TrainerOT = BitConverter.ToUInt16(data, 0x11C);
|
||||
TrainerCountry = data[0x11E];
|
||||
TrainerRegion = data[0x11F];
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace PkmnFoundations.Support {
|
||||
public class String4 {
|
||||
public static string GetStringGeneration4(byte[] data, int location, int maxCount)
|
||||
namespace PkmnFoundations.Support
|
||||
{
|
||||
public class EncodedString4
|
||||
{
|
||||
public static string DecodeString(byte[] data, int location, int maxCount)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
|
@ -20,26 +22,27 @@ namespace PkmnFoundations.Support {
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
private byte[] m_rawData;
|
||||
private byte[] m_raw_data;
|
||||
private string m_text;
|
||||
|
||||
public string Text { get { return m_text; } } // Is a setter useful for this?
|
||||
public byte[] RawData { get { return m_rawData; } }
|
||||
public byte[] RawData { get { return m_raw_data; } }
|
||||
|
||||
public String4(byte[] data)
|
||||
public EncodedString4(byte[] data)
|
||||
{
|
||||
Initialize(data, 0, data.Length);
|
||||
}
|
||||
public String4(byte[] data, int location, int length)
|
||||
|
||||
public EncodedString4(byte[] data, int start, int count)
|
||||
{
|
||||
Initialize(data, location, length);
|
||||
Initialize(data, start, count);
|
||||
}
|
||||
|
||||
private void Initialize(byte[] data, int location, int length)
|
||||
{
|
||||
m_text = GetStringGeneration4(data, location, length);
|
||||
m_rawData = new byte[length];
|
||||
Array.Copy(data, location, m_rawData, 0, length);
|
||||
m_text = DecodeString(data, location, length);
|
||||
m_raw_data = new byte[length];
|
||||
Array.Copy(data, location, m_raw_data, 0, length);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
Loading…
Reference in New Issue
Block a user