using System;
using System.Data;
using System.IO;
using PackageIO;
using System.Reflection;
using System.Drawing;
using System.Windows.Forms;
namespace DBC17_Academy_Save_Editor
{
class ReadSave
{
public static void ReadTeamData(string file, DataGridView Teams_dataGridView, ToolStripStatusLabel Version_Label, StatusStrip ss)
{
Teams_dataGridView.DataSource = null;
Reader br = null;
DataTable dt = null;
Bitmap[] Imagelist = null;
try
{
if (file != string.Empty)
{
Imagelist = imageList();
dt = new DataTable();
dt.Columns.Add("Gender", typeof(Image));
dt.Columns.Add("Team ID", Type.GetType("System.Int32"));
dt.Columns.Add("Full Name", Type.GetType("System.String"));
dt.Columns.Add("Short Name", Type.GetType("System.String"));
br = new Reader(file, FileMode.Open, Endian.Little);
int SaveVersion = br.ReadInt32();
Version_Label.Text = "Save Version - " + SaveVersion.ToString();
ss.Refresh();
br.Position = Global.TEAM_POSITION;
Global.team_amount = br.ReadInt16(Endian.Big);
for (int i = 0; i < Global.team_amount; i++)
{
ReadTeam(i, br);
dt.Rows.Add();
dt.Rows[dt.Rows.Count - 1]["Gender"] = Imagelist[Global.team[i].gender];
if (Global.team[i].id.Equals(-1))
dt.Rows[dt.Rows.Count - 1]["Team ID"] = Global.team[i].id;
else
dt.Rows[dt.Rows.Count - 1]["Team ID"] = Global.team[i].originalId;
dt.Rows[dt.Rows.Count - 1]["Full Name"] = Global.team[i].fullName;
dt.Rows[dt.Rows.Count - 1]["Short Name"] = Global.team[i].shortName;
}
Teams_dataGridView.DataSource = dt;
Teams_dataGridView.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
}
}
catch (Exception error)
{
MessageBox.Show("Error occurred, report it to Wouldy : " + error, "Hmm, something stuffed up :(", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
finally
{
if (br != null)
br.Close();
}
}
public static void ReadTeam(int Index, Reader br)
{
// Ids
Global.team[Index].id = br.ReadInt32(Endian.Big);
Global.team[Index].originalId = br.ReadInt32(Endian.Big);
Global.team[Index].padding1 = br.ReadUInt32(Endian.Big);
Global.team[Index].padding2 = br.ReadByte();
Global.team[Index].padding3 = br.ReadUInt16(Endian.Big);
// FullName
Global.team[Index].fullName = br.ReadNullTerminatedString();
br.ReadBytes(43 - Global.team[Index].fullName.Length, Endian.Little);
// ShortName
Global.team[Index].shortName = br.ReadNullTerminatedString();
br.ReadBytes(21 - Global.team[Index].shortName.Length, Endian.Little);
// ScorecardName
Global.team[Index].scorecardName = br.ReadNullTerminatedString();
br.ReadBytes(18 - Global.team[Index].scorecardName.Length, Endian.Little);
// AbbreviatedName
Global.team[Index].abbreviatedName = br.ReadNullTerminatedString();
br.ReadBytes(3 - Global.team[Index].abbreviatedName.Length, Endian.Little);
// DiskName
Global.team[Index].diskName = br.ReadNullTerminatedString();
br.ReadBytes(15 - Global.team[Index].diskName.Length, Endian.Little);
// Logos
Global.team[Index].customLogoID = br.ReadUInt32(Endian.Big);
Global.team[Index].padding4 = br.ReadByte();
Global.team[Index].logoID = br.ReadUInt16(Endian.Big);
// PrimaryColour
Global.team[Index].primaryColour.r = br.ReadByte();
Global.team[Index].primaryColour.g = br.ReadByte();
Global.team[Index].primaryColour.b = br.ReadByte();
// SecondaryColour
Global.team[Index].secondaryColour.r = br.ReadByte();
Global.team[Index].secondaryColour.g = br.ReadByte();
Global.team[Index].secondaryColour.b = br.ReadByte();
// HudTextColour
Global.team[Index].hudTextColour.r = br.ReadByte();
Global.team[Index].hudTextColour.g = br.ReadByte();
Global.team[Index].hudTextColour.b = br.ReadByte();
// Commentary
Global.team[Index].commentary1 = br.ReadInt16(Endian.Big);
Global.team[Index].commentary2 = br.ReadInt16(Endian.Big);
Global.team[Index].padding5 = br.ReadByte();
Global.team[Index].padding6 = br.ReadUInt16(Endian.Big);
// Stadiums
Global.team[Index].stadiumAmount = br.ReadInt16(Endian.Big);
Global.team[Index].stadium = new TeamData.Stadium[7];
for (int j = 0; j < 7; j++)
{
Global.team[Index].stadium[j].id = br.ReadByte();
Global.team[Index].stadium[j].customId = br.ReadUInt32(Endian.Big);
Global.team[Index].stadium[j].logoID = br.ReadInt32(Endian.Big);
Global.team[Index].stadium[j].isCustomName = br.ReadBoolean();
Global.team[Index].stadium[j].customName = br.ReadNullTerminatedString();
br.ReadBytes(31 - Global.team[Index].stadium[j].customName.Length, Endian.Little);
Global.team[Index].stadium[j].northEnd = br.ReadByte();
Global.team[Index].stadium[j].southEnd = br.ReadByte();
}
// Gender
Global.team[Index].gender = br.ReadByte();
Global.team[Index].rawData1 = br.ReadBytes(9, Endian.Little);
// Uniforms
Global.team[Index].uniformAmount = br.ReadByte();
Global.team[Index].uniforms = new TeamData.Uniforms[8];
for (int j = 0; j < 8; j++)
{
Global.team[Index].uniforms[j].name = br.ReadNullTerminatedString();
br.ReadBytes(24 - Global.team[Index].uniforms[j].name.Length, Endian.Little);
Global.team[Index].uniforms[j].rawData = br.ReadBytes(962, Endian.Little);
}
Global.team[Index].uniformData2 = br.ReadBytes(6, Endian.Little);
Global.team[Index].uniformLogoAmount = br.ReadUInt16(Endian.Big);
Global.team[Index].uniformLogos = new TeamData.UniformLogos[8];
for (int j = 0; j < 8; j++)
{
Global.team[Index].uniformLogos[j].Data = br.ReadBytes(30, Endian.Little);
}
// Players
Global.team[Index].playerAmount = br.ReadUInt16(Endian.Big);
Global.team[Index].players.playerId = new int[Global.MAX_PLAYERS_PER_TEAM];
for (int j = 0; j < Global.MAX_PLAYERS_PER_TEAM; j++)
{
Global.team[Index].players.playerId[j] = br.ReadInt32(Endian.Big);
}
// Lineup Groups
Global.team[Index].lineupGroupAmount = br.ReadUInt16(Endian.Big);
Global.team[Index].lineupGroup = new TeamData.LineupGroup[8];
for (int j = 0; j < 8; j++)
{
// Lineups
Global.team[Index].lineupGroup[j].lineupAmount = br.ReadUInt16(Endian.Big);
Global.team[Index].lineupGroup[j].lineups.lineupId = new int[Global.MIN_PLAYERS_PER_TEAM];
for (int k = 0; k < Global.MIN_PLAYERS_PER_TEAM; k++)
{
Global.team[Index].lineupGroup[j].lineups.lineupId[k] = br.ReadInt32(Endian.Big);
}
// Roles
Global.team[Index].lineupGroup[j].rolesAmount = br.ReadUInt16(Endian.Big);
Global.team[Index].lineupGroup[j].roles.roleId = new int[4];
for (int k = 0; k < 4; k++)
{
Global.team[Index].lineupGroup[j].roles.roleId[k] = br.ReadInt32(Endian.Big);
}
// Lineup Name
Global.team[Index].lineupGroup[j].name = br.ReadNullTerminatedString();
br.ReadBytes(15 - Global.team[Index].lineupGroup[j].name.Length, Endian.Little);
Global.team[Index].lineupGroup[j].unknown = br.ReadByte();
}
Global.team[Index].rawData2 = br.ReadBytes(10, Endian.Little);
// Sharing ID
Global.team[Index].sharingID = br.ReadInt32(Endian.Big);
Global.team[Index].rawData3 = br.ReadBytes(13, Endian.Little);
// Grading
Global.team[Index].grading = br.ReadByte();
Global.team[Index].padding7 = br.ReadUInt16(Endian.Big);
}
public static void ReadLevelData(string file)
{
Reader br = null;
try
{
if (File.Exists(file))
{
br = new Reader(file, FileMode.Open, Endian.Little);
Global.LevelDataAmount = 0;
br.Position = 8;
int idCheck = br.ReadInt32();
if (idCheck < 1024 || idCheck > 1152)
return;
br.Position = 8;
for (int i = 0; i < 128; i++)
{
Global.levelData[i].stadiumId = br.ReadUInt32();
if (Global.levelData[i].stadiumId == 0)
{
Global.LevelDataAmount = i;
break;
}
Global.levelData[i].stadiumName = br.ReadNullTerminatedString();
br.ReadBytes(127 - Global.levelData[i].stadiumName.Length, Endian.Little);
br.ReadBytes(64, Endian.Little);
Global.levelData[i].stadiumLogoId = br.ReadUInt32();
br.ReadBytes(25, Endian.Little);
}
}
else
{
MessageBox.Show("Can't find custom stadium file - LevelData.SAV", "File Doesn't Exist", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
catch (Exception error)
{
MessageBox.Show("Error occurred, report it to Wouldy : " + error, "Hmm, something stuffed up :(", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
finally
{
if (br != null)
br.Close();
}
}
public static void ReadDecalsData(string file)
{
Reader br = null;
try
{
if (File.Exists(file))
{
br = new Reader(file, FileMode.Open, Endian.Little);
Global.DecalsDataAmount = 0;
br.Position = 8;
int idCheck = br.ReadInt32();
if (idCheck < 1024 || idCheck > 6024)
return;
br.Position = 8;
for (int i = 0; i < 5000; i++)
{
Global.decalData[i].logoId = br.ReadUInt32();
if (Global.decalData[i].logoId == 0)
{
Global.DecalsDataAmount = i;
break;
}
Global.decalData[i].logoName = br.ReadNullTerminatedString();
br.ReadBytes(63 - Global.decalData[i].logoName.Length, Endian.Little);
br.ReadBytes(29, Endian.Little);
}
}
else
{
MessageBox.Show("Can't find custom logos file - DecalData.SAV", "File Doesn't Exist", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception error)
{
MessageBox.Show("Error occurred, report it to Wouldy : " + error, "Hmm, something stuffed up :(", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
finally
{
if (br != null)
br.Close();
}
}
public static void ReadPlayerData(string file, DataGridView Players_dataGridView)
{
Players_dataGridView.DataSource = null;
Reader br = null;
DataTable dt = null;
Bitmap[] Imagelist = null;
try
{
if (file != string.Empty)
{
Imagelist = imageList();
dt = new DataTable();
dt.Columns.Add("Gender", typeof(Image));
dt.Columns.Add("Player ID", Type.GetType("System.Int32"));
dt.Columns.Add("First Name", Type.GetType("System.String"));
dt.Columns.Add("Last Name", Type.GetType("System.String"));
br = new Reader(file, FileMode.Open, Endian.Big);
br.Position = Global.PLAYER_POSITION;
Global.player_amount = br.ReadUInt16();
for (int i = 0; i < Global.player_amount; i++)
{
ReadPlayer(i, br);
dt.Rows.Add();
dt.Rows[dt.Rows.Count - 1]["Gender"] = Imagelist[Global.player[i].gender];
if (Global.player[i].originalId.Equals(-1))
dt.Rows[dt.Rows.Count - 1]["Player ID"] = Global.player[i].id;
else
dt.Rows[dt.Rows.Count - 1]["Player ID"] = Global.player[i].originalId;
dt.Rows[dt.Rows.Count - 1]["First Name"] = Global.player[i].firstName;
dt.Rows[dt.Rows.Count - 1]["Last Name"] = Global.player[i].lastName;
}
Players_dataGridView.DataSource = dt;
Players_dataGridView.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
}
}
catch (Exception error)
{
MessageBox.Show("Error occurred, report it to Wouldy : " + error, "Hmm, something stuffed up :(", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
finally
{
if (br != null)
br.Close();
}
}
public static void ReadPlayer(int Index, Reader br)
{
// Ids
Global.player[Index].id = br.ReadInt32(Endian.Big);
Global.player[Index].originalId = br.ReadInt32(Endian.Big);
Global.player[Index].padding1 = br.ReadByte();
Global.player[Index].gender = br.ReadByte();
Global.player[Index].battingHand = br.ReadByte();
Global.player[Index].bowlingArm = br.ReadByte();
Global.player[Index].bowlingExtertsionSound = br.ReadBoolean();
// DOB
Global.player[Index].dob.day = br.ReadByte();
Global.player[Index].dob.month = br.ReadByte();
Global.player[Index].dob.year = br.ReadInt16(Endian.Big);
Global.player[Index].age = br.ReadByte();
// Commentary
Global.player[Index].commentarySurname = br.ReadUInt16(Endian.Big);
Global.player[Index].commentaryNickname = br.ReadUInt16(Endian.Big);
// FirstName
Global.player[Index].firstName = br.ReadNullTerminatedString();
br.ReadBytes(19 - Global.player[Index].firstName.ToString().Length, Endian.Little);
// LastName
Global.player[Index].lastName = br.ReadNullTerminatedString();
br.ReadBytes(19 - Global.player[Index].lastName.ToString().Length, Endian.Little);
// ShirtName
Global.player[Index].shirtName = br.ReadNullTerminatedString();
br.ReadBytes(15 - Global.player[Index].shirtName.ToString().Length, Endian.Little);
Global.player[Index].shirtNumber = br.ReadByte();
Global.player[Index].voice = br.ReadByte();
// Role
Global.player[Index].role = br.ReadByte();
Global.player[Index].battingPosition = br.ReadByte();
Global.player[Index].bowlingStyle = br.ReadByte();
Global.player[Index].country = br.ReadByte();
Global.player[Index].battingMentality = br.ReadByte();
Global.player[Index].bowlingMentality = br.ReadByte();
// Appearance Height/Weight
Global.player[Index].appearance.height = br.ReadByte();
Global.player[Index].appearance.weight = br.ReadByte();
// Technical Ability
Global.player[Index].technicalAbility.judgement = br.ReadByte();
Global.player[Index].technicalAbility.agility = br.ReadByte();
Global.player[Index].technicalAbility.cardioFitness = br.ReadByte();
Global.player[Index].technicalAbility.muscleFitness = br.ReadByte();
Global.player[Index].technicalAbility.strength = br.ReadByte();
Global.player[Index].technicalAbility.runSpeed = br.ReadByte();
// Batting Shot Types
Global.player[Index].skills.battingShotTypes.padding1 = br.ReadByte();
Global.player[Index].skills.battingShotTypes.drive = br.ReadByte();
Global.player[Index].skills.battingShotTypes.padding2 = br.ReadByte();
Global.player[Index].skills.battingShotTypes.cut = br.ReadByte();
Global.player[Index].skills.battingShotTypes.padding3 = br.ReadByte();
Global.player[Index].skills.battingShotTypes.hookPull = br.ReadByte();
Global.player[Index].skills.battingShotTypes.padding4 = br.ReadByte();
Global.player[Index].skills.battingShotTypes.glance = br.ReadByte();
Global.player[Index].skills.battingShotTypes.padding5 = br.ReadByte();
Global.player[Index].skills.battingShotTypes.sweep = br.ReadByte();
Global.player[Index].skills.battingShotTypes.padding6 = br.ReadByte();
Global.player[Index].skills.battingShotTypes.specialShots = br.ReadByte();
// Batting Technique
Global.player[Index].skills.battingTechnique.padding1 = br.ReadByte();
Global.player[Index].skills.battingTechnique.footwork = br.ReadByte();
Global.player[Index].skills.battingTechnique.padding2 = br.ReadByte();
Global.player[Index].skills.battingTechnique.control = br.ReadByte();
Global.player[Index].skills.battingTechnique.padding3 = br.ReadByte();
Global.player[Index].skills.battingTechnique.attacking = br.ReadByte();
Global.player[Index].skills.battingTechnique.padding4 = br.ReadByte();
Global.player[Index].skills.battingTechnique.defending = br.ReadByte();
Global.player[Index].skills.battingTechnique.padding5 = br.ReadUInt32(Endian.Big);
// Bowling Delivery Types
Global.player[Index].skills.bowlingDeliveryTypes.padding1 = br.ReadByte();
Global.player[Index].skills.bowlingDeliveryTypes.stockballUnorthodox = br.ReadByte();
Global.player[Index].skills.bowlingDeliveryTypes.padding2 = br.ReadByte();
Global.player[Index].skills.bowlingDeliveryTypes.yorkerSlider = br.ReadByte();
Global.player[Index].skills.bowlingDeliveryTypes.padding3 = br.ReadByte();
Global.player[Index].skills.bowlingDeliveryTypes.slowerBallTopSpin = br.ReadByte();
Global.player[Index].skills.bowlingDeliveryTypes.padding4 = br.ReadByte();
Global.player[Index].skills.bowlingDeliveryTypes.bouncerSpecialDelivery = br.ReadByte();
Global.player[Index].skills.bowlingDeliveryTypes.padding5 = br.ReadUInt32(Endian.Big);
// Bowling Technique
Global.player[Index].skills.bowlingTechnique.padding1 = br.ReadByte();
Global.player[Index].skills.bowlingTechnique.bowlingSpeedFlight = br.ReadByte();
Global.player[Index].skills.bowlingTechnique.padding2 = br.ReadByte();
Global.player[Index].skills.bowlingTechnique.swingTurn = br.ReadByte();
Global.player[Index].skills.bowlingTechnique.padding3 = br.ReadByte();
Global.player[Index].skills.bowlingTechnique.seamBounce = br.ReadByte();
Global.player[Index].skills.bowlingTechnique.padding4 = br.ReadByte();
Global.player[Index].skills.bowlingTechnique.padding5 = br.ReadUInt16(Endian.Big);
Global.player[Index].skills.bowlingTechnique.accuracy = br.ReadByte();
Global.player[Index].skills.bowlingTechnique.padding6 = br.ReadUInt16(Endian.Big);
// Fielding Skills
Global.player[Index].skills.fieldingSkills.padding1 = br.ReadByte();
Global.player[Index].skills.fieldingSkills.catching = br.ReadByte();
Global.player[Index].skills.fieldingSkills.padding2 = br.ReadByte();
Global.player[Index].skills.fieldingSkills.reflexCatching = br.ReadByte();
Global.player[Index].skills.fieldingSkills.padding3 = br.ReadByte();
Global.player[Index].skills.fieldingSkills.throwAccuracy = br.ReadByte();
Global.player[Index].skills.fieldingSkills.padding4 = br.ReadByte();
Global.player[Index].skills.fieldingSkills.throwStrength = br.ReadByte();
Global.player[Index].skills.fieldingSkills.padding5 = br.ReadByte();
Global.player[Index].skills.fieldingSkills.groundFielding = br.ReadByte();
// Fielding Positions
Global.player[Index].skills.fieldingPositions.padding1 = br.ReadByte();
Global.player[Index].skills.fieldingPositions.wicketKeeping = br.ReadByte();
Global.player[Index].skills.fieldingPositions.padding2 = br.ReadByte();
Global.player[Index].skills.fieldingPositions.slipsBack = br.ReadByte();
Global.player[Index].skills.fieldingPositions.padding3 = br.ReadByte();
Global.player[Index].skills.fieldingPositions.closeUp = br.ReadByte();
Global.player[Index].skills.fieldingPositions.padding4 = br.ReadByte();
Global.player[Index].skills.fieldingPositions.infield = br.ReadByte();
Global.player[Index].skills.fieldingPositions.padding5 = br.ReadByte();
Global.player[Index].skills.fieldingPositions.outfield = br.ReadByte();
// Appearance Data
Global.player[Index].appearance.appearanceData = br.ReadBytes(940, Endian.Little);
Global.player[Index].sharingId = br.ReadInt32(Endian.Big);
Global.player[Index].rawData1 = br.ReadBytes(7, Endian.Little);
// Original Domestic Stats
Global.player[Index].origDomesticStatsCount = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats = new PlayerData.Statistics[4];
for (int j = 0; j < 4; j++)
{
Global.player[Index].origDomesticStats[j].runsScored = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].ballsFaced = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].padding1 = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].fours = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].sixes = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].innings = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].notOuts = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].padding2 = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].padding3 = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].padding4 = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].padding5 = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].padding6 = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].padding7 = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].ballsBowled = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].runsConceded = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].wicketsTaken = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].maidens = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].dotBalls = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].noBalls = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].wides = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].padding8 = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].runOuts = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].catches = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].padding9 = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].stumpings = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].topScore = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].topScoreNotOut = br.ReadUInt16(Endian.Big); // Top Score Not Out - (Bool)
Global.player[Index].origDomesticStats[j].ducks = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].hundreds = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].fifties = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].bifRuns = br.ReadUInt16(Endian.Big); // Best Innings Figures - Runs
Global.player[Index].origDomesticStats[j].bifWickets = br.ReadUInt16(Endian.Big); // Best Innings Figures - Wickets
Global.player[Index].origDomesticStats[j].bbfRuns = br.ReadUInt16(Endian.Big); // Best Bowlings Figures - Runs
Global.player[Index].origDomesticStats[j].bbfWickets = br.ReadUInt16(Endian.Big); // Best Bowlings Figures - Wickets
Global.player[Index].origDomesticStats[j].fiveWicketInnings = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].tenWicketMatches = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].matchesPlayed = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].padding10 = br.ReadUInt16(Endian.Big);
Global.player[Index].origDomesticStats[j].padding11 = br.ReadUInt16(Endian.Big);
}
// Current Domestic Stats
Global.player[Index].currDomesticStatsCount = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats = new PlayerData.Statistics[4];
for (int j = 0; j < 4; j++)
{
Global.player[Index].currDomesticStats[j].runsScored = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].ballsFaced = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].padding1 = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].fours = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].sixes = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].innings = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].notOuts = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].padding2 = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].padding3 = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].padding4 = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].padding5 = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].padding6 = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].padding7 = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].ballsBowled = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].runsConceded = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].wicketsTaken = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].maidens = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].dotBalls = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].noBalls = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].wides = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].padding8 = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].runOuts = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].catches = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].padding9 = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].stumpings = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].topScore = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].topScoreNotOut = br.ReadUInt16(Endian.Big); // Top Score Not Out - (Bool)
Global.player[Index].currDomesticStats[j].ducks = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].hundreds = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].fifties = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].bifRuns = br.ReadUInt16(Endian.Big); // Best Innings Figures - Runs
Global.player[Index].currDomesticStats[j].bifWickets = br.ReadUInt16(Endian.Big); // Best Innings Figures - Wickets
Global.player[Index].currDomesticStats[j].bbfRuns = br.ReadUInt16(Endian.Big); // Best Bowlings Figures - Runs
Global.player[Index].currDomesticStats[j].bbfWickets = br.ReadUInt16(Endian.Big); // Best Bowlings Figures - Wickets
Global.player[Index].currDomesticStats[j].fiveWicketInnings = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].tenWicketMatches = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].matchesPlayed = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].padding10 = br.ReadUInt16(Endian.Big);
Global.player[Index].currDomesticStats[j].padding11 = br.ReadUInt16(Endian.Big);
}
// Original International Stats
Global.player[Index].origInternationalStatsCount = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats = new PlayerData.Statistics[3];
for (int j = 0; j < 3; j++)
{
Global.player[Index].origInternationalStats[j].runsScored = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].ballsFaced = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].padding1 = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].fours = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].sixes = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].innings = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].notOuts = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].padding2 = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].padding3 = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].padding4 = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].padding5 = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].padding6 = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].padding7 = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].ballsBowled = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].runsConceded = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].wicketsTaken = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].maidens = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].dotBalls = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].noBalls = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].wides = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].padding8 = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].runOuts = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].catches = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].padding9 = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].stumpings = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].topScore = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].topScoreNotOut = br.ReadUInt16(Endian.Big); // Top Score Not Out - (Bool)
Global.player[Index].origInternationalStats[j].ducks = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].hundreds = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].fifties = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].bifRuns = br.ReadUInt16(Endian.Big); // Best Innings Figures - Runs
Global.player[Index].origInternationalStats[j].bifWickets = br.ReadUInt16(Endian.Big); // Best Innings Figures - Wickets
Global.player[Index].origInternationalStats[j].bbfRuns = br.ReadUInt16(Endian.Big); // Best Bowlings Figures - Runs
Global.player[Index].origInternationalStats[j].bbfWickets = br.ReadUInt16(Endian.Big); // Best Bowlings Figures - Wickets
Global.player[Index].origInternationalStats[j].fiveWicketInnings = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].tenWicketMatches = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].matchesPlayed = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].padding10 = br.ReadUInt16(Endian.Big);
Global.player[Index].origInternationalStats[j].padding11 = br.ReadUInt16(Endian.Big);
}
// Current International Stats
Global.player[Index].currInternationalStatsCount = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats = new PlayerData.Statistics[3];
for (int j = 0; j < 3; j++)
{
Global.player[Index].currInternationalStats[j].runsScored = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].ballsFaced = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].padding1 = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].fours = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].sixes = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].innings = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].notOuts = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].padding2 = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].padding3 = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].padding4 = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].padding5 = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].padding6 = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].padding7 = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].ballsBowled = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].runsConceded = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].wicketsTaken = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].maidens = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].dotBalls = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].noBalls = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].wides = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].padding8 = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].runOuts = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].catches = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].padding9 = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].stumpings = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].topScore = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].topScoreNotOut = br.ReadUInt16(Endian.Big); // Top Score Not Out - (Bool)
Global.player[Index].currInternationalStats[j].ducks = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].hundreds = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].fifties = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].bifRuns = br.ReadUInt16(Endian.Big); // Best Innings Figures - Runs
Global.player[Index].currInternationalStats[j].bifWickets = br.ReadUInt16(Endian.Big); // Best Innings Figures - Wickets
Global.player[Index].currInternationalStats[j].bbfRuns = br.ReadUInt16(Endian.Big); // Best Bowlings Figures - Runs
Global.player[Index].currInternationalStats[j].bbfWickets = br.ReadUInt16(Endian.Big); // Best Bowlings Figures - Wickets
Global.player[Index].currInternationalStats[j].fiveWicketInnings = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].tenWicketMatches = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].matchesPlayed = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].padding10 = br.ReadUInt16(Endian.Big);
Global.player[Index].currInternationalStats[j].padding11 = br.ReadUInt16(Endian.Big);
}
}
public static void ReadAllPlayerData()
{
Reader br = null;
try
{
br = new Reader(Assembly.GetExecutingAssembly().GetManifestResourceStream("DBC17_Academy_Save_Editor.Resources.OriginalPlayers.bin"));
for (int i = 0; i < Global.player_amount; i++)
{
if(Global.player[i].originalId == -1)
{
Global.allPlayers[i].playerId = Global.player[i].id;
Global.allPlayers[i].firstName = Global.player[i].firstName;
Global.allPlayers[i].lastName = Global.player[i].lastName;
}
else
{
Global.allPlayers[i].playerId = Global.player[i].originalId;
Global.allPlayers[i].firstName = Global.player[i].firstName;
Global.allPlayers[i].lastName = Global.player[i].lastName;
}
}
for (int i = 0; i < 3598; i++)
{
Global.allPlayers[i + Global.player_amount].playerId = br.ReadInt16(Endian.Little);
int firstNameLength = br.ReadUInt8();
Global.allPlayers[i + Global.player_amount].firstName = br.ReadString(firstNameLength, Endian.Little);
int lastNameLength = br.ReadUInt8();
Global.allPlayers[i + Global.player_amount].lastName = br.ReadString(lastNameLength, Endian.Little);
}
}
catch (Exception error)
{
MessageBox.Show("Error occurred, report it to Wouldy : " + error, "Hmm, something stuffed up :(", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
finally
{
if (br != null)
br.Close();
}
}
public static Bitmap[] imageList()
{
Bitmap[] Imagelist = new Bitmap[2];
try
{
Imagelist[0] = Properties.Resources.Male;
Imagelist[1] = Properties.Resources.Female;
}
catch (Exception error)
{
MessageBox.Show("Error occurred, report it to Wouldy : " + error, "Hmm, something stuffed up :(", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
return Imagelist;
}
}
}