mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-03-22 09:54:09 -05:00
98 lines
2.2 KiB
C#
98 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace PkmnFoundations.Structures
|
|
{
|
|
public class BoxRecord4 : BinarySerializableBase
|
|
{
|
|
public BoxRecord4()
|
|
{
|
|
}
|
|
|
|
public BoxRecord4(int pid, BoxLabels4 label, ulong serial_number, BinaryReader data)
|
|
: base(data)
|
|
{
|
|
PID = pid;
|
|
Label = label;
|
|
SerialNumber = serial_number;
|
|
}
|
|
|
|
public BoxRecord4(int pid, BoxLabels4 label, ulong serial_number, byte[] data)
|
|
: base(data)
|
|
{
|
|
PID = pid;
|
|
Label = label;
|
|
SerialNumber = serial_number;
|
|
}
|
|
|
|
public BoxRecord4(int pid, BoxLabels4 label, ulong serial_number, byte[] data, int offset)
|
|
: base(data, offset)
|
|
{
|
|
PID = pid;
|
|
Label = label;
|
|
SerialNumber = serial_number;
|
|
}
|
|
|
|
public int PID { get; set; }
|
|
public BoxLabels4 Label { get; set; }
|
|
public ulong SerialNumber { get; set; }
|
|
|
|
private byte[] m_data;
|
|
public byte[] Data
|
|
{
|
|
get
|
|
{
|
|
return m_data;
|
|
}
|
|
set
|
|
{
|
|
if (m_data == value) return;
|
|
if (value == null)
|
|
{
|
|
m_data = null;
|
|
return;
|
|
}
|
|
|
|
if (value.Length != 540) throw new ArgumentException("Box data must be 540 bytes.");
|
|
m_data = value.ToArray();
|
|
}
|
|
}
|
|
|
|
public override int Size
|
|
{
|
|
get
|
|
{
|
|
return 540;
|
|
}
|
|
}
|
|
|
|
protected override void Load(System.IO.BinaryReader reader)
|
|
{
|
|
m_data = reader.ReadBytes(540);
|
|
}
|
|
|
|
protected override void Save(System.IO.BinaryWriter writer)
|
|
{
|
|
writer.Write(m_data);
|
|
}
|
|
|
|
public BoxRecord4 Clone()
|
|
{
|
|
return new BoxRecord4(PID, Label, SerialNumber, Data);
|
|
}
|
|
}
|
|
|
|
public enum BoxLabels4 : int
|
|
{
|
|
Favorite = 0x00,
|
|
Cool = 0x01,
|
|
Cute = 0x02,
|
|
Suggested = 0x03,
|
|
Fun = 0x04,
|
|
Select = 0x05
|
|
}
|
|
}
|