private static bool IsVersionValid(MiloVersion version) { switch (version) { case MiloVersion.V6: // FreQ case MiloVersion.V10: // Amp/KR/GH1 case MiloVersion.V24: // GH2(PS2) case MiloVersion.V25: // RB/GH2(X360) case MiloVersion.V28: // RB3 case MiloVersion.V32: // RBB/DC3 return(true); default: return(false); } }
private static bool DetermineEndianess(byte[] head, out MiloVersion version, out bool valid) { bool bigEndian = false; version = (MiloVersion)BitConverter.ToInt32(head, 0); valid = IsVersionValid(version); checkVersion: if (!valid && !bigEndian) { bigEndian = !bigEndian; Array.Reverse(head); version = (MiloVersion)BitConverter.ToInt32(head, 0); valid = IsVersionValid(version); goto checkVersion; } return(bigEndian); }
private static void ParseEntryNames(AwesomeReader ar, MiloVersion version, out string dirName, out string dirType, out string[] names, out string[] types) { dirName = dirType = ""; // Only used on versions 24+ int count; if ((int)version >= 24) { // Parse directory name + type dirType = ar.ReadString(); dirName = ar.ReadString(); ar.BaseStream.Position += 8; // Skips weird counts } count = ar.ReadInt32(); names = new string[count]; types = new string[count]; for (int i = 0; i < count; i++) { // Reads entry name + type types[i] = ar.ReadString(); names[i] = ar.ReadString(); } }