public static byte[] GetAssetData(string warfolder, Asset asset, int mypIndex) { string path = asset.Path; uint ph = 0, sh = 0; MYP.HashWAR(path, 0xDEADBEEF, out ph, out sh); long key = ((long)ph << 32) + sh; byte[] data = null; if (MYPHash.Hashes.ContainsKey(key)) { var myp = new MYP(); using (var stream = new FileStream(Path.Combine(warfolder, Hashes[key][mypIndex].ToString() + ".myp"), FileMode.Open, FileAccess.ReadWrite)) { myp.Load(stream); var mypFile = myp.GetByFilename(asset.Path); if (mypFile != null) { data = myp.ReadFile(stream, mypFile); } } } return(data); }
public static byte[] GetAssetData(string warfolder, long key, int mypIndex) { byte[] data = null; if (MYPHash.Hashes.ContainsKey(key)) { var myp = new MYP(); using (var stream = new FileStream(Path.Combine(warfolder, Hashes[key][mypIndex].ToString() + ".myp"), FileMode.Open, FileAccess.ReadWrite)) { myp.Load(stream); var mypFile = myp.GetByHash(key); if (mypFile != null) { data = myp.ReadFile(stream, mypFile); } } } return(data); }