예제 #1
0
        // Token: 0x06000758 RID: 1880 RVA: 0x0003045C File Offset: 0x0002E65C
        public static void Extract(string folderPath)
        {
            YSExport.Reset();
            YSExport._folderPath = folderPath;
            FileUtils.FindFile(folderPath, "*.*", delegate(FileInfo f)
            {
                string fullName = f.FullName;
                string text     = Path.GetExtension(fullName).ToLower();
                if (fullName.Contains("asset_index"))
                {
                    YSExport._blkInfo = YSAssetIndex.Read(fullName);
                    return;
                }
                if (text.Equals(".blk"))
                {
                    YSExport._unityList.Add(fullName);
                }
            });
            Console.WriteLine("Start Unpacking");
            if (YSExport._blkInfo.Count == 0)
            {
                Console.WriteLine("Error->The asset_index file was not found, please make sure that the asset_index and blocks folders are in the same directory");
                Console.WriteLine("Unpacking Failure");
            }
            else
            {
                foreach (string filePath in YSExport._unityList)
                {
                    byte[]             data        = FileUtils.ReadAllBytes(filePath);
                    TaskAwaiter <bool> taskAwaiter = YSExport.ExportUnityAsset(filePath, data).GetAwaiter();
                    if (!taskAwaiter.IsCompleted)
                    {
                        TaskAwaiter <bool> taskAwaiter2;
                        taskAwaiter2 = taskAwaiter;
                        taskAwaiter2 = default(TaskAwaiter <bool>);
                    }
                    if (taskAwaiter.GetResult())
                    {
                        Console.WriteLine(string.Format("Export->Success {0} Files Failure {1} Files {2}", ExportInfo.SuccessCount, ExportInfo.ErrorCount, Path.GetFileName(filePath)));
                    }
                }
                List <string> .Enumerator enumerator = default(List <string> .Enumerator);
                Console.WriteLine(string.Format("Decrypt->Success {0} Files Failure {1} Files\n", ExportInfo.SuccessCount, ExportInfo.ErrorCount));
//                await Task.Delay(500);
                Console.WriteLine("Export Path->" + Path.Combine(YSExport._folderPath, "blocks_export"));
                Console.WriteLine("Decryption completed, please use AssetStudio to extract resources");
            }
        }
예제 #2
0
		// Token: 0x06000750 RID: 1872 RVA: 0x0002FCFC File Offset: 0x0002DEFC
		public static Dictionary<int, List<int>> Read(string filePath)
		{
			YSAssetIndex._blkInfo.Clear();
			byte[] array = FileUtils.ReadAllBytes(filePath);
			if (array == null || array.Length < 255)
			{
				return YSAssetIndex._blkInfo;
			}
			Dictionary<int, List<int>> blkInfo;
			using (BinaryStream binaryStream = new BinaryStream(array, BinaryAccess.ReadWrite, null))
			{
				binaryStream.ReadInt32(BinaryEndian.LittleEndian);
				int num = 0;
				for (;;)
				{
					int num2 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					if (num2 > 255)
					{
						break;
					}
					binaryStream.ReadString(num2, null);
					num++;
				}
				binaryStream.Seek(binaryStream.Position - 4L, SeekOrigin.Begin);
				int num3 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
				for (int i = 0; i < num3; i++)
				{
					binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					int count = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					binaryStream.ReadString(count, null);
				}
				int num4 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
				for (int j = 0; j < num4; j++)
				{
					binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					int fileID = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					int offset = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					int num5 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					for (int k = 0; k < num5; k++)
					{
                        binaryStream.ReadInt32(BinaryEndian.LittleEndian);

                    }
					YSAssetIndex.AddBLKData(fileID, offset);
				}
				int num6 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
				for (int l = 0; l < num6; l++)
				{
					binaryStream.ReadInt32(BinaryEndian.LittleEndian);
				}
				int num7 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
				for (int m = 0; m < num7; m++)
				{
					binaryStream.ReadInt32(BinaryEndian.LittleEndian);
				}
				binaryStream.ReadUInt64(BinaryEndian.LittleEndian);
				int num8 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
				for (int n = 0; n < num8; n++)
				{
					binaryStream.ReadInt32(BinaryEndian.LittleEndian);
				}
				for (int num9 = 0; num9 < 13; num9++)
				{
					binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					int num10 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					for (int num11 = 0; num11 < num10; num11++)
					{
						binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					}
				}
				int num12 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
				for (int num13 = 0; num13 < num12; num13++)
				{
					int fileID2 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					int num14 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
					for (int num15 = 0; num15 < num14; num15++)
					{
						binaryStream.ReadInt32(BinaryEndian.LittleEndian);
						int offset2 = binaryStream.ReadInt32(BinaryEndian.LittleEndian);
						YSAssetIndex.AddBLKData(fileID2, offset2);
					}
				}
				blkInfo = YSAssetIndex._blkInfo;
			}
			return blkInfo;
		}