public async void VerifyRemoteAssetBundle(RemoteAssetBundle bundle, bool verified)
    {
        Object jwt      = GUIConfigureTab.jwtFile;
        string endpoint = FormatEndpoint(uploadEndpoint);

        if (!string.IsNullOrEmpty(endpoint))
        {
            string jwtName = jwt ? jwt.name : null;
            try
            {
                EditorUtility.DisplayProgressBar("Remote Asset Bundles", string.Format("Updating Asset Bundle {0} from {1}", bundle.info.name, bundle.appName), 1.0f);
                RemoteAssetBundle newBundle = await RemoteAssetBundleUtils.VerifyAssetBundle(endpoint, bundle, verified, jwtName);

                GUIEditTab.AddMessage(string.Format("Successfully Updated Asset Bundle {0} from app {1}", bundle.info.name, bundle.appName), MessageStatus.Success);
                EditorUtility.DisplayProgressBar("Remote Asset Bundles", "The content of the manifest has changed - refreshing now ...", 1.0f);
                await OnLoadManifests();

                GUIEditTab.SelectCurrentManifest(bundle.appName);
                EditorUtility.ClearProgressBar();
            }
            catch (System.Exception ex)
            {
                EditorUtility.ClearProgressBar();
                GUIEditTab.AddMessage(string.Format("Unable to update Asset Bundle {0} from app {1}. \n Reason: {2}", bundle.info.name, bundle.appName, ex.Message), MessageStatus.Error);
                throw;
            }
        }
    }
Ejemplo n.º 2
0
        public IEnumerator TestDownloadRemoteAssetBundle(System.Action <string, AssetBundle> callback)
        {
            Debug.Log("Testing RemoteAssetBundleUtils.DownloadAssetBundle");
            AssetBundleInfo          info    = new AssetBundleInfo(TestConstants.TEST_BUNDLE_NAME, TestConstants.TEST_BUNDLE_PATH);
            FCMMessage               message = new FCMMessage("Test Upload", "This is a test", null);
            Task <RemoteAssetBundle> task    = RemoteAssetBundleUtils.UploadAssetBundle(TestConstants.TEST_SERVER_URL, info, message, null, TestConstants.JWT_TOKEN_NAME);

            while (!task.IsCompleted)
            {
                yield return(new WaitForFixedUpdate());
            }
            RemoteAssetBundle bundle = task.Result;

            Assert.AreEqual(bundle.toHash128().isValid, true);
            yield return(StartCoroutine(RemoteAssetBundleUtils.DownloadAssetBundleAsync(TestConstants.TEST_SERVER_URL, bundle, callback)));

            // Try to download again and check the cache
            yield return(StartCoroutine(RemoteAssetBundleUtils.DownloadAssetBundleAsync(TestConstants.TEST_SERVER_URL, bundle, TestDownloadCachedAsset)));

            // Now try to delete it
            Task <HttpStatusCode> t = RemoteAssetBundleUtils.DeleteAssetBundle(TestConstants.TEST_SERVER_URL, bundle);

            while (!t.IsCompleted)
            {
                yield return(new WaitForFixedUpdate());
            }
            HttpStatusCode status = t.Result;

            Assert.AreEqual(status, HttpStatusCode.OK);
            Debug.Log("Passed");
            finished = true;
        }
    public async void SendRemoteAssetBundleMessage(RemoteAssetBundle bundle)
    {
        Object jwt      = GUIConfigureTab.jwtFile;
        string endpoint = FormatEndpoint(messageEndpoint);

        if (!string.IsNullOrEmpty(endpoint))
        {
            string jwtName = jwt ? jwt.name : null;
            try
            {
                EditorUtility.DisplayProgressBar("Remote Asset Bundles", string.Format("Sending Message for Asset Bundle {0} from {1}", bundle.info.name, bundle.appName), 1.0f);
                FCMMessageStatus message = await RemoteAssetBundleUtils.SendBundleMessage(endpoint, bundle, jwtName);

                if (message.sendStatus)
                {
                    GUIEditTab.AddMessage(string.Format("Successfully Sent Message for Asset Bundle {0} from {1}. \n Reason: {2}", bundle.info.name, bundle.appName, message.statusMessage), MessageStatus.Success);
                }
                else
                {
                    GUIEditTab.AddMessage(string.Format("Unable to Send Message for Asset Bundle {1} from {2}. \n Reason: {1}", bundle.info.name, bundle.appName, message.statusMessage), MessageStatus.Error);
                }

                EditorUtility.ClearProgressBar();
            }
            catch (System.Exception ex)
            {
                EditorUtility.ClearProgressBar();
                GUIEditTab.AddMessage(string.Format("Unable to Send Message for Asset Bundle {1} from {2}. \n Reason: {1}", bundle.info.name, bundle.appName, ex.Message), MessageStatus.Error);
                throw;
            }
        }
    }
Ejemplo n.º 4
0
        public static IEnumerator VerifyEndpoint()
        {
            Debug.Log("Testing RemoteAssetBundleUtils.CheckEndpoint");
            Task <bool> task = RemoteAssetBundleUtils.CheckEndpoint(TestConstants.TEST_SERVER_ENDPOINT_CHECK);

            while (!task.IsCompleted)
            {
                yield return(null);
            }
            bool status = task.Result;

            Assert.IsTrue(status);

            // Now check JWT authentication
            Task <bool> t = RemoteAssetBundleUtils.CheckJWT(TestConstants.TEST_SERVER_ENDPOINT_CHECK, TestConstants.JWT_TOKEN_NAME);

            while (!t.IsCompleted)
            {
                yield return(null);
            }
            bool jwtStatus = t.Result;

            Assert.IsTrue(jwtStatus);
            Debug.Log("Passed");
        }
Ejemplo n.º 5
0
        public static IEnumerator VerifyGetAssetBundleInfo()
        {
            Debug.Log("Testing RemoteAssetBundleUtils.GetAssetBundleInfo");
            AssetBundleInfo info = RemoteAssetBundleUtils.GetAssetBundleInfo(TestConstants.TEST_BUNDLE_NAME, TestConstants.TEST_BUNDLE_DIR);

            Assert.AreEqual(info.Exists(), true);
            Debug.Log("Passed");
            yield return(null);
        }
Ejemplo n.º 6
0
        public IEnumerator VerifyUpdateAssetBundle()
        {
            Debug.Log("Testing RemoteAssetBundleUtils.VerifyAssetBundle");
            Task <RemoteAssetBundle> task = RemoteAssetBundleUtils.VerifyAssetBundle(TestConstants.TEST_SERVER_URL, bundle, true, TestConstants.JWT_TOKEN_NAME);

            while (!task.IsCompleted)
            {
                yield return(null);
            }
            bundle = task.Result;
            Assert.IsTrue(bundle.toHash128().isValid);
            Assert.IsTrue(bundle.verified);
        }
Ejemplo n.º 7
0
        public IEnumerator VerifyDeleteAssetBundle()
        {
            Debug.Log("Testing RemoteAssetBundleUtils.DeleteAssetBundle");
            Task <HttpStatusCode> task = RemoteAssetBundleUtils.DeleteAssetBundle(TestConstants.TEST_SERVER_URL, bundle);

            while (!task.IsCompleted)
            {
                yield return(null);
            }
            HttpStatusCode status = task.Result;

            Assert.AreEqual(status, HttpStatusCode.OK);
            Debug.Log("Passed");
        }
Ejemplo n.º 8
0
        public IEnumerator VerifyUploadAssetBundle()
        {
            Debug.Log("Testing RemoteAssetBundleUtils.UploadAssetBundle");
            AssetBundleInfo          info    = new AssetBundleInfo(TestConstants.TEST_BUNDLE_NAME, TestConstants.TEST_BUNDLE_PATH);
            FCMMessage               message = new FCMMessage("Test Upload", "This is a test", null);
            Task <RemoteAssetBundle> task    = RemoteAssetBundleUtils.UploadAssetBundle(TestConstants.TEST_SERVER_URL, info, message, null, TestConstants.JWT_TOKEN_NAME);

            while (!task.IsCompleted)
            {
                yield return(null);
            }
            bundle = task.Result;
            Assert.IsTrue(bundle.toHash128().isValid);
            Assert.AreEqual(Application.productName, bundle.appName);
        }
Ejemplo n.º 9
0
        public IEnumerator VerifyGetAssetBundleManifestWithUnverifiedBundle()
        {
            Debug.Log("Testing RemoteAssetBundleUtils.GetAssetBundleManifest");
            Task <RemoteAssetBundleManifest> task = RemoteAssetBundleUtils.GetAssetBundleManifest(TestConstants.TEST_SERVER_URL, Application.productName);

            while (!task.IsCompleted)
            {
                yield return(null);
            }
            RemoteAssetBundleManifest content = task.Result;

            // Should at the very least be an empty array
            Assert.AreNotEqual(content.bundles, null);
            Assert.AreEqual(content.bundles.Length, 0);
            Debug.Log("Passed");
        }
    public async void OnCheckJWT(string serverEndpoint, Object jwt)
    {
        bool status;

        if (!string.IsNullOrEmpty(serverEndpoint) && jwt)
        {
            status = await RemoteAssetBundleUtils.CheckJWT(serverEndpoint, jwt.name);
        }
        else
        {
            status = false;
        }
        if (status)
        {
            GUIConfigureTab.AddMessage(string.Format("Successfully Connected to Server with JWT {0}!", jwt.name), MessageStatus.Success);
        }
        else
        {
            GUIConfigureTab.AddMessage(string.Format("Unable to Connect to Server with JWT {0}!", jwt.name), MessageStatus.Error);
        }
    }
    public async void OnCheckEndpoint(string serverEndpoint)
    {
        bool status;

        if (!string.IsNullOrEmpty(serverEndpoint))
        {
            status = await RemoteAssetBundleUtils.CheckEndpoint(serverEndpoint);
        }
        else
        {
            status = false;
        }
        if (status)
        {
            GUIConfigureTab.AddMessage("Successfully Connected to Server!", MessageStatus.Success);
        }
        else
        {
            GUIConfigureTab.AddMessage("Unable to Connect to Server!", MessageStatus.Error);
        }
    }
Ejemplo n.º 12
0
        public IEnumerator VerifyGetAssetBundleManifest()
        {
            Debug.Log("Testing RemoteAssetBundleUtils.GetAssetBundleManifest");
            Task <RemoteAssetBundleManifest> task = RemoteAssetBundleUtils.GetAssetBundleManifest(TestConstants.TEST_SERVER_URL, Application.productName);

            while (!task.IsCompleted)
            {
                yield return(null);
            }
            RemoteAssetBundleManifest content = task.Result;

            // Should at the very least be an empty array
            Assert.AreNotEqual(content.bundles, null);
            Assert.AreEqual(content.bundles.Length, 1);
            foreach (var _bundle in content.bundles)
            {
                Assert.IsTrue(_bundle.toHash128().isValid);
                Assert.AreEqual(_bundle.appName, Application.productName);
            }
            Debug.Log("Passed");
        }
    public async Task OnLoadManifests()
    {
        string endpoint = FormatEndpoint(uploadEndpoint);

        if (!string.IsNullOrEmpty(endpoint))
        {
            try
            {
                EditorUtility.DisplayCancelableProgressBar("Remote Asset Bundles", "Loading All Manifests", 1.0f);
                RemoteAssetBundleManifest manifest = await RemoteAssetBundleUtils.GetAssetBundleManifest(endpoint, null, false);

                GUIEditTab.SetManifests(manifest);
                EditorUtility.ClearProgressBar();
            }
            catch (System.Exception ex)
            {
                EditorUtility.ClearProgressBar();
                GUIEditTab.AddMessage(string.Format("Unable to Load Manifests. Have you Uploaded any Asset Bundles? Info: {0}", ex.Message), MessageStatus.Error);
                throw;
            }
        }
    }
    // Async Server Methods
    public async void UploadAssetBundle(AssetBundleInfo assetBundleInfo, string appName, FCMMessage message)
    {
        Object jwt      = GUIConfigureTab.jwtFile;
        string endpoint = FormatEndpoint(uploadEndpoint);

        if (!string.IsNullOrEmpty(endpoint))
        {
            string jwtName = jwt ? jwt.name : null;
            try
            {
                EditorUtility.DisplayProgressBar("Remote Asset Bundles", string.Format("Uploading Asset Bundle {0} from {1}", assetBundleInfo.name, appName), 1.0f);
                RemoteAssetBundle ab = await RemoteAssetBundleUtils.UploadAssetBundle(endpoint, assetBundleInfo, message, appName, jwtName);

                GUIAddTab.AddMessage(string.Format("Successfully Uploaded Asset Bundle {0}", assetBundleInfo.name), MessageStatus.Success);
                EditorUtility.ClearProgressBar();
            }
            catch (System.Exception ex)
            {
                EditorUtility.ClearProgressBar();
                GUIAddTab.AddMessage(string.Format("Unable to upload Asset Bundle {0}. \n Reason: {1}", assetBundleInfo.name, ex.Message), MessageStatus.Error);
                throw;
            }
        }
    }