mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-23 17:20:12 +00:00
feat : 改进资源清单加密和解密接口
This commit is contained in:
@@ -79,15 +79,27 @@ namespace YooAsset.Editor
|
|||||||
EditorPrefs.SetString(key, encyptionClassName);
|
EditorPrefs.SetString(key, encyptionClassName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ManifestServicesClassName
|
// ManifestProcessServicesClassName
|
||||||
public static string GetPackageManifestServicesClassName(string packageName, string buildPipeline)
|
public static string GetPackageManifestProcessServicesClassName(string packageName, string buildPipeline)
|
||||||
{
|
{
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestServicesClassName";
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestProcessServicesClassName";
|
||||||
return EditorPrefs.GetString(key, $"{typeof(ManifestNone).FullName}");
|
return EditorPrefs.GetString(key, $"{typeof(ManifestProcessNone).FullName}");
|
||||||
}
|
}
|
||||||
public static void SetPackageManifestServicesClassName(string packageName, string buildPipeline, string encyptionClassName)
|
public static void SetPackageManifestProcessServicesClassName(string packageName, string buildPipeline, string encyptionClassName)
|
||||||
{
|
{
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestServicesClassName";
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestProcessServicesClassName";
|
||||||
|
EditorPrefs.SetString(key, encyptionClassName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ManifestRestoreServicesClassName
|
||||||
|
public static string GetPackageManifestRestoreServicesClassName(string packageName, string buildPipeline)
|
||||||
|
{
|
||||||
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestRestoreServicesClassName";
|
||||||
|
return EditorPrefs.GetString(key, $"{typeof(ManifestRestoreNone).FullName}");
|
||||||
|
}
|
||||||
|
public static void SetPackageManifestRestoreServicesClassName(string packageName, string buildPipeline, string encyptionClassName)
|
||||||
|
{
|
||||||
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ManifestRestoreServicesClassName";
|
||||||
EditorPrefs.SetString(key, encyptionClassName);
|
EditorPrefs.SetString(key, encyptionClassName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,10 +99,14 @@ namespace YooAsset.Editor
|
|||||||
public IEncryptionServices EncryptionServices;
|
public IEncryptionServices EncryptionServices;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源清单服务类
|
/// 资源清单加密服务类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IManifestServices ManifestServices;
|
public IManifestProcessServices ManifestProcessServices;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 资源清单解密服务类
|
||||||
|
/// </summary>
|
||||||
|
public IManifestRestoreServices ManifestRestoreServices;
|
||||||
|
|
||||||
private string _pipelineOutputDirectory = string.Empty;
|
private string _pipelineOutputDirectory = string.Empty;
|
||||||
private string _packageOutputDirectory = string.Empty;
|
private string _packageOutputDirectory = string.Empty;
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
string buildinRootDirectory = buildParametersContext.GetBuildinRootDirectory();
|
string buildinRootDirectory = buildParametersContext.GetBuildinRootDirectory();
|
||||||
string buildPackageName = buildParametersContext.Parameters.PackageName;
|
string buildPackageName = buildParametersContext.Parameters.PackageName;
|
||||||
var manifestServices = buildParametersContext.Parameters.ManifestServices;
|
var manifestServices = buildParametersContext.Parameters.ManifestRestoreServices;
|
||||||
DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(manifestServices, buildPackageName, buildinRootDirectory);
|
CatalogTools.CreateCatalogFile(manifestServices, buildPackageName, buildinRootDirectory);
|
||||||
|
|
||||||
// 刷新目录
|
// 刷新目录
|
||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
|
||||||
packagePath = $"{packageOutputDirectory}/{fileName}";
|
packagePath = $"{packageOutputDirectory}/{fileName}";
|
||||||
ManifestTools.SerializeToBinary(packagePath, manifest, buildParameters.ManifestServices);
|
ManifestTools.SerializeToBinary(packagePath, manifest, buildParameters.ManifestProcessServices);
|
||||||
packageHash = HashUtility.FileCRC32(packagePath);
|
packageHash = HashUtility.FileCRC32(packagePath);
|
||||||
BuildLogger.Log($"Create package manifest file: {packagePath}");
|
BuildLogger.Log($"Create package manifest file: {packagePath}");
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
ManifestContext manifestContext = new ManifestContext();
|
ManifestContext manifestContext = new ManifestContext();
|
||||||
byte[] bytesData = FileUtility.ReadAllBytes(packagePath);
|
byte[] bytesData = FileUtility.ReadAllBytes(packagePath);
|
||||||
manifestContext.Manifest = ManifestTools.DeserializeFromBinary(bytesData, buildParameters.ManifestServices);
|
manifestContext.Manifest = ManifestTools.DeserializeFromBinary(bytesData, buildParameters.ManifestRestoreServices);
|
||||||
context.SetContextObject(manifestContext);
|
context.SetContextObject(manifestContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ namespace YooAsset.Editor
|
|||||||
buildReport.Summary.SingleReferencedPackAlone = buildParameters.SingleReferencedPackAlone;
|
buildReport.Summary.SingleReferencedPackAlone = buildParameters.SingleReferencedPackAlone;
|
||||||
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
|
||||||
buildReport.Summary.EncryptionServicesClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
buildReport.Summary.EncryptionServicesClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
||||||
buildReport.Summary.ManifestServicesClassName = buildParameters.ManifestServices == null ? "null" : buildParameters.ManifestServices.GetType().FullName;
|
buildReport.Summary.ManifestProcessServicesClassName = buildParameters.ManifestProcessServices == null ? "null" : buildParameters.ManifestProcessServices.GetType().FullName;
|
||||||
|
buildReport.Summary.ManifestRestoreServicesClassName = buildParameters.ManifestRestoreServices == null ? "null" : buildParameters.ManifestRestoreServices.GetType().FullName;
|
||||||
|
|
||||||
if (buildParameters is BuiltinBuildParameters)
|
if (buildParameters is BuiltinBuildParameters)
|
||||||
{
|
{
|
||||||
var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
|
var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
public class ManifestNone : IManifestServices
|
public class ManifestProcessNone : IManifestProcessServices
|
||||||
{
|
{
|
||||||
public byte[] ProcessManifest(byte[] fileData)
|
byte[] IManifestProcessServices.ProcessManifest(byte[] fileData)
|
||||||
{
|
{
|
||||||
return fileData;
|
return fileData;
|
||||||
}
|
}
|
||||||
public byte[] RestoreManifest(byte[] fileData)
|
}
|
||||||
|
|
||||||
|
public class ManifestRestoreNone : IManifestRestoreServices
|
||||||
|
{
|
||||||
|
byte[] IManifestRestoreServices.RestoreManifest(byte[] fileData)
|
||||||
{
|
{
|
||||||
return fileData;
|
return fileData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建资源加密服务类实例
|
/// 创建资源包加密服务类实例
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected IEncryptionServices CreateEncryptionServicesInstance()
|
protected IEncryptionServices CreateEncryptionServicesInstance()
|
||||||
{
|
{
|
||||||
@@ -58,15 +58,29 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建资源清单服务类实例
|
/// 创建资源清单加密服务类实例
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected IManifestServices CreateManifestServicesInstance()
|
protected IManifestProcessServices CreateManifestProcessServicesInstance()
|
||||||
{
|
{
|
||||||
var className = AssetBundleBuilderSetting.GetPackageManifestServicesClassName(PackageName, PipelineName);
|
var className = AssetBundleBuilderSetting.GetPackageManifestProcessServicesClassName(PackageName, PipelineName);
|
||||||
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestServices));
|
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestProcessServices));
|
||||||
var classType = classTypes.Find(x => x.FullName.Equals(className));
|
var classType = classTypes.Find(x => x.FullName.Equals(className));
|
||||||
if (classType != null)
|
if (classType != null)
|
||||||
return (IManifestServices)Activator.CreateInstance(classType);
|
return (IManifestProcessServices)Activator.CreateInstance(classType);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建资源清单解密服务类实例
|
||||||
|
/// </summary>
|
||||||
|
protected IManifestRestoreServices CreateManifestRestoreServicesInstance()
|
||||||
|
{
|
||||||
|
var className = AssetBundleBuilderSetting.GetPackageManifestRestoreServicesClassName(PackageName, PipelineName);
|
||||||
|
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestRestoreServices));
|
||||||
|
var classType = classTypes.Find(x => x.FullName.Equals(className));
|
||||||
|
if (classType != null)
|
||||||
|
return (IManifestRestoreServices)Activator.CreateInstance(classType);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -169,7 +183,7 @@ namespace YooAsset.Editor
|
|||||||
}
|
}
|
||||||
protected PopupField<Type> CreateEncryptionServicesField(VisualElement container)
|
protected PopupField<Type> CreateEncryptionServicesField(VisualElement container)
|
||||||
{
|
{
|
||||||
// 加密服务类
|
// 资源包加密服务类
|
||||||
var classTypes = EditorTools.GetAssignableTypes(typeof(IEncryptionServices));
|
var classTypes = EditorTools.GetAssignableTypes(typeof(IEncryptionServices));
|
||||||
if (classTypes.Count > 0)
|
if (classTypes.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -198,22 +212,22 @@ namespace YooAsset.Editor
|
|||||||
return popupField;
|
return popupField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected PopupField<Type> CreateManifestServicesField(VisualElement container)
|
protected PopupField<Type> CreateManifestProcessServicesField(VisualElement container)
|
||||||
{
|
{
|
||||||
// 清单服务类
|
// 资源清单加密服务类
|
||||||
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestServices));
|
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestProcessServices));
|
||||||
if (classTypes.Count > 0)
|
if (classTypes.Count > 0)
|
||||||
{
|
{
|
||||||
var className = AssetBundleBuilderSetting.GetPackageManifestServicesClassName(PackageName, PipelineName);
|
var className = AssetBundleBuilderSetting.GetPackageManifestProcessServicesClassName(PackageName, PipelineName);
|
||||||
int defaultIndex = classTypes.FindIndex(x => x.FullName.Equals(className));
|
int defaultIndex = classTypes.FindIndex(x => x.FullName.Equals(className));
|
||||||
if (defaultIndex < 0)
|
if (defaultIndex < 0)
|
||||||
defaultIndex = 0;
|
defaultIndex = 0;
|
||||||
var popupField = new PopupField<Type>(classTypes, defaultIndex);
|
var popupField = new PopupField<Type>(classTypes, defaultIndex);
|
||||||
popupField.label = "Manifest Services";
|
popupField.label = "Manifest Process Services";
|
||||||
popupField.style.width = StyleWidth;
|
popupField.style.width = StyleWidth;
|
||||||
popupField.RegisterValueChangedCallback(evt =>
|
popupField.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
AssetBundleBuilderSetting.SetPackageManifestServicesClassName(PackageName, PipelineName, popupField.value.FullName);
|
AssetBundleBuilderSetting.SetPackageManifestProcessServicesClassName(PackageName, PipelineName, popupField.value.FullName);
|
||||||
});
|
});
|
||||||
container.Add(popupField);
|
container.Add(popupField);
|
||||||
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||||
@@ -222,7 +236,38 @@ namespace YooAsset.Editor
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var popupField = new PopupField<Type>();
|
var popupField = new PopupField<Type>();
|
||||||
popupField.label = "Manifest Services";
|
popupField.label = "Manifest Process Services";
|
||||||
|
popupField.style.width = StyleWidth;
|
||||||
|
container.Add(popupField);
|
||||||
|
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||||
|
return popupField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected PopupField<Type> CreateManifestRestoreServicesField(VisualElement container)
|
||||||
|
{
|
||||||
|
// 资源清单加密服务类
|
||||||
|
var classTypes = EditorTools.GetAssignableTypes(typeof(IManifestRestoreServices));
|
||||||
|
if (classTypes.Count > 0)
|
||||||
|
{
|
||||||
|
var className = AssetBundleBuilderSetting.GetPackageManifestRestoreServicesClassName(PackageName, PipelineName);
|
||||||
|
int defaultIndex = classTypes.FindIndex(x => x.FullName.Equals(className));
|
||||||
|
if (defaultIndex < 0)
|
||||||
|
defaultIndex = 0;
|
||||||
|
var popupField = new PopupField<Type>(classTypes, defaultIndex);
|
||||||
|
popupField.label = "Manifest Restore Services";
|
||||||
|
popupField.style.width = StyleWidth;
|
||||||
|
popupField.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
AssetBundleBuilderSetting.SetPackageManifestRestoreServicesClassName(PackageName, PipelineName, popupField.value.FullName);
|
||||||
|
});
|
||||||
|
container.Add(popupField);
|
||||||
|
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||||
|
return popupField;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var popupField = new PopupField<Type>();
|
||||||
|
popupField.label = "Manifest Restore Services";
|
||||||
popupField.style.width = StyleWidth;
|
popupField.style.width = StyleWidth;
|
||||||
container.Add(popupField);
|
container.Add(popupField);
|
||||||
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
UIElementsTools.SetElementLabelMinWidth(popupField, LabelMinWidth);
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ namespace YooAsset.Editor
|
|||||||
protected TextField _buildOutputField;
|
protected TextField _buildOutputField;
|
||||||
protected TextField _buildVersionField;
|
protected TextField _buildVersionField;
|
||||||
protected PopupField<Type> _encryptionServicesField;
|
protected PopupField<Type> _encryptionServicesField;
|
||||||
protected PopupField<Type> _manifestServicesField;
|
protected PopupField<Type> _manifestProcessServicesField;
|
||||||
|
protected PopupField<Type> _manifestRestoreServicesField;
|
||||||
protected EnumField _compressionField;
|
protected EnumField _compressionField;
|
||||||
protected EnumField _outputNameStyleField;
|
protected EnumField _outputNameStyleField;
|
||||||
protected EnumField _copyBuildinFileOptionField;
|
protected EnumField _copyBuildinFileOptionField;
|
||||||
@@ -47,7 +48,8 @@ namespace YooAsset.Editor
|
|||||||
// 服务类
|
// 服务类
|
||||||
var popupContainer = Root.Q("PopupContainer");
|
var popupContainer = Root.Q("PopupContainer");
|
||||||
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
||||||
_manifestServicesField = CreateManifestServicesField(popupContainer);
|
_manifestProcessServicesField = CreateManifestProcessServicesField(popupContainer);
|
||||||
|
_manifestRestoreServicesField = CreateManifestRestoreServicesField(popupContainer);
|
||||||
|
|
||||||
// 压缩方式选项
|
// 压缩方式选项
|
||||||
_compressionField = Root.Q<EnumField>("Compression");
|
_compressionField = Root.Q<EnumField>("Compression");
|
||||||
@@ -120,7 +122,8 @@ namespace YooAsset.Editor
|
|||||||
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
||||||
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
||||||
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||||
buildParameters.ManifestServices = CreateManifestServicesInstance();
|
buildParameters.ManifestProcessServices = CreateManifestProcessServicesInstance();
|
||||||
|
buildParameters.ManifestRestoreServices = CreateManifestRestoreServicesInstance();
|
||||||
|
|
||||||
BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
|
BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ namespace YooAsset.Editor
|
|||||||
protected TextField _buildOutputField;
|
protected TextField _buildOutputField;
|
||||||
protected TextField _buildVersionField;
|
protected TextField _buildVersionField;
|
||||||
protected PopupField<Type> _encryptionServicesField;
|
protected PopupField<Type> _encryptionServicesField;
|
||||||
protected PopupField<Type> _manifestServicesField;
|
protected PopupField<Type> _manifestProcessServicesField;
|
||||||
|
protected PopupField<Type> _manifestRestoreServicesField;
|
||||||
protected EnumField _outputNameStyleField;
|
protected EnumField _outputNameStyleField;
|
||||||
protected EnumField _copyBuildinFileOptionField;
|
protected EnumField _copyBuildinFileOptionField;
|
||||||
protected TextField _copyBuildinFileTagsField;
|
protected TextField _copyBuildinFileTagsField;
|
||||||
@@ -46,7 +47,8 @@ namespace YooAsset.Editor
|
|||||||
// 加密方法
|
// 加密方法
|
||||||
var popupContainer = Root.Q("PopupContainer");
|
var popupContainer = Root.Q("PopupContainer");
|
||||||
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
||||||
_manifestServicesField = CreateManifestServicesField(popupContainer);
|
_manifestProcessServicesField = CreateManifestProcessServicesField(popupContainer);
|
||||||
|
_manifestRestoreServicesField = CreateManifestRestoreServicesField(popupContainer);
|
||||||
|
|
||||||
// 输出文件名称样式
|
// 输出文件名称样式
|
||||||
_outputNameStyleField = Root.Q<EnumField>("FileNameStyle");
|
_outputNameStyleField = Root.Q<EnumField>("FileNameStyle");
|
||||||
@@ -112,7 +114,8 @@ namespace YooAsset.Editor
|
|||||||
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
||||||
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
||||||
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||||
buildParameters.ManifestServices = CreateManifestServicesInstance();
|
buildParameters.ManifestProcessServices = CreateManifestProcessServicesInstance();
|
||||||
|
buildParameters.ManifestRestoreServices = CreateManifestRestoreServicesInstance();
|
||||||
|
|
||||||
RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
|
RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ namespace YooAsset.Editor
|
|||||||
protected TextField _buildOutputField;
|
protected TextField _buildOutputField;
|
||||||
protected TextField _buildVersionField;
|
protected TextField _buildVersionField;
|
||||||
protected PopupField<Type> _encryptionServicesField;
|
protected PopupField<Type> _encryptionServicesField;
|
||||||
protected PopupField<Type> _manifestServicesField;
|
protected PopupField<Type> _manifestProcessServicesField;
|
||||||
|
protected PopupField<Type> _manifestRestoreServicesField;
|
||||||
protected EnumField _compressionField;
|
protected EnumField _compressionField;
|
||||||
protected EnumField _outputNameStyleField;
|
protected EnumField _outputNameStyleField;
|
||||||
protected EnumField _copyBuildinFileOptionField;
|
protected EnumField _copyBuildinFileOptionField;
|
||||||
@@ -47,7 +48,8 @@ namespace YooAsset.Editor
|
|||||||
// 加密方法
|
// 加密方法
|
||||||
var popupContainer = Root.Q("PopupContainer");
|
var popupContainer = Root.Q("PopupContainer");
|
||||||
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
_encryptionServicesField = CreateEncryptionServicesField(popupContainer);
|
||||||
_manifestServicesField = CreateManifestServicesField(popupContainer);
|
_manifestProcessServicesField = CreateManifestProcessServicesField(popupContainer);
|
||||||
|
_manifestRestoreServicesField = CreateManifestRestoreServicesField(popupContainer);
|
||||||
|
|
||||||
// 压缩方式选项
|
// 压缩方式选项
|
||||||
_compressionField = Root.Q<EnumField>("Compression");
|
_compressionField = Root.Q<EnumField>("Compression");
|
||||||
@@ -122,7 +124,8 @@ namespace YooAsset.Editor
|
|||||||
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
buildParameters.UseAssetDependencyDB = useAssetDependencyDB;
|
||||||
buildParameters.BuiltinShadersBundleName = builtinShaderBundleName;
|
buildParameters.BuiltinShadersBundleName = builtinShaderBundleName;
|
||||||
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||||
buildParameters.ManifestServices = CreateManifestServicesInstance();
|
buildParameters.ManifestProcessServices = CreateManifestProcessServicesInstance();
|
||||||
|
buildParameters.ManifestRestoreServices = CreateManifestRestoreServicesInstance();
|
||||||
|
|
||||||
ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
|
ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ namespace YooAsset.Editor
|
|||||||
public bool EnableSharePackRule;
|
public bool EnableSharePackRule;
|
||||||
public bool SingleReferencedPackAlone;
|
public bool SingleReferencedPackAlone;
|
||||||
public string EncryptionServicesClassName;
|
public string EncryptionServicesClassName;
|
||||||
public string ManifestServicesClassName;
|
public string ManifestProcessServicesClassName;
|
||||||
|
public string ManifestRestoreServicesClassName;
|
||||||
public EFileNameStyle FileNameStyle;
|
public EFileNameStyle FileNameStyle;
|
||||||
|
|
||||||
// 引擎参数
|
// 引擎参数
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ namespace YooAsset.Editor
|
|||||||
BindListViewItem("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}");
|
BindListViewItem("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}");
|
||||||
BindListViewItem("Single Referenced Pack Alone", $"{buildReport.Summary.SingleReferencedPackAlone}");
|
BindListViewItem("Single Referenced Pack Alone", $"{buildReport.Summary.SingleReferencedPackAlone}");
|
||||||
BindListViewItem("Encryption Services", buildReport.Summary.EncryptionServicesClassName);
|
BindListViewItem("Encryption Services", buildReport.Summary.EncryptionServicesClassName);
|
||||||
BindListViewItem("Manifest Services", buildReport.Summary.ManifestServicesClassName);
|
BindListViewItem("Manifest Process Services", buildReport.Summary.ManifestProcessServicesClassName);
|
||||||
|
BindListViewItem("Manifest Restore Services", buildReport.Summary.ManifestRestoreServicesClassName);
|
||||||
BindListViewItem("FileNameStyle", $"{buildReport.Summary.FileNameStyle}");
|
BindListViewItem("FileNameStyle", $"{buildReport.Summary.FileNameStyle}");
|
||||||
BindListViewItem("CompressOption", $"{buildReport.Summary.CompressOption}");
|
BindListViewItem("CompressOption", $"{buildReport.Summary.CompressOption}");
|
||||||
BindListViewItem("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}");
|
BindListViewItem("DisableWriteTypeTree", $"{buildReport.Summary.DisableWriteTypeTree}");
|
||||||
|
|||||||
@@ -7,6 +7,114 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
internal static class CatalogTools
|
internal static class CatalogTools
|
||||||
{
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
/// <summary>
|
||||||
|
/// 生成包裹的内置资源目录文件
|
||||||
|
/// 说明:根据指定目录下的文件生成清单文件。
|
||||||
|
/// </summary>
|
||||||
|
public static bool CreateCatalogFile(IManifestRestoreServices services, string packageName, string packageDirectory)
|
||||||
|
{
|
||||||
|
// 获取资源清单版本
|
||||||
|
string packageVersion;
|
||||||
|
{
|
||||||
|
string versionFileName = YooAssetSettingsData.GetPackageVersionFileName(packageName);
|
||||||
|
string versionFilePath = $"{packageDirectory}/{versionFileName}";
|
||||||
|
if (File.Exists(versionFilePath) == false)
|
||||||
|
{
|
||||||
|
Debug.LogError($"Can not found package version file : {versionFilePath}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
packageVersion = FileUtility.ReadAllText(versionFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载资源清单文件
|
||||||
|
PackageManifest packageManifest;
|
||||||
|
{
|
||||||
|
string manifestFileName = YooAssetSettingsData.GetManifestBinaryFileName(packageName, packageVersion);
|
||||||
|
string manifestFilePath = $"{packageDirectory}/{manifestFileName}";
|
||||||
|
if (File.Exists(manifestFilePath) == false)
|
||||||
|
{
|
||||||
|
Debug.LogError($"Can not found package manifest file : {manifestFilePath}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var binaryData = FileUtility.ReadAllBytes(manifestFilePath);
|
||||||
|
packageManifest = ManifestTools.DeserializeFromBinary(binaryData, services);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取文件名映射关系
|
||||||
|
Dictionary<string, string> fileMapping = new Dictionary<string, string>();
|
||||||
|
{
|
||||||
|
foreach (var packageBundle in packageManifest.BundleList)
|
||||||
|
{
|
||||||
|
fileMapping.Add(packageBundle.FileName, packageBundle.BundleGUID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建内置清单实例
|
||||||
|
var buildinFileCatalog = new DefaultBuildinFileCatalog();
|
||||||
|
buildinFileCatalog.FileVersion = CatalogDefine.FileVersion;
|
||||||
|
buildinFileCatalog.PackageName = packageName;
|
||||||
|
buildinFileCatalog.PackageVersion = packageVersion;
|
||||||
|
|
||||||
|
// 创建白名单查询集合
|
||||||
|
HashSet<string> whiteFileList = new HashSet<string>
|
||||||
|
{
|
||||||
|
"link.xml",
|
||||||
|
"buildlogtep.json",
|
||||||
|
$"{packageName}.version",
|
||||||
|
$"{packageName}_{packageVersion}.bytes",
|
||||||
|
$"{packageName}_{packageVersion}.hash",
|
||||||
|
$"{packageName}_{packageVersion}.json",
|
||||||
|
$"{packageName}_{packageVersion}.report",
|
||||||
|
DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName,
|
||||||
|
DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName
|
||||||
|
};
|
||||||
|
|
||||||
|
// 记录所有内置资源文件
|
||||||
|
DirectoryInfo rootDirectory = new DirectoryInfo(packageDirectory);
|
||||||
|
FileInfo[] fileInfos = rootDirectory.GetFiles();
|
||||||
|
foreach (var fileInfo in fileInfos)
|
||||||
|
{
|
||||||
|
if (fileInfo.Extension == ".meta")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (whiteFileList.Contains(fileInfo.Name))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string fileName = fileInfo.Name;
|
||||||
|
if (fileMapping.TryGetValue(fileName, out string bundleGUID))
|
||||||
|
{
|
||||||
|
var wrapper = new DefaultBuildinFileCatalog.FileWrapper();
|
||||||
|
wrapper.BundleGUID = bundleGUID;
|
||||||
|
wrapper.FileName = fileName;
|
||||||
|
buildinFileCatalog.Wrappers.Add(wrapper);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"Failed mapping file : {fileName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建输出文件
|
||||||
|
string jsonFilePath = $"{packageDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName}";
|
||||||
|
if (File.Exists(jsonFilePath))
|
||||||
|
File.Delete(jsonFilePath);
|
||||||
|
SerializeToJson(jsonFilePath, buildinFileCatalog);
|
||||||
|
|
||||||
|
// 创建输出文件
|
||||||
|
string binaryFilePath = $"{packageDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName}";
|
||||||
|
if (File.Exists(binaryFilePath))
|
||||||
|
File.Delete(binaryFilePath);
|
||||||
|
SerializeToBinary(binaryFilePath, buildinFileCatalog);
|
||||||
|
|
||||||
|
UnityEditor.AssetDatabase.Refresh();
|
||||||
|
Debug.Log($"Succeed to save catalog file : {binaryFilePath}");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 序列化(JSON文件)
|
/// 序列化(JSON文件)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:资源清单服务类
|
/// 自定义参数:资源清单服务类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IManifestServices ManifestServices { private set; get; }
|
public IManifestRestoreServices ManifestServices { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:拷贝内置文件服务类
|
/// 自定义参数:拷贝内置文件服务类
|
||||||
@@ -186,7 +186,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
||||||
{
|
{
|
||||||
ManifestServices = (IManifestServices)value;
|
ManifestServices = (IManifestRestoreServices)value;
|
||||||
}
|
}
|
||||||
else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES)
|
else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,155 +0,0 @@
|
|||||||
#if UNITY_EDITOR
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
public class DefaultBuildinFileSystemBuild : UnityEditor.Build.IPreprocessBuildWithReport
|
|
||||||
{
|
|
||||||
public int callbackOrder { get { return 0; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 在构建应用程序前自动生成内置资源目录文件。
|
|
||||||
/// 原理:搜索StreamingAssets目录下的所有资源文件,将这些文件信息写入文件,然后在运行时做查询用途。
|
|
||||||
/// </summary>
|
|
||||||
public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report)
|
|
||||||
{
|
|
||||||
YooLogger.Log("Begin to create catalog file !");
|
|
||||||
|
|
||||||
string rootPath = YooAssetSettingsData.GetYooDefaultBuildinRoot();
|
|
||||||
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
|
||||||
if (rootDirectory.Exists == false)
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"Can not found StreamingAssets root directory : {rootPath}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 搜索所有Package目录
|
|
||||||
DirectoryInfo[] subDirectories = rootDirectory.GetDirectories();
|
|
||||||
foreach (var subDirectory in subDirectories)
|
|
||||||
{
|
|
||||||
string packageName = subDirectory.Name;
|
|
||||||
string pacakgeDirectory = subDirectory.FullName;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
bool result = CreateBuildinCatalogFile(null, packageName, pacakgeDirectory);
|
|
||||||
if (result == false)
|
|
||||||
{
|
|
||||||
Debug.LogError($"Create package {packageName} catalog file failed ! See the detail error in console !");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (System.Exception ex)
|
|
||||||
{
|
|
||||||
Debug.LogError($"Create package {packageName} catalog file failed ! {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 生成包裹的内置资源目录文件
|
|
||||||
/// </summary>
|
|
||||||
public static bool CreateBuildinCatalogFile(IManifestServices services, string packageName, string packageDirectory)
|
|
||||||
{
|
|
||||||
// 获取资源清单版本
|
|
||||||
string packageVersion;
|
|
||||||
{
|
|
||||||
string versionFileName = YooAssetSettingsData.GetPackageVersionFileName(packageName);
|
|
||||||
string versionFilePath = $"{packageDirectory}/{versionFileName}";
|
|
||||||
if (File.Exists(versionFilePath) == false)
|
|
||||||
{
|
|
||||||
Debug.LogError($"Can not found package version file : {versionFilePath}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
packageVersion = FileUtility.ReadAllText(versionFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载资源清单文件
|
|
||||||
PackageManifest packageManifest;
|
|
||||||
{
|
|
||||||
string manifestFileName = YooAssetSettingsData.GetManifestBinaryFileName(packageName, packageVersion);
|
|
||||||
string manifestFilePath = $"{packageDirectory}/{manifestFileName}";
|
|
||||||
if (File.Exists(manifestFilePath) == false)
|
|
||||||
{
|
|
||||||
Debug.LogError($"Can not found package manifest file : {manifestFilePath}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var binaryData = FileUtility.ReadAllBytes(manifestFilePath);
|
|
||||||
packageManifest = ManifestTools.DeserializeFromBinary(binaryData, services);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取文件名映射关系
|
|
||||||
Dictionary<string, string> fileMapping = new Dictionary<string, string>();
|
|
||||||
{
|
|
||||||
foreach (var packageBundle in packageManifest.BundleList)
|
|
||||||
{
|
|
||||||
fileMapping.Add(packageBundle.FileName, packageBundle.BundleGUID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建内置清单实例
|
|
||||||
var buildinFileCatalog = new DefaultBuildinFileCatalog();
|
|
||||||
buildinFileCatalog.FileVersion = CatalogDefine.FileVersion;
|
|
||||||
buildinFileCatalog.PackageName = packageName;
|
|
||||||
buildinFileCatalog.PackageVersion = packageVersion;
|
|
||||||
|
|
||||||
// 创建白名单查询集合
|
|
||||||
HashSet<string> whiteFileList = new HashSet<string>
|
|
||||||
{
|
|
||||||
"link.xml",
|
|
||||||
"buildlogtep.json",
|
|
||||||
$"{packageName}.version",
|
|
||||||
$"{packageName}_{packageVersion}.bytes",
|
|
||||||
$"{packageName}_{packageVersion}.hash",
|
|
||||||
$"{packageName}_{packageVersion}.json",
|
|
||||||
$"{packageName}_{packageVersion}.report",
|
|
||||||
DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName,
|
|
||||||
DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName
|
|
||||||
};
|
|
||||||
|
|
||||||
// 记录所有内置资源文件
|
|
||||||
DirectoryInfo rootDirectory = new DirectoryInfo(packageDirectory);
|
|
||||||
FileInfo[] fileInfos = rootDirectory.GetFiles();
|
|
||||||
foreach (var fileInfo in fileInfos)
|
|
||||||
{
|
|
||||||
if (fileInfo.Extension == ".meta")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (whiteFileList.Contains(fileInfo.Name))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
string fileName = fileInfo.Name;
|
|
||||||
if (fileMapping.TryGetValue(fileName, out string bundleGUID))
|
|
||||||
{
|
|
||||||
var wrapper = new DefaultBuildinFileCatalog.FileWrapper();
|
|
||||||
wrapper.BundleGUID = bundleGUID;
|
|
||||||
wrapper.FileName = fileName;
|
|
||||||
buildinFileCatalog.Wrappers.Add(wrapper);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning($"Failed mapping file : {fileName}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建输出文件
|
|
||||||
string jsonFilePath = $"{packageDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName}";
|
|
||||||
if (File.Exists(jsonFilePath))
|
|
||||||
File.Delete(jsonFilePath);
|
|
||||||
CatalogTools.SerializeToJson(jsonFilePath, buildinFileCatalog);
|
|
||||||
|
|
||||||
// 创建输出文件
|
|
||||||
string binaryFilePath = $"{packageDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName}";
|
|
||||||
if (File.Exists(binaryFilePath))
|
|
||||||
File.Delete(binaryFilePath);
|
|
||||||
CatalogTools.SerializeToBinary(binaryFilePath, buildinFileCatalog);
|
|
||||||
|
|
||||||
UnityEditor.AssetDatabase.Refresh();
|
|
||||||
Debug.Log($"Succeed to save buildin file catalog : {binaryFilePath}");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -108,7 +108,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:资源清单服务类
|
/// 自定义参数:资源清单服务类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IManifestServices ManifestServices { private set; get; }
|
public IManifestRestoreServices ManifestServices { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:拷贝内置文件服务类
|
/// 自定义参数:拷贝内置文件服务类
|
||||||
@@ -253,7 +253,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
||||||
{
|
{
|
||||||
ManifestServices = (IManifestServices)value;
|
ManifestServices = (IManifestRestoreServices)value;
|
||||||
}
|
}
|
||||||
else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES)
|
else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:资源清单服务类
|
/// 自定义参数:资源清单服务类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IManifestServices ManifestServices { private set; get; }
|
public IManifestRestoreServices ManifestServices { private set; get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
||||||
{
|
{
|
||||||
ManifestServices = (IManifestServices)value;
|
ManifestServices = (IManifestRestoreServices)value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义参数:资源清单服务类
|
/// 自定义参数:资源清单服务类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IManifestServices ManifestServices { private set; get; }
|
public IManifestRestoreServices ManifestServices { private set; get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
|
||||||
{
|
{
|
||||||
ManifestServices = (IManifestServices)value;
|
ManifestServices = (IManifestRestoreServices)value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 序列化(二进制文件)
|
/// 序列化(二进制文件)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SerializeToBinary(string savePath, PackageManifest manifest, IManifestServices services)
|
public static void SerializeToBinary(string savePath, PackageManifest manifest, IManifestProcessServices services)
|
||||||
{
|
{
|
||||||
using (FileStream fs = new FileStream(savePath, FileMode.Create))
|
using (FileStream fs = new FileStream(savePath, FileMode.Create))
|
||||||
{
|
{
|
||||||
@@ -124,7 +124,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 反序列化(二进制文件)
|
/// 反序列化(二进制文件)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static PackageManifest DeserializeFromBinary(byte[] binaryData, IManifestServices services)
|
public static PackageManifest DeserializeFromBinary(byte[] binaryData, IManifestRestoreServices services)
|
||||||
{
|
{
|
||||||
// 创建缓存器
|
// 创建缓存器
|
||||||
BufferReader buffer;
|
BufferReader buffer;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace YooAsset
|
|||||||
Done,
|
Done,
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly IManifestServices _services;
|
private readonly IManifestRestoreServices _services;
|
||||||
private byte[] _sourceData;
|
private byte[] _sourceData;
|
||||||
private BufferReader _buffer;
|
private BufferReader _buffer;
|
||||||
private int _packageAssetCount;
|
private int _packageAssetCount;
|
||||||
@@ -33,7 +33,7 @@ namespace YooAsset
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public PackageManifest Manifest { private set; get; }
|
public PackageManifest Manifest { private set; get; }
|
||||||
|
|
||||||
public DeserializeManifestOperation(IManifestServices services, byte[] binaryData)
|
public DeserializeManifestOperation(IManifestRestoreServices services, byte[] binaryData)
|
||||||
{
|
{
|
||||||
_services = services;
|
_services = services;
|
||||||
_sourceData = binaryData;
|
_sourceData = binaryData;
|
||||||
|
|||||||
14
Assets/YooAsset/Runtime/Services/IManifestProcessServices.cs
Normal file
14
Assets/YooAsset/Runtime/Services/IManifestProcessServices.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 资源清单文件处理服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IManifestProcessServices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 处理资源清单(压缩或加密)
|
||||||
|
/// </summary>
|
||||||
|
byte[] ProcessManifest(byte[] fileData);
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Assets/YooAsset/Runtime/Services/IManifestRestoreServices.cs
Normal file
14
Assets/YooAsset/Runtime/Services/IManifestRestoreServices.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 资源清单文件处理服务接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IManifestRestoreServices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 还原资源清单(解压或解密)
|
||||||
|
/// </summary>
|
||||||
|
byte[] RestoreManifest(byte[] fileData);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 6b5abe115ebfe1344b674db78b2edf6c
|
guid: b17060f9f11771e4cbcb0201fce446e6
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 资源清单文件处理服务接口
|
|
||||||
/// </summary>
|
|
||||||
public interface IManifestServices
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 处理资源清单(压缩和加密)
|
|
||||||
/// </summary>
|
|
||||||
byte[] ProcessManifest(byte[] fileData);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 还原资源清单(解压和解密)
|
|
||||||
/// </summary>
|
|
||||||
byte[] RestoreManifest(byte[] fileData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user