private void OnDownloadFailure(object sender, DownloadFailureEventArgs e)
            {
                UpdateInfo updateInfo = e.UserData as updateInfo;

                if (File.Exists(e.DownloadPath))
                {
                    File.Delete(e.DownloadPath);
                }

                ResourceUpdateFailure();

                if (updateInfo.RetryCount < m_RetryCount)
                {
                    m_UpdatingCount--;
                    updateInfo newUpdateInfo = new updateInfo(updateInfo.ResourceName, updateInfo.LoadType);
                    if (m_UpdateAllowed)
                    {
                        m_UpdateWaitingInfo.Add(newUpdateInfo);
                    }
                }
            }
Пример #2
0
        /// <summary>
        /// 获取更新信息
        /// </summary>
        /// <param name="version">全局版本</param>
        /// <param name="onUpdate">表格版本更新处理委托</param>
        public void Get(timeVersion version, Func <asynchronousMethod.returnValue <updateInfo>, bool> onUpdate)
        {
            updateInfo value = new updateInfo();

            interlocked.CompareSetSleep0(ref versionLock);
            Func <asynchronousMethod.returnValue <updateInfo>, bool> oldOnUpdate = this.onUpdate;

            if (version.Time == this.version.Version.Time)
            {
                if (version.Version == this.version.Version.Version)
                {
                    this.onUpdate = onUpdate;
                    onUpdate      = null;
                    versionLock   = 0;
                }
                else if (version.Version == updateVersion)
                {
                    int count = (int)(currentTable - tables);
                    if (count == 1)
                    {
                        value.Table   = *tables;
                        value.Version = updateVersion = this.version.Version.Version;
                        currentTable  = tables;
                        versionLock   = 0;
                    }
                    else
                    {
                        value.Table = this.version.Versions.Length;
                        try
                        {
                            fixed(int *tableFixed = value.Tables = new int[count])
                            fixed(ulong *versionFixed = value.Versions = new ulong[count])
                            {
                                ulong *versionWrite = versionFixed;
                                int *  tableWrite   = tableFixed;

                                do
                                {
                                    *versionWrite++ = *(versions + (*tableWrite = *--currentTable));
                                }while (currentTable != tables);
                            }
                            updateVersion = this.version.Version.Version;
                        }
                        finally { versionLock = 0; }
                    }
                }
                else
                {
                    versionLock = 0;
                }
            }
            else
            {
                versionLock = 0;
            }
            try
            {
                if (onUpdate != null)
                {
                    onUpdate(value);
                }
            }
            finally
            {
                if (oldOnUpdate != null)
                {
                    onUpdate(new updateInfo());
                }
            }
        }