Ejemplo n.º 1
0
    public RemoteBundleData[] GetBundleList()
    {
        RemoteBundleData[] result = null;

        lock (m_remoteBundleListLock)
        {
            if (m_remoteBundleList != null)
            {
                result = new RemoteBundleData[m_remoteBundleList.Length];
                System.Array.Copy(m_remoteBundleList, result, m_remoteBundleList.Length);
            }
        }

        return(result);
    }
Ejemplo n.º 2
0
    private void ProcessDownloadBundleListResponse(LogEventResponse response, System.Action <bool> callback)
    {
        IsBundleListDownloading = false;

        if (response == null || response.ScriptData == null || response.HasErrors)
        {
            if (callback != null)
            {
                callback(false);
            }

            return;
        }

        var bundles = response.ScriptData.GetGSDataList("bundles");

        if (bundles == null || bundles.Count == 0)
        {
            if (callback != null)
            {
                callback(false);
            }

            return;
        }

        List <RemoteBundleData> bundles_data = new List <RemoteBundleData>();

        foreach (var item in bundles)
        {
            var shortCode = item.GetString("shortCode");
            var crc       = item.GetString("crc");
            var bundleId  = item.GetString("bundleId");

            var remote_bundle_data = new RemoteBundleData(shortCode, crc, bundleId);
            bundles_data.Add(remote_bundle_data);
        }

        lock (m_remoteBundleListLock)
            m_remoteBundleList = bundles_data.ToArray();

        if (callback != null)
        {
            callback(true);
        }
    }
Ejemplo n.º 3
0
    public void DownloadBundle(RemoteBundleData remoteBundleData, System.Action <bool> callback)
    {
        if (remoteBundleData == null || string.IsNullOrEmpty(remoteBundleData.RemoteId))
        {
            return;
        }

        new GetDownloadableRequest()
        .SetShortCode(remoteBundleData.RemoteId)
        .Send((response) =>
        {
            Dispatcher.Dispatch((what) =>
            {
                ProcessDownloadBundleResponse(response, remoteBundleData.Crc, remoteBundleData.BundleId, callback);
            });
        });
    }