Unity3D AssetStore 外部工具下载
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 外部工具下载相关推荐
- Win/Mac/Linux下Unity3D引擎的下载安装
前言 本文主要简单介绍一下unity3d引擎的下载安装问题. 一.下载Unity Hub 1.windows/mac系统 进入unity官网unity中文官网,点击右上角下载Unity,跳转到下载界面 ...
- [Unity]如果AssetStore的下载无效怎么办
1.先检查网络是否正常. 2.如果还是点击 下载 按钮,没有进行下载. 就先进入网页版的assetstore,搜索对应的组件. https://www.assetstore.unity3d.com/ ...
- unity3D修改商店下载路径
关于unity3D修改应用商店下载位置 (1)首先将位于C:\Users\Miss 卞\AppData\Roaming\Unity\Asset Store-5.x的文件夹剪切到想要的修改的位置上 (2 ...
- [unity3d] Asset Store 下载的package存在什么地方?
最近因为在做3D实训,接触到unity3d游戏开发引擎,但是发现从Asset store下载的packages都不知道放在了什么地方,经过一通好找,终于成功的发现了... Windows 7,C:\U ...
- Unity3D图片的下载及保存
代码如下: using UnityEngine; using System.Collections; using System.IO;public class DownPicture : MonoBe ...
- Unity3d 所有版本下载
赶紧收藏起来吧~ Unity各种版本
- Unity3d Platformer Pro 2D游戏开发框架使用教程
前言 Platformer Pro框架是Unity3d AssetStore上一个非常强大和受欢迎的2d游戏开发框架,这个教程的大部分翻译于官方文档,一部分是工作总结,还有一部分是视频教程文档化.这个 ...
- Unity3D 罗技G29开发笔记
这些博客可能对你有帮助: https://blog.csdn.net/m0_38143858/article/details/79855923 https://blog.csdn.net/baozao ...
- 【AR】Vuforia之unity3d 开发环境搭建
一.Unity3d环境搭建 下载安装包地址:https://developer.vuforia.com/downloads/sdk Download for Android Download for ...
最新文章
- Cassandra 总接归纳
- 磁盘及文件系统管理(三)
- Dubbo 3.0 前瞻之对接 Kubernetes 原生服务
- s5-15 开放的最短路径优先_OSPF
- SpringAMQP--发布订阅模型介绍
- 回顾2016,工作总结!
- 增强SEO的div+css命名规则
- 专线服务器安全维护,服务器系统安全维护
- c语言遗传算法在求解tsp问题,C语言遗传算法在求解TSP问题设计.doc
- javaweb项目通过F5负载,获取客户端真实ip
- 矩阵分析与应用学习总结目录
- 手机端如何维持登录状态
- HTML获取当前IP和当前位置
- 劈荆斩棘:Gitlab 部署 CI 持续集成
- Linux【问题记录 05】阿里云+腾讯云服务器挖矿木马 kthreaddk 处理记录+云服务器使用建议
- Qt 开发ARM64程序
- ROS机器人建模与仿真(一)——URDF模型的建立和改进
- 【渝粤教育】广东开放大学 普通心理学 形成性考核 (30)
- const是java的关键字_const关键字及其作用(用法),C语言const详解
- GoReplay 流量压测工具的使用