Пример #1
0
 public override bool GetFileMetaData(
     out Kayac.FileHash hash,             // アセットファイルのバージョンを示すハッシュ
     out int sizeBytes,
     string fileName)
 {
     sizeBytes = 0;
     return(_hashMap.TryGetValue(fileName, out hash));
 }
Пример #2
0
    public void UpdateHashMap()
    {
        var hashMap = new Dictionary <string, Kayac.FileHash>();

        for (int i = 0; i < _fileList.Count; i++)
        {
            var hash128 = new Hash128(Rand(), Rand(), Rand(), Rand());             // Unityのハッシュが先にある場合、変換可能
            var hash    = new Kayac.FileHash(hash128);
            Debug.Assert(hash128.ToString() == hash.ToString());
            hashMap.Add(_fileList[i], hash);
        }
        _database.SetHashMap(hashMap);
    }
Пример #3
0
        DownloadHandle MakeDownloadHandle(
            string fileName,
            ref FileHash hash,
            OnError onError)
        {
            var downloadPath = _downloadRoot + fileName;
            var handle       = new DownloadHandle(
                fileName,
                downloadPath,
                ref hash,
                onError,
                _downloadRetryCount,
                _timeoutSeconds,
                bytes =>
            {
                this.downloadedBytes += bytes;
            },
                _storageCache,
                _fileWriter);

            _downloadHandles.Add(fileName, handle);
            // 空きを探す
            int vacantIndex = -1;

            for (int i = 0; i < _goingDownloadHandles.Length; i++)
            {
                if (_goingDownloadHandles[i] == null)
                {
                    vacantIndex = i;
                    break;
                }
            }
            if (vacantIndex < 0)                                    // 空きがない時は待たせる
            {
                var node = _waitingDownloadHandles.AddLast(handle); // 後で消す時のためにNodeを覚えておいて持たせておく
                handle.SetWaitingListNode(node);
            }
            else
            {
                handle.Start(_downloadHandlerBuffers[vacantIndex]);
                _goingDownloadHandles[vacantIndex] = handle;
            }
            return(handle);
        }
Пример #4
0
 public bool GetFileMetaData(
     out Kayac.FileHash hash,             // アセットファイルのバージョンを示すハッシュ
     string fileName)
 {
     return(_hashMap.TryGetValue(fileName, out hash));
 }
Пример #5
0
 public virtual bool GetFileMetaData(out FileHash hash, out int sizeBytes, string fileName)
 {
     hash      = new FileHash();
     sizeBytes = 0;
     return(true);
 }
Пример #6
0
 public bool HasStorageCache(string name, FileHash hash)
 {
     return(_storageCache.Has(name, ref hash));
 }