public static async Task <Dictionary <long, List <MythicPackage> > > GetMythicHashList(string warfolder)
        {
            Dictionary <long, List <MythicPackage> > results = new Dictionary <long, List <MythicPackage> >();
            await Task.Run(() =>
            {
                foreach (string file in Directory.GetFiles(warfolder, "*.MYP"))
                {
                    MythicPackage p;
                    if (Enum.TryParse <MythicPackage>(Path.GetFileNameWithoutExtension(file).ToUpper(), out p))
                    {
                        var myp = new MYP();
                        using (var stream = new FileStream(file, FileMode.Open, FileAccess.Read))
                        {
                            myp.Load(stream);
                            foreach (long key in myp.Files.Keys)
                            {
                                if (!results.ContainsKey(key))
                                {
                                    results[key] = new List <MythicPackage>();
                                }
                                results[key].Add(p);
                            }
                        }
                    }
                }
            });

            return(results);
        }
        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 async Task SaveAsset(string warfolder, Asset asset, byte[] data, int mypIndex)
        {
            List <MythicPackage> p = Hashes[MYP.HashWAR(asset.Path)];

            using (var stream = new FileStream(Path.Combine(warfolder, p[mypIndex].ToString() + ".myp"), FileMode.Open, FileAccess.ReadWrite))
            {
                var myp = new MYP();
                myp.Load(stream);
                var mypFile = myp.GetByFilename(asset.Path);
                if (mypFile != null)
                {
                    myp.WriteFile(stream, mypFile, 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);
        }