예제 #1
0
            public void Run(AssetIndexRemoteFileInfo remoteIndexFileInfo, UpdateCheckCallbackSet callbackSet,
                            object context)
            {
                if (Status != UpdateCheckerStatus.None)
                {
                    throw new InvalidOperationException("Update checking already run.");
                }

                Status = UpdateCheckerStatus.Running;

                m_CallbackSet = callbackSet;
                m_Context     = context;

                if (!m_Owner.UpdateIsEnabled)
                {
                    UseInstallerResourcesOnly();
                    return;
                }

                m_RemoteIndexFileInfo = remoteIndexFileInfo ??
                                        throw new InvalidOperationException("Remote index file info is invalid.");

                if (RootUrls.Count <= 0)
                {
                    ResetStatus();
                    throw new InvalidOperationException("Root URL for any update server hasn't been set.");
                }

                if (!m_RootUrlsModified)
                {
                    m_RootUrlsModified = true;
                    for (int i = 0; i < RootUrls.Count; i++)
                    {
                        RootUrls[i] = new Uri(RootUrls[i], Utility.Text.Format(m_Owner.UpdateRelativePathFormat,
                                                                               m_Owner.RunningPlatform,
                                                                               Utility.Text.Format("{0}.{1}", m_Owner.BundleVersion,
                                                                                                   m_RemoteIndexFileInfo.InternalAssetVersion)));
                    }
                }

                if (!CheckNeedDownloadRemoteIndex(remoteIndexFileInfo))
                {
                    CheckUpdate();
                    return;
                }

                m_DownloadRetryTimes = 0;
                m_DownloadTaskInfo   = new DownloadTaskInfo(
                    Utility.Text.Format("{0}/index_{1}.dat", RootUrls[m_RootUrlIndex].ToString(),
                                        m_RemoteIndexFileInfo.Crc32.ToString()),
                    m_Owner.CachedRemoteIndexPath, m_RemoteIndexFileInfo.FileSize, m_RemoteIndexFileInfo.Crc32,
                    new DownloadCallbackSet
                {
                    OnSuccess  = m_OnDownloadSuccess,
                    OnFailure  = m_OnDownloadFailure,
                    OnProgress = null,
                }, null);
                m_Owner.DownloadService.StartDownloading(m_DownloadTaskInfo);
            }
예제 #2
0
        /// <inheritdoc />
        public void CheckUpdate(AssetIndexRemoteFileInfo remoteIndexFileInfo, UpdateCheckCallbackSet callbackSet, object context)
        {
            if (m_Preparer.Status != PreparerStatus.Success)
            {
                throw new InvalidOperationException("Preparation not successfully done.");
            }

            m_UpdateChecker.Run(remoteIndexFileInfo, callbackSet, context);
        }