示例#1
0
        /// <summary>
        /// We get the file list of currentPak, we find all files that matched our currentItem, for each result we get its index (it's used to get its data)
        /// Then we can use WriteFile to write each results with its data
        /// If currentPak is the same twice in a row, we do not try to get a new file list
        /// </summary>
        /// <param name="currentPak"></param>
        /// <param name="currentItem"></param>
        /// <returns> the path of the last created file (usually the uexp file but we don't care about the extension, so it's fine) </returns>
        public static string ExtractAsset(string currentPak, string currentItem)
        {
            if (currentPak != currentPakToCheck || myArray == null)
            {
                MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + currentPak, MyKey);
                myArray     = MyExtractor.GetFileList().ToArray();
            }

            string[] results;
            if (currentItem.Contains("."))
            {
                results = Array.FindAll(myArray, s => s.Contains("/" + currentItem));
            }
            else
            {
                results = Array.FindAll(myArray, s => s.Contains("/" + currentItem + "."));
            }

            string AssetPath = string.Empty;

            for (int i = 0; i < results.Length; i++)
            {
                int index = Array.IndexOf(myArray, results[i]);

                uint   y = (uint)index;
                byte[] b = MyExtractor.GetData(y);

                AssetPath = WriteFile(currentItem, results[i], b).Replace("/", "\\");
            }

            currentPakToCheck = currentPak;
            return(AssetPath);
        }
示例#2
0
        /// <summary>
        /// We get the file list of currentPak, we find all files that matched our currentItem, for each result we get its index (it's used to get its data)
        /// Then we can use WriteFile to write each results with its data
        /// If currentPak is the same twice in a row, we do not try to get a new file list
        /// </summary>
        /// <param name="currentPak"></param>
        /// <param name="currentItem"></param>
        /// <returns> the path of the last created file (usually the uexp file but we don't care about the extension, so it's fine) </returns>
        public static string ExtractAsset(string currentPak, string currentItem)
        {
            string pakGuid = ThePak.dynamicPaksList.Where(x => x.thePak == currentPak).Select(x => x.thePakGuid).FirstOrDefault();
            string myKey   = string.Empty;

            if (!string.IsNullOrEmpty(pakGuid) && pakGuid != "0-0-0-0")
            {
                myKey = DynamicKeysManager.AESEntries.Where(x => x.thePak == currentPak).Select(x => x.theKey).FirstOrDefault();
            }
            else
            {
                myKey = Settings.Default.AESKey;
            }

            PakExtractor pakExtractor = ThePak.PaksExtractorDictionary[currentPak];

            string[] pakFiles = ThePak.PaksFileArrayDictionary[pakExtractor];

            string[] results = currentItem.Contains(".") ? Array.FindAll(pakFiles, s => s.Contains("/" + currentItem)) : Array.FindAll(pakFiles, s => s.Contains("/" + currentItem + "."));

            string AssetPath = string.Empty;

            for (int i = 0; i < results.Length; i++)
            {
                if (results[i].Contains("DisplayAssets/EID_BlackMondayFemale_6HO4L.uasset"))
                {
                    break;
                }

                int index = Array.IndexOf(pakFiles, results[i]);

                uint   y = (uint)index;
                byte[] b = pakExtractor.GetData(y);

                AssetPath = WriteFile(results[i], b).Replace("/", "\\");
            }

            pakExtractor = null;
            pakFiles     = null;
            return(AssetPath);
        }