Unity3D AssetStore 外部工具下载

参考https://www.jianshu.com/p/3ceb18e69d11

Unity 商店更新后还是没有很好得解决下载资源失败从头再来得问题。只好查找如何离线下载得文章,在简书上有一篇16年得文章利用反射机制调用编辑器解密下载文件得方法,但是因为unity得升级,该方法已经从AssetStoreUtils类里移除了。

解决方案

既然已经删除了DecryptFile函数,那反射肯定不行,那是不是可以从反编译得角度出发,找到该函数得实现方式,来直接解压。

资料查找

// 参考文档
https://github.com/jamesjlinden/unity-decompiled

实现

// 参考文档
//https://github.com/jamesjlinden/unity-decompiled
using UnityEditor;
using System;
using System.Globalization;
using System.IO;
using System.Security.Cryptography;class DecryptUtility
{[MenuItem("Utility/DecryptFile")]static void DecryptFile(){var inputFile = @"D:\2223333";var key = "11122222";//var unityEditor = typeof(Editor).Assembly;//var assetStoreUtils = unityEditor.GetType("UnityEditor.AssetStoreUtils");//assetStoreUtils.Invoke("DecryptFile", inputFile, inputFile + ".unitypackage", key);DecryptFile(inputFile, inputFile + ".unitypackage", key);}private static void HexStringToByteArray(string hex, byte[] array, int offset){if (offset + array.Length * 2 > hex.Length)throw new ArgumentException("Hex string too short");for (int index = 0; index < array.Length; ++index){string s = hex.Substring(index * 2 + offset, 2);array[index] = byte.Parse(s, NumberStyles.HexNumber);}}public static void DecryptFile(string inputFile, string outputFile, string keyIV){byte[] array1 = new byte[32];byte[] array2 = new byte[16];HexStringToByteArray(keyIV, array1, 0);HexStringToByteArray(keyIV, array2, 64);EditorUtility.DisplayProgressBar("Decrypting", "Decrypting package", 0.0f);FileStream fileStream1 = File.Open(inputFile, System.IO.FileMode.Open);FileStream fileStream2 = File.Open(outputFile, System.IO.FileMode.CreateNew);long length = fileStream1.Length;long num = 0;AesManaged aesManaged = new AesManaged();aesManaged.Key = array1;aesManaged.IV = array2;CryptoStream cryptoStream = new CryptoStream((Stream)fileStream1, aesManaged.CreateDecryptor(aesManaged.Key, aesManaged.IV), CryptoStreamMode.Read);try{byte[] numArray = new byte[40960];int count;while ((count = cryptoStream.Read(numArray, 0, numArray.Length)) > 0){fileStream2.Write(numArray, 0, count);num += (long)count;if (EditorUtility.DisplayCancelableProgressBar("Decrypting", "Decrypting package", (float)num / (float)length))throw new Exception("User cancelled decryption");}}finally{cryptoStream.Close();fileStream1.Close();fileStream2.Close();EditorUtility.ClearProgressBar();}}
}

Unity3D AssetStore 外部工具下载相关推荐

  1. Win/Mac/Linux下Unity3D引擎的下载安装

    前言 本文主要简单介绍一下unity3d引擎的下载安装问题. 一.下载Unity Hub 1.windows/mac系统 进入unity官网unity中文官网,点击右上角下载Unity,跳转到下载界面 ...

  2. [Unity]如果AssetStore的下载无效怎么办

    1.先检查网络是否正常. 2.如果还是点击 下载 按钮,没有进行下载. 就先进入网页版的assetstore,搜索对应的组件. https://www.assetstore.unity3d.com/ ...

  3. unity3D修改商店下载路径

    关于unity3D修改应用商店下载位置 (1)首先将位于C:\Users\Miss 卞\AppData\Roaming\Unity\Asset Store-5.x的文件夹剪切到想要的修改的位置上 (2 ...

  4. [unity3d] Asset Store 下载的package存在什么地方?

    最近因为在做3D实训,接触到unity3d游戏开发引擎,但是发现从Asset store下载的packages都不知道放在了什么地方,经过一通好找,终于成功的发现了... Windows 7,C:\U ...

  5. Unity3D图片的下载及保存

    代码如下: using UnityEngine; using System.Collections; using System.IO;public class DownPicture : MonoBe ...

  6. Unity3d 所有版本下载

    赶紧收藏起来吧~ Unity各种版本

  7. Unity3d Platformer Pro 2D游戏开发框架使用教程

    前言 Platformer Pro框架是Unity3d AssetStore上一个非常强大和受欢迎的2d游戏开发框架,这个教程的大部分翻译于官方文档,一部分是工作总结,还有一部分是视频教程文档化.这个 ...

  8. Unity3D 罗技G29开发笔记

    这些博客可能对你有帮助: https://blog.csdn.net/m0_38143858/article/details/79855923 https://blog.csdn.net/baozao ...

  9. 【AR】Vuforia之unity3d 开发环境搭建

    一.Unity3d环境搭建 下载安装包地址:https://developer.vuforia.com/downloads/sdk Download for Android Download for ...

最新文章

  1. Cassandra 总接归纳
  2. 磁盘及文件系统管理(三)
  3. Dubbo 3.0 前瞻之对接 Kubernetes 原生服务
  4. s5-15 开放的最短路径优先_OSPF
  5. SpringAMQP--发布订阅模型介绍
  6. 回顾2016,工作总结!
  7. 增强SEO的div+css命名规则
  8. 专线服务器安全维护,服务器系统安全维护
  9. c语言遗传算法在求解tsp问题,C语言遗传算法在求解TSP问题设计.doc
  10. javaweb项目通过F5负载,获取客户端真实ip
  11. 矩阵分析与应用学习总结目录
  12. 手机端如何维持登录状态
  13. HTML获取当前IP和当前位置
  14. 劈荆斩棘:Gitlab 部署 CI 持续集成
  15. Linux【问题记录 05】阿里云+腾讯云服务器挖矿木马 kthreaddk 处理记录+云服务器使用建议
  16. Qt 开发ARM64程序
  17. ROS机器人建模与仿真(一)——URDF模型的建立和改进
  18. 【渝粤教育】广东开放大学 普通心理学 形成性考核 (30)
  19. const是java的关键字_const关键字及其作用(用法),C语言const详解
  20. GoReplay 流量压测工具的使用

热门文章

  1. jdk 8.0报ignoring option PermSize MaxPermSize解决方法
  2. Zigbee CC2530 单片机存储 IAR查看内存
  3. 第一讲 VMware 软件安装和虚拟机创建
  4. 去掉Echarts饼状图的引导线
  5. jQuery实现拍打灰太狼小游戏
  6. 【自学Java】桌球游戏-边界检测,桌球碰撞反弹的实现,以及模拟真实运动,小球减速运动
  7. 年度社区app源码,简单唯美,对接hybbs,iapp开源
  8. Java期末复习题目合集
  9. 三星 scx-4021S 一体机 M2-1317错误怎么消除?
  10. java双人对战五子棋(socket通信)