public PatchManager(IEnumerable <PatchListEntry> patches, DirectoryInfo gamePath, DirectoryInfo patchStore, PatchInstaller installer)
        {
            Debug.Assert(patches != null, "patches != null ASSERTION FAILED");

            _gamePath   = gamePath;
            _patchStore = patchStore;
            _installer  = installer;

            if (!_patchStore.Exists)
            {
                _patchStore.Create();
            }

            Downloads = patches.Select(patchListEntry => new PatchDownload {
                Patch = patchListEntry, State = PatchState.Nothing
            }).ToList().AsReadOnly();

            // All dl slots are available at the start
            for (var i = 0; i < MAX_DOWNLOADS_AT_ONCE; i++)
            {
                Slots[i] = SlotState.Done;
            }

            _downloadOpt.TempDirectory = DownloadTempPath;
            CleanupTemp();

            Log.Information($"Downloading each patch with max speed of: {this._downloadOpt.MaximumBytesPerSecond}");
        }
Beispiel #2
0
        public PatchManager(IEnumerable <PatchListEntry> patches, DirectoryInfo gamePath, DirectoryInfo patchStore, PatchInstaller installer)
        {
            Debug.Assert(patches != null, "patches != null ASSERTION FAILED");

            _gamePath   = gamePath;
            _patchStore = patchStore;
            _installer  = installer;

            if (!_patchStore.Exists)
            {
                _patchStore.Create();
            }

            Downloads = patches.Select(patchListEntry => new PatchDownload {
                Patch = patchListEntry, State = PatchState.Nothing
            }).ToList().AsReadOnly();

            // All dl slots are available at the start
            for (var i = 0; i < MAX_DOWNLOADS_AT_ONCE; i++)
            {
                Slots[i] = true;
            }

            ServicePointManager.DefaultConnectionLimit = 255;
        }