IEnumerator DownloadRemoteDomainList(StringBuilder buf, string remoteDomainUrl) { // Start downloading the remote file (never cache this file) using (UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(RemoteDomainListUrl)) { // Wait until the asset is fully received yield return(www.SendWebRequest()); // Check if there were any errors if ((www.isNetworkError == true) || (www.isHttpError == true)) { DownloadErrorMessage = www.error; } else { // If asset bundle, convert it into a list try { AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www); if (bundle != null) { DownloadedDomainList = ConvertToDomainList(DomainList.Get(bundle), domainDecrypter); } else { DownloadErrorMessage = "No domain list found"; } } catch (Exception ex) { DownloadErrorMessage = ex.Message; } } } }
private void DrawArchiveContents() { EditorHelpers.DrawBoldFoldout(contentAnimation, "Archive Contents"); // Draw the rest of the controls using (EditorGUILayout.FadeGroupScope fadeScope = new EditorGUILayout.FadeGroupScope(contentAnimation.faded)) { if (fadeScope.visible == true) { // Draw the rest of the controls EditorGUILayout.PropertyField(includeIndexHtml); domainList.DoLayoutList(); // Draw the import stuff EditorGUILayout.Space(); UnityEngine.Object testAsset = null; testAsset = EditorGUILayout.ObjectField("Import Domain List", testAsset, typeof(UnityEngine.Object), false); if (testAsset != null) { AssetBundle bundle = null; try { // Load the bundle, and convert it to a domain list bundle = AssetBundle.LoadFromFile(AssetDatabase.GetAssetPath(testAsset)); DomainList domainList = DomainList.Get(bundle); // Decrypt the domain list HostArchiveSetting setting = ((HostArchiveSetting)target); setting.AcceptedDomains = DomainList.Decrypt(domainList, setting.DomainEncrypter); } finally { if (bundle != null) { // Clean-up bundle.Unload(true); } } } } } }