Skip to content
This repository has been archived by the owner on Dec 6, 2021. It is now read-only.

Add HttpsURLResolver #33

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public enum AssetBundleSource {
StreamingAssets,
ObjectStorage,
ContentsDeliverNetwork,
Https,
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System.IO;

namespace UnityModule.AssetBundleManagement
{
public class HttpsURLResolver: URLResolverBase
{
private const int HashSubstringDigit = 2;

private const string SingleManifestDirectoryName = "SingleManifests";

public HttpsURLResolver(string hostName, string pathPrefix)
{
GenerateProtocol = () => "https";
GenerateHostname = () => hostName;
GenerateAssetBundlePath =
(snakeCaseProjectName, assetBundleName) =>
{
var hashString = GetSingleManifest().GetAssetBundleHash(assetBundleName).ToString();
return Path.Combine(
pathPrefix,
AppendPathPrefix ? DefaultPathPrefix : string.Empty,
snakeCaseProjectName,
GetPlatformPathName(),
hashString.Substring(0, HashSubstringDigit),
hashString
);
};
GenerateSingleManifestPath =
(snakeCaseProjectName) =>
Path.Combine(
pathPrefix,
AppendPathPrefix ? DefaultPathPrefix : string.Empty,
snakeCaseProjectName,
GetPlatformPathName(),
SingleManifestDirectoryName,
ResolveSingleManifestVersion().ToString()
);
GenerateProjectPlatformFilePath =
(snakeCaseProjectName, fileName) =>
Path.Combine(
pathPrefix,
AppendPathPrefix ? DefaultPathPrefix : string.Empty,
snakeCaseProjectName,
GetPlatformPathName(),
fileName
);
AppendPathPrefix = true;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.