Skip to content
This repository has been archived by the owner on Jun 10, 2023. It is now read-only.

Commit

Permalink
refactor, remove useless exception catch
Browse files Browse the repository at this point in the history
  • Loading branch information
j2ghz committed Jul 26, 2018
1 parent ad03ea7 commit d43509f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/ModSink.Common/Client/ClientService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Runtime.Serialization;
Expand All @@ -15,8 +14,6 @@
using ModSink.Common.Models.Client;
using ModSink.Common.Models.Group;
using ModSink.Common.Models.Repo;
using Polly;
using ReactiveUI;

namespace ModSink.Common.Client
{
Expand Down Expand Up @@ -45,18 +42,18 @@ public ClientService(IDownloader downloader, IFormatter serializationFormatter,
.TransformAsync(Load<Repo>)
.OnItemUpdated((repo, _) => LogTo.Information("Repo from {url} has been loaded", repo.BaseUri))
.AsObservableCache()
.DisposeWithThrowExceptions(disposable);
.DisposeWith(disposable);
OnlineFiles = Repos.Connect()
.TransformMany(
repo => repo.Files.Select(kvp => new OnlineFile(kvp.Key, new Uri(repo.BaseUri, kvp.Value))),
of => of.FileSignature)
.AsObservableCache()
.DisposeWithThrowExceptions(disposable);
.DisposeWith(disposable);
Modpacks = Repos.Connect()
.RemoveKey()
.TransformMany(r => r.Modpacks)
.AsObservableList()
.DisposeWithThrowExceptions(disposable);
.DisposeWith(disposable);
QueuedDownloads = Modpacks.Connect()
.AutoRefresh(m => m.Selected)
.Filter(m => m.Selected)
Expand All @@ -78,7 +75,7 @@ public ClientService(IDownloader downloader, IFormatter serializationFormatter,
.InnerJoin(OnlineFiles.Connect(), of => of.FileSignature,
(fs, of) => new QueuedDownload(fs, of.Uri))
.AsObservableCache()
.DisposeWithThrowExceptions(disposable);
.DisposeWith(disposable);
ActiveDownloads = QueuedDownloads.Connect()
.Sort(Comparer<QueuedDownload>.Create((_, __) => 0))
.Top(5)
Expand All @@ -98,7 +95,7 @@ public ClientService(IDownloader downloader, IFormatter serializationFormatter,
})
.LogVerbose("activeDownloads")
.AsObservableCache()
.DisposeWithThrowExceptions(disposable);
.DisposeWith(disposable);
}

public IObservableList<Modpack> Modpacks { get; }
Expand Down

0 comments on commit d43509f

Please sign in to comment.