コード例 #1
0
        // Token: 0x06000759 RID: 1881 RVA: 0x000304A4 File Offset: 0x0002E6A4
        private static async Task <bool> ExportUnityAsset(string filePath, byte[] data)
        {
            try
            {
                if (data.Length != 0)
                {
                    BinaryStream binaryStream = new BinaryStream(data, BinaryAccess.ReadWrite, null);
                    {
                        binaryStream.ReadStringToNull(null);
                        binaryStream.ReadUInt32(BinaryEndian.LittleEndian);
                        byte[] key    = binaryStream.ReadBytes(32);
                        ushort size   = binaryStream.ReadUInt16(BinaryEndian.LittleEndian);
                        byte[] array  = binaryStream.ReadBytes();
                        byte[] array2 = YSDecrypt.InitKey(key, array, (int)size);
                        if (array2 != null)
                        {
                            int num = array2.Length;
                            for (int i = 0; i < array.Length; i++)
                            {
                                byte[] array3 = array;
                                int    num2   = i;
                                array3[num2] ^= array2[i % num];
                            }
                            string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath);
                            string text = Path.GetDirectoryName(filePath);
                            int    num3 = text.LastIndexOf("\\");
                            text = text.Substring(num3 + 1);
                            string text2 = Path.Combine(YSExport._folderPath, "blocks_export", text);
                            int    key2;
                            if (int.TryParse(fileNameWithoutExtension, out key2))
                            {
                                List <int> list;
                                if (YSExport._blkInfo.TryGetValue(key2, out list) && list.Count > 1)
                                {
                                    list.Sort();
                                    for (int j = 0; j < list.Count; j++)
                                    {
                                        int num4 = list[j];
                                        int num5;
                                        if (j != list.Count - 1)
                                        {
                                            num5 = list[j + 1] - num4;
                                        }
                                        else
                                        {
                                            num5 = array.Length - num4;
                                        }
                                        byte[] DecyptedData = new byte[num5];
                                        Buffer.BlockCopy(array, num4, DecyptedData, 0, num5);
                                        FileUtils.SaveFile(Path.Combine(text2, string.Format("{0}_{1}.unity3d", fileNameWithoutExtension, num4)), DecyptedData);
                                    }
                                }
                                else
                                {
                                    text2 = Path.Combine(text2, fileNameWithoutExtension + ".unity3d");
                                    FileUtils.SaveFile(text2, array);
                                }
                                ExportInfo.AddSuccess();
                                await Task.Delay(20);

                                return(true);
                            }
                            ExportInfo.AddError();
                            Console.WriteLine("\nError->" + filePath + "\n\tFailInfo->FileName Error");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExportInfo.AddError();
                Console.WriteLine(string.Concat(new string[]
                {
                    "\nError->",
                    filePath,
                    "\n\tFailInfo->",
                    ex.Message,
                    "\n\tStackInfo->",
                    ex.StackTrace
                }));
            }
            await Task.Delay(20);

            return(false);
        }
コード例 #2
0
 // Token: 0x0600075A RID: 1882 RVA: 0x0000F87C File Offset: 0x0000DA7C
 private static void Reset()
 {
     YSExport._blkInfo.Clear();
     YSExport._unityList.Clear();
     ExportInfo.Reset();
 }