/// <inheritdoc /> public virtual string GenerateInternalFileName(string name) { var hash = HashingMethods.Calculate(name).ToString(); return(string.Format("CAB-{0}", hash)); }
internal static string CalculateGroupHash(IEnumerable <AddressableAssetEntry> entries) { return(HashingMethods.Calculate(new HashSet <string>(entries.Select(e => e.guid))).ToString()); }
/// <inheritdoc /> public Hash128 GetHash128() { return(HashingMethods.Calculate(Command, UsageSet.GetHash128(), ReferenceMap.GetHash128(), Info).ToHash128()); }
/// <inheritdoc /> public Hash128 GetHash128() { Hash128 processedSceneHash = HashingMethods.CalculateFile(ProcessedScene).ToHash128(); return(HashingMethods.Calculate(Command, UsageSet.GetHash128(), ReferenceMap.GetHash128(), Scene, processedSceneHash, PreloadInfo).ToHash128()); }
public static Hash128 GetHash128(this BuildSettings settings) { return(HashingMethods.Calculate(settings.target, settings.group, settings.buildFlags).ToHash128()); }
public RawHash Calculate(object obj) => HashingMethods.Calculate <T>(obj);
public RawHash Calculate(params object[] objects) => HashingMethods.Calculate <T>(objects);
/// <inheritdoc /> public ReturnCode Run() { if (m_Content.Scenes.IsNullOrEmpty()) { return(ReturnCode.SuccessNotRun); } IList <CachedInfo> cachedInfo = null; IList <CachedInfo> uncachedInfo = null; if (m_Parameters.UseCache && m_Cache != null) { IList <CacheEntry> entries = m_Content.Scenes.Select(x => GetSceneCacheEntry(x)).ToList(); m_Cache.LoadCachedData(entries, out cachedInfo); uncachedInfo = new List <CachedInfo>(); } BuildSettings settings = m_Parameters.GetContentBuildSettings(); for (int i = 0; i < m_Content.Scenes.Count; i++) { GUID scene = m_Content.Scenes[i]; string scenePath = AssetDatabase.GUIDToAssetPath(scene.ToString()); SceneDependencyInfo sceneInfo; BuildUsageTagSet usageTags; Hash128 prefabDependency = new Hash128(); if (cachedInfo != null && cachedInfo[i] != null) { if (!m_Tracker.UpdateInfoUnchecked(string.Format("{0} (Cached)", scenePath))) { return(ReturnCode.Canceled); } sceneInfo = (SceneDependencyInfo)cachedInfo[i].Data[0]; usageTags = cachedInfo[i].Data[1] as BuildUsageTagSet; prefabDependency = (Hash128)cachedInfo[i].Data[2]; var objectTypes = cachedInfo[i].Data[3] as List <ObjectTypes>; if (objectTypes != null) { BuildCacheUtility.SetTypeForObjects(objectTypes); } } else { if (!m_Tracker.UpdateInfoUnchecked(scenePath)) { return(ReturnCode.Canceled); } usageTags = new BuildUsageTagSet(); #if UNITY_2019_3_OR_NEWER #if NONRECURSIVE_DEPENDENCY_DATA if (m_Parameters.NonRecursiveDependencies) { sceneInfo = ContentBuildInterface.CalculatePlayerDependenciesForScene(scenePath, settings, usageTags, m_DependencyData.DependencyUsageCache, DependencyType.ValidReferences); ObjectIdentifier[] filteredReferences = sceneInfo.referencedObjects.ToArray(); filteredReferences = ExtensionMethods.FilterReferencedObjectIDs(scene, filteredReferences, m_Parameters.Target, m_Parameters.ScriptInfo, new HashSet <GUID>(m_Content.Assets)); sceneInfo.SetReferencedObjects(filteredReferences); } else { sceneInfo = ContentBuildInterface.CalculatePlayerDependenciesForScene(scenePath, settings, usageTags, m_DependencyData.DependencyUsageCache); } #else sceneInfo = ContentBuildInterface.CalculatePlayerDependenciesForScene(scenePath, settings, usageTags, m_DependencyData.DependencyUsageCache); #endif #else string outputFolder = m_Parameters.TempOutputFolder; if (m_Parameters.UseCache && m_Cache != null) { outputFolder = m_Cache.GetCachedArtifactsDirectory(m_Cache.GetCacheEntry(scene, Version)); } Directory.CreateDirectory(outputFolder); sceneInfo = ContentBuildInterface.PrepareScene(scenePath, settings, usageTags, m_DependencyData.DependencyUsageCache, outputFolder); #endif if (uncachedInfo != null) { // We only need to gather prefab dependencies and calculate the hash if we are using caching, otherwise we can skip it var prefabEntries = AssetDatabase.GetDependencies(AssetDatabase.GUIDToAssetPath(scene.ToString())).Where(path => path.EndsWith(".prefab")).Select(m_Cache.GetCacheEntry); prefabDependency = HashingMethods.Calculate(prefabEntries).ToHash128(); uncachedInfo.Add(GetCachedInfo(scene, sceneInfo.referencedObjects, sceneInfo, usageTags, prefabEntries, prefabDependency)); } } SetOutputInformation(scene, sceneInfo, usageTags, prefabDependency); } if (m_Parameters.UseCache && m_Cache != null) { m_Cache.SaveCachedData(uncachedInfo); } return(ReturnCode.Success); }
/// <summary> /// The processing of the bundled asset schema. This is where the bundle(s) for a given group are actually setup. /// </summary> /// <param name="schema">The BundledAssetGroupSchema to process</param> /// <param name="assetGroup">The group this schema was pulled from</param> /// <param name="aaContext">The general Addressables build builderInput</param> /// <returns>The error string, if any.</returns> protected virtual string ProcessBundledAssetSchema( BundledAssetGroupSchema schema, AddressableAssetGroup assetGroup, AddressableAssetsBuildContext aaContext) { if (schema == null || !schema.IncludeInBuild) { return(string.Empty); } var errorStr = ErrorCheckBundleSettings(schema, assetGroup, aaContext.settings); if (!string.IsNullOrEmpty(errorStr)) { return(errorStr); } var bundledProviderId = schema.GetBundleCachedProviderId(); var assetProviderId = schema.GetAssetCachedProviderId(); if (!m_CreatedProviderIds.Contains(bundledProviderId)) { m_CreatedProviderIds.Add(bundledProviderId); var bundleProviderType = schema.AssetBundleProviderType.Value; var bundleProviderData = ObjectInitializationData.CreateSerializedInitializationData(bundleProviderType, bundledProviderId); m_ResourceProviderData.Add(bundleProviderData); } if (!m_CreatedProviderIds.Contains(assetProviderId)) { m_CreatedProviderIds.Add(assetProviderId); var assetProviderType = schema.BundledAssetProviderType.Value; var assetProviderData = ObjectInitializationData.CreateSerializedInitializationData(assetProviderType, assetProviderId); m_ResourceProviderData.Add(assetProviderData); } var bundleInputDefs = new List <AssetBundleBuild>(); PrepGroupBundlePacking(assetGroup, bundleInputDefs, schema.BundleMode); for (int i = 0; i < bundleInputDefs.Count; i++) { string assetBundleName = bundleInputDefs[i].assetBundleName; if (aaContext.bundleToAssetGroup.ContainsKey(assetBundleName)) { int count = 1; var newName = assetBundleName; while (aaContext.bundleToAssetGroup.ContainsKey(newName) && count < 1000) { newName = assetBundleName.Replace(".bundle", string.Format("{0}.bundle", count++)); } assetBundleName = newName; } string hashedAssetBundleName = HashingMethods.Calculate(assetBundleName) + ".bundle"; m_OutputAssetBundleNames.Add(assetBundleName); m_AllBundleInputDefs.Add(new AssetBundleBuild { addressableNames = bundleInputDefs[i].addressableNames, assetNames = bundleInputDefs[i].assetNames, assetBundleName = hashedAssetBundleName, assetBundleVariant = bundleInputDefs[i].assetBundleVariant }); aaContext.bundleToAssetGroup.Add(hashedAssetBundleName, assetGroup.Guid); } return(string.Empty); }
/// <inheritdoc /> public string GenerateInternalFileName(string name) { return("CAB-" + HashingMethods.Calculate <MD4>(name)); }
static RawHash HashResourceFiles(List <ResourceFile> files) { return(HashingMethods.Calculate(files.Select((x) => HashingMethods.CalculateFile(x.fileName)))); }
public void CSharpMD4GeneratesCppMD4IdenticalFileIDs() { Assert.AreEqual(-7588530676450950513, BitConverter.ToInt64(HashingMethods.Calculate <MD4>("fb3a9882e5510684697de78116693750", FileType.MetaAssetType, (long)21300000).ToBytes(), 0)); Assert.AreEqual(-8666180608703991793, BitConverter.ToInt64(HashingMethods.Calculate <MD4>("library/atlascache/27/2799803afb660251e3b3049ba37cb15a", (long)2).ToBytes(), 0)); }