示例#1
0
        public UpdateOperation(MainUpdater updater, VersionInfo originVersion, VersionInfo sourceVersion, SourceType souceType)
        {
            _updater           = updater;
            _originVersionInfo = originVersion;
            _sourceVersionInfo = sourceVersion;

#if UNITY_EDITOR
            if (!MainUpdater.IsSimulationMode)
#endif
            {
                // if (originVersion.VersionNum < sourceVersion.VersionNum)
                if (originVersion.VersionNum != sourceVersion.VersionNum)
                {
                    TotalSize   = 0; //Edit wxwlog 2017.9.8 重置数值;
                    _writedSize = 0; //Edit wxwlog 2017.9.8 重置数值;

                    foreach (var sourceBundle in sourceVersion.Bundles)
                    {
                        var isContain = false;
                        foreach (var originBundle in originVersion.Bundles)
                        {
                            if (originBundle.Name == sourceBundle.Name)
                            {
                                if (originBundle.Md5Code != sourceBundle.Md5Code)
                                {
                                    _updateBundleQueue.Enqueue(new KeyValuePair <SourceType, BundleInfo>(souceType, sourceBundle));
                                    TotalSize += sourceBundle.Size;
                                }
                                isContain = true;
                                break;
                            }
                        }
                        if (!isContain)
                        {
                            _updateBundleQueue.Enqueue(new KeyValuePair <SourceType, BundleInfo>(souceType, sourceBundle));
                            TotalSize += sourceBundle.Size;
                        }
                    }
                }
            }
        }
示例#2
0
        public DownloadOperation(MainUpdater updater, SourceType source, string path)
        {
            _targetUrl = string.Empty;
            switch (source)
            {
            case SourceType.RemotePath:
                //_targetUrl = Path.Combine(updater.RemoteUrl, path);//原语句
                _targetUrl = updater.RemoteUrl + "/" + path;   //Edit wxw 2017.8.15
                break;

            case SourceType.PersistentPath:
                _targetUrl = Utils.GetWWWPersistentPath(path);
                break;

            case SourceType.StreamingPath:
                _targetUrl = Utils.GetWWWStreamingAssetPath(path);
                break;

            default:
                throw new ArgumentOutOfRangeException("source", source, null);
            }
        }