} //end Decode public static PakTools.IndexRecord Decode_Index_FirstRecord(byte[] src) { var numArray = new byte[36]; Array.Copy(src, numArray, (int)numArray.Length); return(new PakTools.IndexRecord(PakTools.Decode(numArray, 4), 0)); } //end Decode_Index_FirstRecord
} //end struct public static byte[] LoadIndexData(string indexFile) { var numArray = File.ReadAllBytes(indexFile); var length = ((int)numArray.Length - 4) / 28; if ((int)numArray.Length < 32 || ((int)numArray.Length - 4) % 28 != 0) { return(null); } if (BitConverter.ToUInt32(numArray, 0) != length) { return(null); } if (!Regex.IsMatch(Encoding.Default.GetString(numArray, 8, 20), "^([a-zA-Z0-9_\\-\\.']+)", RegexOptions.IgnoreCase)) { if (!Regex.IsMatch(PakTools.Decode_Index_FirstRecord(numArray).FileName, "^([a-zA-Z0-9_\\-\\.']+)", RegexOptions.IgnoreCase)) { return(null); } numArray = PakTools.Decode(numArray, 4); } return(numArray); } //end LoadIndexData