From c8bb5108a5fb50398bf07c8305f56c1dc03edfaf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 5 Mar 2019 07:07:07 +0000 Subject: [PATCH 01/21] Bump Microsoft.NET.Test.Sdk from 16.0.0 to 16.0.1 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.0.0 to 16.0.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/commits) Signed-off-by: dependabot[bot] --- src/ModSink.Common.Tests/ModSink.Common.Tests.csproj | 2 +- src/ModSink.UI.Tests/ModSink.UI.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ModSink.Common.Tests/ModSink.Common.Tests.csproj b/src/ModSink.Common.Tests/ModSink.Common.Tests.csproj index 9c4dd1a5..a47d4cf6 100644 --- a/src/ModSink.Common.Tests/ModSink.Common.Tests.csproj +++ b/src/ModSink.Common.Tests/ModSink.Common.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/ModSink.UI.Tests/ModSink.UI.Tests.csproj b/src/ModSink.UI.Tests/ModSink.UI.Tests.csproj index 4463e3cc..b4fbd749 100644 --- a/src/ModSink.UI.Tests/ModSink.UI.Tests.csproj +++ b/src/ModSink.UI.Tests/ModSink.UI.Tests.csproj @@ -9,7 +9,7 @@ - + From 570a48ade8314c5a508a6ecc026b5b49e153b0b4 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Thu, 7 Mar 2019 17:46:25 +0100 Subject: [PATCH 02/21] lubupdate --- src/ModSink.Common.Tests/ModSink.Common.Tests.csproj | 2 +- src/ModSink.UI.Tests/ModSink.UI.Tests.csproj | 2 +- src/ModSink.UI/ModSink.UI.csproj | 4 ++-- src/ModSink.WPF/ModSink.WPF.csproj | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ModSink.Common.Tests/ModSink.Common.Tests.csproj b/src/ModSink.Common.Tests/ModSink.Common.Tests.csproj index ec9b3f2d..1a9f4b53 100644 --- a/src/ModSink.Common.Tests/ModSink.Common.Tests.csproj +++ b/src/ModSink.Common.Tests/ModSink.Common.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/ModSink.UI.Tests/ModSink.UI.Tests.csproj b/src/ModSink.UI.Tests/ModSink.UI.Tests.csproj index ae13366c..a6e0721a 100644 --- a/src/ModSink.UI.Tests/ModSink.UI.Tests.csproj +++ b/src/ModSink.UI.Tests/ModSink.UI.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/ModSink.UI/ModSink.UI.csproj b/src/ModSink.UI/ModSink.UI.csproj index b8c9426d..fd6c27f2 100644 --- a/src/ModSink.UI/ModSink.UI.csproj +++ b/src/ModSink.UI/ModSink.UI.csproj @@ -11,8 +11,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/ModSink.WPF/ModSink.WPF.csproj b/src/ModSink.WPF/ModSink.WPF.csproj index 49468cfa..0c098982 100644 --- a/src/ModSink.WPF/ModSink.WPF.csproj +++ b/src/ModSink.WPF/ModSink.WPF.csproj @@ -21,9 +21,9 @@ all runtime; build; native; contentfiles; analyzers - - - + + + From baa1aa1182020d1e0ef0b878de300b4254f127ad Mon Sep 17 00:00:00 2001 From: J2ghz Date: Tue, 12 Mar 2019 13:32:12 +0100 Subject: [PATCH 03/21] file storage service --- src/ModSink.Common/Client/ClientService.cs | 3 +- .../Client/FileAccessService.cs | 43 ++++++++++++------- .../Services/FileStorageService.cs | 35 +++++++++++++++ 3 files changed, 65 insertions(+), 16 deletions(-) create mode 100644 src/ModSink.Common/Services/FileStorageService.cs diff --git a/src/ModSink.Common/Client/ClientService.cs b/src/ModSink.Common/Client/ClientService.cs index bae4dc70..25027986 100644 --- a/src/ModSink.Common/Client/ClientService.cs +++ b/src/ModSink.Common/Client/ClientService.cs @@ -62,7 +62,8 @@ public ClientService(IDownloader downloader, IFormatter serializationFormatter, .AsObservableCache(); d.Add(QueuedDownloads); ActiveDownloads = QueuedDownloads.Connect() - .Sort(Comparer.Create((_, __) => 0)) + .Sort(Comparer.Create( + (a, b) => a.FileSignature.Length.CompareTo(b.FileSignature.Length))) .Top(5) .LogVerbose("activeDownloadsSimple") .Transform(qd => diff --git a/src/ModSink.Common/Client/FileAccessService.cs b/src/ModSink.Common/Client/FileAccessService.cs index 9b1c8eb6..73629ff1 100644 --- a/src/ModSink.Common/Client/FileAccessService.cs +++ b/src/ModSink.Common/Client/FileAccessService.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using Anotar.Serilog; using Humanizer; using ModSink.Common.Models.Repo; @@ -42,6 +43,21 @@ Stream IFileAccessService.Read(FileSignature fileSignature, bool temporary) return file.Open(FileMode.Create, FileAccess.Read, FileShare.Read); } + public void TemporaryFinished(FileSignature fileSignature) + { + var temp = GetFileInfo(fileSignature, true); + var final = GetFileInfo(fileSignature, false); + LogTo.Verbose("Renaming file {src} to {dst}", temp, final); + if (final.Exists) final.Delete(); + Policy + .Handle() + .WaitAndRetry(5, i => Math.Pow(2, i).Seconds(), + (exception, duration) => LogTo.Warning(exception, + "Moving file from {src} to {dst} has failed after {duration}", temp.FullName, final.FullName, + duration)) + .Execute(() => { temp.MoveTo(final.FullName); }); + } + Stream IFileAccessService.Write(FileSignature fileSignature, bool temporary) { var file = GetFileInfo(fileSignature, temporary); @@ -54,22 +70,13 @@ Stream IFileAccessService.Write(FileSignature fileSignature, bool temporary) .Execute(() => file.Open(FileMode.Create, FileAccess.Write, FileShare.None)); } - public void TemporaryFinished(FileSignature fileSignature) - { - var temp = GetFileInfo(fileSignature, true); - var final = GetFileInfo(fileSignature, false); - LogTo.Verbose("Renaming file {src} to {dst}", temp, final); + [DllImport("kernel32.dll")] + private static extern bool CreateSymbolicLink( + string lpSymlinkFileName, string lpTargetFileName, SymbolicLink dwFlags); - //Policy - // .Handle() - // .WaitAndRetry(5, i => Math.Pow(2, i).Seconds(), - // (exception, duration) => LogTo.Warning(exception, - // "Moving file from {src} to {dst} has failed after {duration}", temp.FullName, final.FullName, - // duration)) - // .Execute(() => - // { - temp.MoveTo(final.FullName); - //}); + public void CreateSymlink(FileSignature file, string destination) + { + CreateSymbolicLink(GetFileInfo(file, false).FullName, destination, SymbolicLink.File); } private FileInfo GetFileInfo(FileSignature fileSignature, bool temporary) @@ -86,5 +93,11 @@ private FileInfo GetFileUri(FileSignature fileSignature, bool temporary) { return localDir.ChildFile(GetFileName(fileSignature, temporary)); } + + private enum SymbolicLink + { + File = 0, + Directory = 1 + } } } \ No newline at end of file diff --git a/src/ModSink.Common/Services/FileStorageService.cs b/src/ModSink.Common/Services/FileStorageService.cs new file mode 100644 index 00000000..671c7273 --- /dev/null +++ b/src/ModSink.Common/Services/FileStorageService.cs @@ -0,0 +1,35 @@ +using System.IO; +using DynamicData; +using ModSink.Common.Client; +using ModSink.Common.Models.Repo; + +namespace ModSink.Common.Services +{ + public class FileStorageService + { + private readonly SourceCache availableFiles = + new SourceCache(x => x); + + private readonly IFileAccessService fileAccessService; + + + public FileStorageService(IFileAccessService fileAccessService) + { + this.fileAccessService = fileAccessService; + availableFiles.AddOrUpdate(fileAccessService.FilesAvailable()); + } + + public IConnectableCache AvailableFiles => availableFiles; + + public void FinishDownload(FileSignature fileSignature) + { + fileAccessService.TemporaryFinished(fileSignature); + availableFiles.AddOrUpdate(fileSignature); + } + + public Stream StartDownload(FileSignature fileSignature) + { + return fileAccessService.Write(fileSignature, true); + } + } +} \ No newline at end of file From baec016f69cc77809fef4e99419a93aed1b2e587 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Tue, 12 Mar 2019 13:32:49 +0100 Subject: [PATCH 04/21] Create DTO namespace, move DTOs --- src/ModSink.CLI/Program.cs | 4 ++-- src/ModSink.Common.Tests/Client/ClientServiceTests.cs | 4 ++-- src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs | 2 +- src/ModSink.Common.Tests/Models/Group/GroupTests.cs | 6 +++--- src/ModSink.Common.Tests/Models/Group/RepoInfoTests.cs | 2 +- .../Models/Repo/FileSignatureTests.cs | 2 +- src/ModSink.Common.Tests/Models/Repo/HashValueTests.cs | 2 +- src/ModSink.Common.Tests/Models/Repo/ModEntryTests.cs | 2 +- src/ModSink.Common.Tests/Models/Repo/ModTests.cs | 2 +- src/ModSink.Common.Tests/Models/Repo/ModpackTests.cs | 2 +- src/ModSink.Common.Tests/Models/Repo/RepoTests.cs | 8 ++++---- src/ModSink.Common.Tests/XXHash64Tests.cs | 2 +- src/ModSink.Common/Client/ClientService.cs | 4 ++-- src/ModSink.Common/Client/DynamicDataChain.cs | 3 +-- src/ModSink.Common/Client/FileAccessService.cs | 2 +- src/ModSink.Common/Client/IFileAccessService.cs | 2 +- src/ModSink.Common/Client/QueuedDownload.cs | 2 +- src/ModSink.Common/FileWithHash.cs | 2 +- src/ModSink.Common/HashingService.cs | 2 +- src/ModSink.Common/IHashFunction.cs | 2 +- src/ModSink.Common/Models/Client/OnlineFile.cs | 2 +- src/ModSink.Common/Models/{ => DTO}/Group/Group.cs | 2 +- src/ModSink.Common/Models/{ => DTO}/Group/RepoInfo.cs | 2 +- src/ModSink.Common/Models/{ => DTO}/Repo/FileSignature.cs | 2 +- src/ModSink.Common/Models/{ => DTO}/Repo/HashValue.cs | 2 +- src/ModSink.Common/Models/{ => DTO}/Repo/IServer.cs | 2 +- src/ModSink.Common/Models/{ => DTO}/Repo/Mod.cs | 2 +- src/ModSink.Common/Models/{ => DTO}/Repo/ModEntry.cs | 2 +- src/ModSink.Common/Models/{ => DTO}/Repo/Modpack.cs | 2 +- src/ModSink.Common/Models/{ => DTO}/Repo/Repo.cs | 2 +- src/ModSink.Common/Services/FileStorageService.cs | 2 +- src/ModSink.Common/XXHash64.cs | 2 +- src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs | 2 +- src/ModSink.UI/ViewModel/LibraryViewModel.cs | 2 +- src/ModSink.UI/ViewModel/ModpackViewModel.cs | 2 +- src/ModSink.WPF/View/ModView.xaml | 2 +- src/ModSink.WPF/View/ModView.xaml.cs | 2 +- 37 files changed, 45 insertions(+), 46 deletions(-) rename src/ModSink.Common/Models/{ => DTO}/Group/Group.cs (81%) rename src/ModSink.Common/Models/{ => DTO}/Group/RepoInfo.cs (73%) rename src/ModSink.Common/Models/{ => DTO}/Repo/FileSignature.cs (97%) rename src/ModSink.Common/Models/{ => DTO}/Repo/HashValue.cs (97%) rename src/ModSink.Common/Models/{ => DTO}/Repo/IServer.cs (63%) rename src/ModSink.Common/Models/{ => DTO}/Repo/Mod.cs (88%) rename src/ModSink.Common/Models/{ => DTO}/Repo/ModEntry.cs (83%) rename src/ModSink.Common/Models/{ => DTO}/Repo/Modpack.cs (95%) rename src/ModSink.Common/Models/{ => DTO}/Repo/Repo.cs (85%) diff --git a/src/ModSink.CLI/Program.cs b/src/ModSink.CLI/Program.cs index 7e18e33d..3807fd70 100644 --- a/src/ModSink.CLI/Program.cs +++ b/src/ModSink.CLI/Program.cs @@ -11,8 +11,8 @@ using Microsoft.Extensions.CommandLineUtils; using ModSink.Common; using ModSink.Common.Client; -using ModSink.Common.Models.Group; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Group; +using ModSink.Common.Models.DTO.Repo; using Serilog; using Serilog.Formatting.Compact; using Serilog.Sinks.SystemConsole.Themes; diff --git a/src/ModSink.Common.Tests/Client/ClientServiceTests.cs b/src/ModSink.Common.Tests/Client/ClientServiceTests.cs index fa0e362d..8dde50b3 100644 --- a/src/ModSink.Common.Tests/Client/ClientServiceTests.cs +++ b/src/ModSink.Common.Tests/Client/ClientServiceTests.cs @@ -10,8 +10,8 @@ using DynamicData; using FluentAssertions; using ModSink.Common.Client; -using ModSink.Common.Models.Group; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Group; +using ModSink.Common.Models.DTO.Repo; using ReactiveUI.Testing; using Serilog; using Xunit; diff --git a/src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs b/src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs index c10cab78..831a7b4d 100644 --- a/src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs +++ b/src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs @@ -6,7 +6,7 @@ using DynamicData; using FluentAssertions; using ModSink.Common.Client; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; using ReactiveUI.Testing; using Xunit; diff --git a/src/ModSink.Common.Tests/Models/Group/GroupTests.cs b/src/ModSink.Common.Tests/Models/Group/GroupTests.cs index c157222c..789ceae0 100644 --- a/src/ModSink.Common.Tests/Models/Group/GroupTests.cs +++ b/src/ModSink.Common.Tests/Models/Group/GroupTests.cs @@ -3,13 +3,13 @@ namespace ModSink.Common.Tests.Models.Group { - public class GroupTests : TestWithFaker + public class GroupTests : TestWithFaker { - public static Faker GroupFaker = new Faker() + public static Faker GroupFaker = new Faker() .StrictMode(true) .RuleFor(g => g.BaseUri, f => new Uri(f.Internet.UrlWithPath())) .RuleFor(g => g.RepoInfos, _ => RepoInfoTests.RepoInfoFaker.Generate(3)); - public override Faker Faker { get; } = GroupFaker; + public override Faker Faker { get; } = GroupFaker; } } \ No newline at end of file diff --git a/src/ModSink.Common.Tests/Models/Group/RepoInfoTests.cs b/src/ModSink.Common.Tests/Models/Group/RepoInfoTests.cs index b5721667..ca466abb 100644 --- a/src/ModSink.Common.Tests/Models/Group/RepoInfoTests.cs +++ b/src/ModSink.Common.Tests/Models/Group/RepoInfoTests.cs @@ -1,6 +1,6 @@ using System; using Bogus; -using ModSink.Common.Models.Group; +using ModSink.Common.Models.DTO.Group; namespace ModSink.Common.Tests.Models.Group { diff --git a/src/ModSink.Common.Tests/Models/Repo/FileSignatureTests.cs b/src/ModSink.Common.Tests/Models/Repo/FileSignatureTests.cs index 0675aaf0..47a3fb95 100644 --- a/src/ModSink.Common.Tests/Models/Repo/FileSignatureTests.cs +++ b/src/ModSink.Common.Tests/Models/Repo/FileSignatureTests.cs @@ -1,7 +1,7 @@ using Bogus; using FluentAssertions; using FluentAssertions.Primitives; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; using Xunit; namespace ModSink.Common.Tests.Models.Repo diff --git a/src/ModSink.Common.Tests/Models/Repo/HashValueTests.cs b/src/ModSink.Common.Tests/Models/Repo/HashValueTests.cs index c7163624..543c92eb 100644 --- a/src/ModSink.Common.Tests/Models/Repo/HashValueTests.cs +++ b/src/ModSink.Common.Tests/Models/Repo/HashValueTests.cs @@ -1,7 +1,7 @@ using Bogus; using FluentAssertions; using FluentAssertions.Primitives; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; using Xunit; namespace ModSink.Common.Tests.Models.Repo diff --git a/src/ModSink.Common.Tests/Models/Repo/ModEntryTests.cs b/src/ModSink.Common.Tests/Models/Repo/ModEntryTests.cs index 9edf6853..763e8591 100644 --- a/src/ModSink.Common.Tests/Models/Repo/ModEntryTests.cs +++ b/src/ModSink.Common.Tests/Models/Repo/ModEntryTests.cs @@ -1,5 +1,5 @@ using Bogus; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Tests.Models.Repo { diff --git a/src/ModSink.Common.Tests/Models/Repo/ModTests.cs b/src/ModSink.Common.Tests/Models/Repo/ModTests.cs index 3a8659b6..e7520677 100644 --- a/src/ModSink.Common.Tests/Models/Repo/ModTests.cs +++ b/src/ModSink.Common.Tests/Models/Repo/ModTests.cs @@ -2,7 +2,7 @@ using System.IO; using System.Linq; using Bogus; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Tests.Models.Repo { diff --git a/src/ModSink.Common.Tests/Models/Repo/ModpackTests.cs b/src/ModSink.Common.Tests/Models/Repo/ModpackTests.cs index bf34b4d6..a97f07b5 100644 --- a/src/ModSink.Common.Tests/Models/Repo/ModpackTests.cs +++ b/src/ModSink.Common.Tests/Models/Repo/ModpackTests.cs @@ -1,5 +1,5 @@ using Bogus; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Tests.Models.Repo { diff --git a/src/ModSink.Common.Tests/Models/Repo/RepoTests.cs b/src/ModSink.Common.Tests/Models/Repo/RepoTests.cs index dee331d9..6ebbd7a5 100644 --- a/src/ModSink.Common.Tests/Models/Repo/RepoTests.cs +++ b/src/ModSink.Common.Tests/Models/Repo/RepoTests.cs @@ -5,17 +5,17 @@ namespace ModSink.Common.Tests.Models.Repo { - public class RepoTests : TestWithFaker + public class RepoTests : TestWithFaker { - public static readonly Faker RepoFaker = - new Faker().StrictMode(true) + public static readonly Faker RepoFaker = + new Faker().StrictMode(true) .RuleFor(r => r.BaseUri, f => new Uri(f.Internet.UrlWithPath())) .RuleFor(r => r.Modpacks, f => ModpackTests.ModpackFaker.Generate(3)) .RuleFor(r => r.Files, f => f.Make(3, () => FileSignatureTests.FileSignature) .ToDictionary(fs => fs, fs => new Uri(f.Internet.UrlWithPath()))); - public override Faker Faker { get; } = RepoFaker; + public override Faker Faker { get; } = RepoFaker; [Fact(Skip = "Test breaks, but it works")] public override void IsSerializeable() diff --git a/src/ModSink.Common.Tests/XXHash64Tests.cs b/src/ModSink.Common.Tests/XXHash64Tests.cs index 15d54684..e74c1389 100644 --- a/src/ModSink.Common.Tests/XXHash64Tests.cs +++ b/src/ModSink.Common.Tests/XXHash64Tests.cs @@ -1,7 +1,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; using Xunit; namespace ModSink.Common.Tests diff --git a/src/ModSink.Common/Client/ClientService.cs b/src/ModSink.Common/Client/ClientService.cs index 25027986..a8e0960c 100644 --- a/src/ModSink.Common/Client/ClientService.cs +++ b/src/ModSink.Common/Client/ClientService.cs @@ -12,8 +12,8 @@ using Humanizer; using ModSink.Common.Models; using ModSink.Common.Models.Client; -using ModSink.Common.Models.Group; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Group; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Client { diff --git a/src/ModSink.Common/Client/DynamicDataChain.cs b/src/ModSink.Common/Client/DynamicDataChain.cs index b08a73d7..02b0b27d 100644 --- a/src/ModSink.Common/Client/DynamicDataChain.cs +++ b/src/ModSink.Common/Client/DynamicDataChain.cs @@ -4,8 +4,7 @@ using Anotar.Serilog; using DynamicData; using ModSink.Common.Models.Client; -using ModSink.Common.Models.Group; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Client { diff --git a/src/ModSink.Common/Client/FileAccessService.cs b/src/ModSink.Common/Client/FileAccessService.cs index 73629ff1..a337621c 100644 --- a/src/ModSink.Common/Client/FileAccessService.cs +++ b/src/ModSink.Common/Client/FileAccessService.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using Anotar.Serilog; using Humanizer; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; using Polly; namespace ModSink.Common.Client diff --git a/src/ModSink.Common/Client/IFileAccessService.cs b/src/ModSink.Common/Client/IFileAccessService.cs index 2ce0ed08..7bc36278 100644 --- a/src/ModSink.Common/Client/IFileAccessService.cs +++ b/src/ModSink.Common/Client/IFileAccessService.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Threading.Tasks; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Client { diff --git a/src/ModSink.Common/Client/QueuedDownload.cs b/src/ModSink.Common/Client/QueuedDownload.cs index 20311921..47d3a690 100644 --- a/src/ModSink.Common/Client/QueuedDownload.cs +++ b/src/ModSink.Common/Client/QueuedDownload.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; using Anotar.Serilog; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Client { diff --git a/src/ModSink.Common/FileWithHash.cs b/src/ModSink.Common/FileWithHash.cs index 187f7f25..1177a585 100644 --- a/src/ModSink.Common/FileWithHash.cs +++ b/src/ModSink.Common/FileWithHash.cs @@ -1,5 +1,5 @@ using System.IO; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common { diff --git a/src/ModSink.Common/HashingService.cs b/src/ModSink.Common/HashingService.cs index b8e32af0..d0b334ee 100644 --- a/src/ModSink.Common/HashingService.cs +++ b/src/ModSink.Common/HashingService.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common { diff --git a/src/ModSink.Common/IHashFunction.cs b/src/ModSink.Common/IHashFunction.cs index 4397ca51..e1acc4c4 100644 --- a/src/ModSink.Common/IHashFunction.cs +++ b/src/ModSink.Common/IHashFunction.cs @@ -1,7 +1,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common { diff --git a/src/ModSink.Common/Models/Client/OnlineFile.cs b/src/ModSink.Common/Models/Client/OnlineFile.cs index 3f78b7b6..d915d63c 100644 --- a/src/ModSink.Common/Models/Client/OnlineFile.cs +++ b/src/ModSink.Common/Models/Client/OnlineFile.cs @@ -1,5 +1,5 @@ using System; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Models.Client { diff --git a/src/ModSink.Common/Models/Group/Group.cs b/src/ModSink.Common/Models/DTO/Group/Group.cs similarity index 81% rename from src/ModSink.Common/Models/Group/Group.cs rename to src/ModSink.Common/Models/DTO/Group/Group.cs index 0db2810a..fd31222f 100644 --- a/src/ModSink.Common/Models/Group/Group.cs +++ b/src/ModSink.Common/Models/DTO/Group/Group.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace ModSink.Common.Models.Group +namespace ModSink.Common.Models.DTO.Group { [Serializable] public class Group : WithBaseUri diff --git a/src/ModSink.Common/Models/Group/RepoInfo.cs b/src/ModSink.Common/Models/DTO/Group/RepoInfo.cs similarity index 73% rename from src/ModSink.Common/Models/Group/RepoInfo.cs rename to src/ModSink.Common/Models/DTO/Group/RepoInfo.cs index 60ffdcfe..46ed9d13 100644 --- a/src/ModSink.Common/Models/Group/RepoInfo.cs +++ b/src/ModSink.Common/Models/DTO/Group/RepoInfo.cs @@ -1,6 +1,6 @@ using System; -namespace ModSink.Common.Models.Group +namespace ModSink.Common.Models.DTO.Group { [Serializable] public class RepoInfo diff --git a/src/ModSink.Common/Models/Repo/FileSignature.cs b/src/ModSink.Common/Models/DTO/Repo/FileSignature.cs similarity index 97% rename from src/ModSink.Common/Models/Repo/FileSignature.cs rename to src/ModSink.Common/Models/DTO/Repo/FileSignature.cs index 59981cae..0372f53c 100644 --- a/src/ModSink.Common/Models/Repo/FileSignature.cs +++ b/src/ModSink.Common/Models/DTO/Repo/FileSignature.cs @@ -2,7 +2,7 @@ using System.Diagnostics; using System.IO; -namespace ModSink.Common.Models.Repo +namespace ModSink.Common.Models.DTO.Repo { [Serializable] [DebuggerDisplay("{Hash} | {Length}")] diff --git a/src/ModSink.Common/Models/Repo/HashValue.cs b/src/ModSink.Common/Models/DTO/Repo/HashValue.cs similarity index 97% rename from src/ModSink.Common/Models/Repo/HashValue.cs rename to src/ModSink.Common/Models/DTO/Repo/HashValue.cs index 568dc582..d9460c87 100644 --- a/src/ModSink.Common/Models/Repo/HashValue.cs +++ b/src/ModSink.Common/Models/DTO/Repo/HashValue.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; -namespace ModSink.Common.Models.Repo +namespace ModSink.Common.Models.DTO.Repo { [Serializable] public struct HashValue : IEquatable, IComparable diff --git a/src/ModSink.Common/Models/Repo/IServer.cs b/src/ModSink.Common/Models/DTO/Repo/IServer.cs similarity index 63% rename from src/ModSink.Common/Models/Repo/IServer.cs rename to src/ModSink.Common/Models/DTO/Repo/IServer.cs index 7d8170d6..659e886b 100644 --- a/src/ModSink.Common/Models/Repo/IServer.cs +++ b/src/ModSink.Common/Models/DTO/Repo/IServer.cs @@ -1,4 +1,4 @@ -namespace ModSink.Common.Models.Repo +namespace ModSink.Common.Models.DTO.Repo { public interface IServer { diff --git a/src/ModSink.Common/Models/Repo/Mod.cs b/src/ModSink.Common/Models/DTO/Repo/Mod.cs similarity index 88% rename from src/ModSink.Common/Models/Repo/Mod.cs rename to src/ModSink.Common/Models/DTO/Repo/Mod.cs index 6e791069..dbe698f0 100644 --- a/src/ModSink.Common/Models/Repo/Mod.cs +++ b/src/ModSink.Common/Models/DTO/Repo/Mod.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace ModSink.Common.Models.Repo +namespace ModSink.Common.Models.DTO.Repo { [Serializable] public class Mod diff --git a/src/ModSink.Common/Models/Repo/ModEntry.cs b/src/ModSink.Common/Models/DTO/Repo/ModEntry.cs similarity index 83% rename from src/ModSink.Common/Models/Repo/ModEntry.cs rename to src/ModSink.Common/Models/DTO/Repo/ModEntry.cs index 5dcf24a8..dc26802e 100644 --- a/src/ModSink.Common/Models/Repo/ModEntry.cs +++ b/src/ModSink.Common/Models/DTO/Repo/ModEntry.cs @@ -1,6 +1,6 @@ using System; -namespace ModSink.Common.Models.Repo +namespace ModSink.Common.Models.DTO.Repo { [Serializable] public class ModEntry diff --git a/src/ModSink.Common/Models/Repo/Modpack.cs b/src/ModSink.Common/Models/DTO/Repo/Modpack.cs similarity index 95% rename from src/ModSink.Common/Models/Repo/Modpack.cs rename to src/ModSink.Common/Models/DTO/Repo/Modpack.cs index 8ac38d18..4447eabd 100644 --- a/src/ModSink.Common/Models/Repo/Modpack.cs +++ b/src/ModSink.Common/Models/DTO/Repo/Modpack.cs @@ -3,7 +3,7 @@ using System.ComponentModel; using System.Runtime.CompilerServices; -namespace ModSink.Common.Models.Repo +namespace ModSink.Common.Models.DTO.Repo { [Serializable] public class Modpack : INotifyPropertyChanged diff --git a/src/ModSink.Common/Models/Repo/Repo.cs b/src/ModSink.Common/Models/DTO/Repo/Repo.cs similarity index 85% rename from src/ModSink.Common/Models/Repo/Repo.cs rename to src/ModSink.Common/Models/DTO/Repo/Repo.cs index 97e32b91..ad713251 100644 --- a/src/ModSink.Common/Models/Repo/Repo.cs +++ b/src/ModSink.Common/Models/DTO/Repo/Repo.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace ModSink.Common.Models.Repo +namespace ModSink.Common.Models.DTO.Repo { [Serializable] public class Repo : WithBaseUri diff --git a/src/ModSink.Common/Services/FileStorageService.cs b/src/ModSink.Common/Services/FileStorageService.cs index 671c7273..ddb184f6 100644 --- a/src/ModSink.Common/Services/FileStorageService.cs +++ b/src/ModSink.Common/Services/FileStorageService.cs @@ -1,7 +1,7 @@ using System.IO; using DynamicData; using ModSink.Common.Client; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Services { diff --git a/src/ModSink.Common/XXHash64.cs b/src/ModSink.Common/XXHash64.cs index da3cdab1..ba4f6a6a 100644 --- a/src/ModSink.Common/XXHash64.cs +++ b/src/ModSink.Common/XXHash64.cs @@ -2,7 +2,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common { diff --git a/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs b/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs index 0276a64d..13ea1216 100644 --- a/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs +++ b/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs @@ -3,7 +3,7 @@ using DynamicData; using FluentAssertions; using Microsoft.Reactive.Testing; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; using ModSink.UI.ViewModel; using Xunit; diff --git a/src/ModSink.UI/ViewModel/LibraryViewModel.cs b/src/ModSink.UI/ViewModel/LibraryViewModel.cs index ea15f5ed..e8461bee 100644 --- a/src/ModSink.UI/ViewModel/LibraryViewModel.cs +++ b/src/ModSink.UI/ViewModel/LibraryViewModel.cs @@ -4,7 +4,7 @@ using DynamicData; using DynamicData.Binding; using ModSink.Common.Client; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; using ReactiveUI; using ReactiveUI.Fody.Helpers; diff --git a/src/ModSink.UI/ViewModel/ModpackViewModel.cs b/src/ModSink.UI/ViewModel/ModpackViewModel.cs index dfef2fb8..62225eda 100644 --- a/src/ModSink.UI/ViewModel/ModpackViewModel.cs +++ b/src/ModSink.UI/ViewModel/ModpackViewModel.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using Humanizer; using Humanizer.Bytes; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; using ReactiveUI; namespace ModSink.UI.ViewModel diff --git a/src/ModSink.WPF/View/ModView.xaml b/src/ModSink.WPF/View/ModView.xaml index db1f6c6a..466f3f9c 100644 --- a/src/ModSink.WPF/View/ModView.xaml +++ b/src/ModSink.WPF/View/ModView.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:ModSink.WPF.View" xmlns:rxui="http://reactiveui.net" - xmlns:repo="clr-namespace:ModSink.Common.Models.Repo;assembly=ModSink.Common" + xmlns:repo="clr-namespace:ModSink.Common.Models.DTO.Repo;assembly=ModSink.Common" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> diff --git a/src/ModSink.WPF/View/ModView.xaml.cs b/src/ModSink.WPF/View/ModView.xaml.cs index 34a629c4..ac098a78 100644 --- a/src/ModSink.WPF/View/ModView.xaml.cs +++ b/src/ModSink.WPF/View/ModView.xaml.cs @@ -1,5 +1,5 @@ using System.Reactive.Disposables; -using ModSink.Common.Models.Repo; +using ModSink.Common.Models.DTO.Repo; using ReactiveUI; namespace ModSink.WPF.View From f1e3ef7fbbf87e43c4df4d82fabfbdd0478b8939 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Fri, 15 Mar 2019 22:07:47 +0100 Subject: [PATCH 05/21] add models --- src/ModSink.Common/Models/Client/Group.cs | 12 +++++++ src/ModSink.Common/Models/Client/Modpack.cs | 31 +++++++++++++++++++ src/ModSink.Common/Models/Client/Repo.cs | 17 ++++++++++ src/ModSink.Common/Models/DTO/Repo/Modpack.cs | 26 +--------------- 4 files changed, 61 insertions(+), 25 deletions(-) create mode 100644 src/ModSink.Common/Models/Client/Group.cs create mode 100644 src/ModSink.Common/Models/Client/Modpack.cs create mode 100644 src/ModSink.Common/Models/Client/Repo.cs diff --git a/src/ModSink.Common/Models/Client/Group.cs b/src/ModSink.Common/Models/Client/Group.cs new file mode 100644 index 00000000..67e342ac --- /dev/null +++ b/src/ModSink.Common/Models/Client/Group.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ModSink.Common.Models.Client +{ + public class Group + { + public ICollection Repos { get; set; } + public string Name { get; set; } + } +} diff --git a/src/ModSink.Common/Models/Client/Modpack.cs b/src/ModSink.Common/Models/Client/Modpack.cs new file mode 100644 index 00000000..5194f04a --- /dev/null +++ b/src/ModSink.Common/Models/Client/Modpack.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Text; +using ModSink.Common.Models.DTO.Repo; + +namespace ModSink.Common.Models.Client +{ + public class Modpack + { + public ICollection Mods { get; set; } + public string Name { get; set; } + } + + public class ModEntry + { + public bool Default { get; set; } + public Mod Mod { get; set; } + + public bool Required { get; set; } + + } + + public class Mod + { + public IDictionary Files { get; set; } + + public string Name { get; set; } + + public string Version { get; set; } + } +} diff --git a/src/ModSink.Common/Models/Client/Repo.cs b/src/ModSink.Common/Models/Client/Repo.cs new file mode 100644 index 00000000..c1dae259 --- /dev/null +++ b/src/ModSink.Common/Models/Client/Repo.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; +using ModSink.Common.Models.DTO.Repo; + +namespace ModSink.Common.Models.Client +{ + public class Repo + { + public IReadOnlyDictionary Files { get; set; } + + public IReadOnlyCollection Modpacks { get; set; } + + public Uri BaseUri { get; set; } + + } +} diff --git a/src/ModSink.Common/Models/DTO/Repo/Modpack.cs b/src/ModSink.Common/Models/DTO/Repo/Modpack.cs index 4447eabd..6b473c91 100644 --- a/src/ModSink.Common/Models/DTO/Repo/Modpack.cs +++ b/src/ModSink.Common/Models/DTO/Repo/Modpack.cs @@ -1,36 +1,12 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.CompilerServices; namespace ModSink.Common.Models.DTO.Repo { [Serializable] - public class Modpack : INotifyPropertyChanged + public class Modpack { - private bool selected; - - public Guid Id { get; } = Guid.NewGuid(); public ICollection Mods { get; set; } public string Name { get; set; } - - public bool Selected - { - get => selected; - set - { - selected = value; - OnPropertyChanged(); - } - } - - //public ICollection Servers { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - - - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } } } \ No newline at end of file From 40c5c785b09d1115ce1fc6f791e0ef6d54b59856 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sat, 16 Mar 2019 13:33:38 +0100 Subject: [PATCH 06/21] fix test --- src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs b/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs index 13ea1216..0446006f 100644 --- a/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs +++ b/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs @@ -16,7 +16,7 @@ public void AddModpack() { ReactiveUI.Testing.TestUtils.With(new TestScheduler(), scheduler => { - var cache = new SourceCache(m=>m.Id); + var cache = new SourceCache(_=> Guid.NewGuid()); var vm = new LibraryViewModel(cache); vm.Modpacks.Should().BeEmpty(); cache.AddOrUpdate(new Modpack()); From 0ee12fb13f7881b28ffb3f33c9115c09544ec234 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sat, 16 Mar 2019 22:33:38 +0100 Subject: [PATCH 07/21] switch UI to lib --- src/ModSink.UI/ModSink.UI.csproj | 2 +- src/ModSink.UI/Program.cs | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 src/ModSink.UI/Program.cs diff --git a/src/ModSink.UI/ModSink.UI.csproj b/src/ModSink.UI/ModSink.UI.csproj index fd6c27f2..430fa8c2 100644 --- a/src/ModSink.UI/ModSink.UI.csproj +++ b/src/ModSink.UI/ModSink.UI.csproj @@ -1,7 +1,7 @@  - Exe + Library netcoreapp3.0 diff --git a/src/ModSink.UI/Program.cs b/src/ModSink.UI/Program.cs deleted file mode 100644 index 6602c9d0..00000000 --- a/src/ModSink.UI/Program.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace ModSink.UI -{ - class Program - { - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } - } -} From ce28bac54b0f5eb9082e9955f9334f6b53abc2bb Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 01:17:14 +0100 Subject: [PATCH 08/21] switch from DTOs to real models --- .../Client/ClientServiceTests.cs | 6 +-- .../Client/DynamicDataChainTests.cs | 3 +- src/ModSink.Common/Client/ClientService.cs | 41 +++---------------- src/ModSink.Common/Client/DynamicDataChain.cs | 30 -------------- src/ModSink.Common/Models/Client/Modpack.cs | 23 +++++++++++ src/ModSink.UI/ViewModel/LibraryViewModel.cs | 3 +- src/ModSink.UI/ViewModel/ModpackViewModel.cs | 5 +-- src/ModSink.WPF/ViewModel/AppBootstrapper.cs | 2 +- 8 files changed, 38 insertions(+), 75 deletions(-) delete mode 100644 src/ModSink.Common/Client/DynamicDataChain.cs diff --git a/src/ModSink.Common.Tests/Client/ClientServiceTests.cs b/src/ModSink.Common.Tests/Client/ClientServiceTests.cs index 8dde50b3..03a9c74a 100644 --- a/src/ModSink.Common.Tests/Client/ClientServiceTests.cs +++ b/src/ModSink.Common.Tests/Client/ClientServiceTests.cs @@ -117,9 +117,9 @@ public void DownloadRepo() client.GroupUrls.Items.Should().HaveCount(1); client.Repos.Items.Should().HaveCount(1); client.QueuedDownloads.Items.Should().HaveCount(0); - foreach (var r in client.Repos.Items) - foreach (var modpack in r.Modpacks) - modpack.Selected = true; + //foreach (var r in client.Repos.Items) + //foreach (var modpack in r.Modpacks) + // modpack.Selected = true; client.QueuedDownloads.Items.Should().HaveCount(1); client.ActiveDownloads.Items.Should().HaveCount(1); diff --git a/src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs b/src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs index 831a7b4d..0fa8cebe 100644 --- a/src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs +++ b/src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs @@ -54,7 +54,8 @@ public void GetModpacksFromReposTest() { var faker = new Faker(); var repos = new SourceCache(r => r.BaseUri); - var modpacks = DynamicDataChain.GetModpacksFromRepos(repos.Connect()).AsObservableCache(); + var modpacks = ((IObservable>) repos.Connect() + .TransformMany(r => r.Modpacks, m => m.Id)).AsObservableCache(); modpacks.Count.Should().Be(0); repos.AddOrUpdate( new Repo diff --git a/src/ModSink.Common/Client/ClientService.cs b/src/ModSink.Common/Client/ClientService.cs index a8e0960c..da538ba5 100644 --- a/src/ModSink.Common/Client/ClientService.cs +++ b/src/ModSink.Common/Client/ClientService.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Reactive.Disposables; @@ -8,12 +7,13 @@ using System.Threading.Tasks; using Anotar.Serilog; using DynamicData; -using DynamicData.Kernel; using Humanizer; using ModSink.Common.Models; using ModSink.Common.Models.Client; -using ModSink.Common.Models.DTO.Group; using ModSink.Common.Models.DTO.Repo; +using Group = ModSink.Common.Models.DTO.Group.Group; +using Modpack = ModSink.Common.Models.Client.Modpack; +using Repo = ModSink.Common.Models.DTO.Repo.Repo; namespace ModSink.Common.Client { @@ -48,40 +48,9 @@ public ClientService(IDownloader downloader, IFormatter serializationFormatter, repo => repo.Files.Select(kvp => new OnlineFile(kvp.Key, repo.CombineBaseUri(kvp.Value))), of => of.FileSignature).AsObservableCache(); d.Add(OnlineFiles); - Modpacks = DynamicDataChain.GetModpacksFromRepos(Repos.Connect()).AsObservableCache(); + Modpacks = Repos.Connect() + .TransformMany(r => r.Modpacks.Select(m => new Modpack(m)), m => m.Id).AsObservableCache(); d.Add(Modpacks); - QueuedDownloads = DynamicDataChain.GetDownloadsFromModpacks(Modpacks.Connect()) - .LeftJoin(filesAvailable.Connect(), f => f, - (required, available) => !available.HasValue - ? Optional.Create(required) - : Optional.None) - .Filter(opt => opt.HasValue) - .Transform(opt => opt.Value) - .InnerJoin(OnlineFiles.Connect(), of => of.FileSignature, - (fs, of) => new QueuedDownload(fs, of.Uri)) - .AsObservableCache(); - d.Add(QueuedDownloads); - ActiveDownloads = QueuedDownloads.Connect() - .Sort(Comparer.Create( - (a, b) => a.FileSignature.Length.CompareTo(b.FileSignature.Length))) - .Top(5) - .LogVerbose("activeDownloadsSimple") - .Transform(qd => - { - var destination = new Lazy(() => GetTemporaryFileStream(qd.FileSignature)); - return new ActiveDownload( - downloader.Download(qd.Source, destination, - qd.FileSignature.Length), - () => - { - destination.Value.Dispose(); - LogTo.Verbose("ActiveDownload {name} finished", qd.FileSignature.Hash); - AddNewFile(qd.FileSignature); - }, qd.FileSignature.ToString()); - }) - .LogVerbose("activeDownloads") - .AsObservableCache(); - d.Add(ActiveDownloads); } public IObservableCache ActiveDownloads { get; } diff --git a/src/ModSink.Common/Client/DynamicDataChain.cs b/src/ModSink.Common/Client/DynamicDataChain.cs deleted file mode 100644 index 02b0b27d..00000000 --- a/src/ModSink.Common/Client/DynamicDataChain.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Linq; -using System.Threading.Tasks; -using Anotar.Serilog; -using DynamicData; -using ModSink.Common.Models.Client; -using ModSink.Common.Models.DTO.Repo; - -namespace ModSink.Common.Client -{ - public class DynamicDataChain - { - public static IObservable> GetDownloadsFromModpacks( - IObservable> modpacks) - { - return modpacks - .AutoRefresh(m => m.Selected) - .Filter(m => m.Selected) - .TransformMany(m => m.Mods, m => m.Mod.Id) - .TransformMany(m => m.Mod.Files.Values, fs => fs); - } - - public static IObservable> GetModpacksFromRepos( - IObservable> repos) - { - return repos - .TransformMany(r => r.Modpacks, m => m.Id); - } - } -} \ No newline at end of file diff --git a/src/ModSink.Common/Models/Client/Modpack.cs b/src/ModSink.Common/Models/Client/Modpack.cs index 5194f04a..5743a74a 100644 --- a/src/ModSink.Common/Models/Client/Modpack.cs +++ b/src/ModSink.Common/Models/Client/Modpack.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text; using ModSink.Common.Models.DTO.Repo; @@ -7,12 +8,27 @@ namespace ModSink.Common.Models.Client { public class Modpack { + public Modpack(DTO.Repo.Modpack modpack) + { + Name = modpack.Name; + Mods = modpack.Mods.Select(me => new ModEntry(me)).ToList(); + } + + public Guid Id { get; set; } = Guid.NewGuid(); public ICollection Mods { get; set; } public string Name { get; set; } } public class ModEntry { + + public ModEntry(DTO.Repo.ModEntry me) + { + Default = me.Default; + Required = me.Required; + Mod = new Mod(me.Mod); + } + public bool Default { get; set; } public Mod Mod { get; set; } @@ -22,6 +38,13 @@ public class ModEntry public class Mod { + public Mod(DTO.Repo.Mod mod) + { + Name = mod.Name; + Version = mod.Version; + Files = mod.Files; + } + public IDictionary Files { get; set; } public string Name { get; set; } diff --git a/src/ModSink.UI/ViewModel/LibraryViewModel.cs b/src/ModSink.UI/ViewModel/LibraryViewModel.cs index e8461bee..0a090ba8 100644 --- a/src/ModSink.UI/ViewModel/LibraryViewModel.cs +++ b/src/ModSink.UI/ViewModel/LibraryViewModel.cs @@ -7,12 +7,13 @@ using ModSink.Common.Models.DTO.Repo; using ReactiveUI; using ReactiveUI.Fody.Helpers; +using Modpack = ModSink.Common.Models.Client.Modpack; namespace ModSink.UI.ViewModel { public class LibraryViewModel : ReactiveObject { - public LibraryViewModel(IConnectableCache modpacks) + public LibraryViewModel(IObservableCache modpacks) { modpacks.Connect() .ObserveOn(RxApp.MainThreadScheduler) diff --git a/src/ModSink.UI/ViewModel/ModpackViewModel.cs b/src/ModSink.UI/ViewModel/ModpackViewModel.cs index 62225eda..082ca983 100644 --- a/src/ModSink.UI/ViewModel/ModpackViewModel.cs +++ b/src/ModSink.UI/ViewModel/ModpackViewModel.cs @@ -5,12 +5,13 @@ using Humanizer.Bytes; using ModSink.Common.Models.DTO.Repo; using ReactiveUI; +using Modpack = ModSink.Common.Models.Client.Modpack; namespace ModSink.UI.ViewModel { public class ModpackViewModel : ReactiveObject { - public ModpackViewModel(Modpack modpack) + public ModpackViewModel(Common.Models.Client.Modpack modpack) { Modpack = modpack; Size = ByteSize.FromBytes( @@ -18,8 +19,6 @@ public ModpackViewModel(Modpack modpack) .SelectMany(m => m.Mod.Files) .Select(f => f.Value.Length) .Aggregate((sum, a) => sum + a)).Humanize("G03"); - Install = ReactiveCommand.CreateFromTask(() => Task.Run(() => Modpack.Selected = true), - outputScheduler: RxApp.TaskpoolScheduler); } public ReactiveCommand Install { get; } diff --git a/src/ModSink.WPF/ViewModel/AppBootstrapper.cs b/src/ModSink.WPF/ViewModel/AppBootstrapper.cs index 0b170514..a02a382b 100644 --- a/src/ModSink.WPF/ViewModel/AppBootstrapper.cs +++ b/src/ModSink.WPF/ViewModel/AppBootstrapper.cs @@ -20,7 +20,7 @@ public AppBootstrapper() .Build(); Locator.CurrentMutable.RegisterConstant(modsink); var cs = modsink.Client; - DownloadsVM = new DownloadsViewModel(cs); + //DownloadsVM = new DownloadsViewModel(cs); LibraryVM = new LibraryViewModel(cs.Modpacks); SettingsVM = new SettingsViewModel(new SettingsModel(cs)); } From e9fba10efb7e6200b26c11f2ab4ef4376df155a0 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 14:13:18 +0100 Subject: [PATCH 09/21] gitversion config --- GitVersion.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GitVersion.yml b/GitVersion.yml index f732d850..269e9750 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,5 +1,10 @@ assembly-versioning-scheme: MajorMinorPatchTag mode: ContinuousDeployment -branches: {} +branches: + master: + increment: Patch + dependabot: + regex: dependabot + is-release-branch: false ignore: sha: [] From f4fb32e8073e4307dca17c6cdfdaf8882acc4cae Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 14:13:55 +0100 Subject: [PATCH 10/21] gitversion config (cherry picked from commit e9fba10efb7e6200b26c11f2ab4ef4376df155a0) --- GitVersion.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GitVersion.yml b/GitVersion.yml index f732d850..269e9750 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,5 +1,10 @@ assembly-versioning-scheme: MajorMinorPatchTag mode: ContinuousDeployment -branches: {} +branches: + master: + increment: Patch + dependabot: + regex: dependabot + is-release-branch: false ignore: sha: [] From e09d82be0cb146e3fc5b0f8b600bf8bcb0d45a3a Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 14:40:26 +0100 Subject: [PATCH 11/21] mainline --- GitVersion.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/GitVersion.yml b/GitVersion.yml index 269e9750..25d96f6f 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,10 +1,8 @@ assembly-versioning-scheme: MajorMinorPatchTag -mode: ContinuousDeployment +mode: Mainline branches: master: increment: Patch dependabot: regex: dependabot is-release-branch: false -ignore: - sha: [] From 5396ff795aa2cf4b4554d5a9987a6e6fb70ddd89 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 15:34:00 +0100 Subject: [PATCH 12/21] fix gitversion --- GitVersion.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GitVersion.yml b/GitVersion.yml index 25d96f6f..e17bb1b0 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -5,4 +5,9 @@ branches: increment: Patch dependabot: regex: dependabot + source-branches: + - develop + - master is-release-branch: false +ignore: + sha: [] From 54d45f5ff84b24163d23c8717b3e5e056dfca461 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 15:45:18 +0100 Subject: [PATCH 13/21] show diag on gitversion --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 3153f98c..d7f71fa6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,7 @@ install: - choco install codecov before_build: - - ps: gitversion /l console /output buildserver /updateAssemblyInfo + - ps: gitversion /l console /output buildserver /updateAssemblyInfo /diag - ps: msbuild /t:Clean - ps: msbuild /t:Restore /v:m From a31636bd672362304abd3aec8de9228432675ee3 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 15:57:08 +0100 Subject: [PATCH 14/21] dont track merge target on dependabot --- GitVersion.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GitVersion.yml b/GitVersion.yml index e17bb1b0..433ba714 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -9,5 +9,4 @@ branches: - develop - master is-release-branch: false -ignore: - sha: [] + track-merge-target: false From 7700df26cfda12e46cc1fe6d72ad25cf25a7f48a Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 16:30:18 +0100 Subject: [PATCH 15/21] reset .git --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index d7f71fa6..df6f5aed 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,9 @@ skip_tags: true image: Visual Studio 2019 Preview configuration: Release +init: +- pwsh: Remove-Item –path .git –recurse + install: - dotnet --info - choco install gitversion.portable -pre -y From ba64bbe2965feeade9f3af7105fde9c9a25adacf Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 16:34:22 +0100 Subject: [PATCH 16/21] list tags --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index df6f5aed..e872de6c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,9 +4,10 @@ image: Visual Studio 2019 Preview configuration: Release init: -- pwsh: Remove-Item –path .git –recurse +- pwsh: ls install: + - git tag - dotnet --info - choco install gitversion.portable -pre -y - choco install codecov From 6aa54182879926e536bd3f23685033f90b97c6f9 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 16:40:32 +0100 Subject: [PATCH 17/21] git tags dlete --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e872de6c..6fb65835 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,10 +3,10 @@ skip_tags: true image: Visual Studio 2019 Preview configuration: Release -init: -- pwsh: ls - install: + - git tag | foreach-object -process { git tag -d $_ } + - git tag + - git fetch --all - git tag - dotnet --info - choco install gitversion.portable -pre -y From ec829a6ff5d042e2305cb60c3bb4037f0dc0e9a6 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 16:43:57 +0100 Subject: [PATCH 18/21] ps --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 6fb65835..1fdf608e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,7 @@ image: Visual Studio 2019 Preview configuration: Release install: - - git tag | foreach-object -process { git tag -d $_ } + - ps: git tag | foreach-object -process { git tag -d $_ } - git tag - git fetch --all - git tag From a6567abf929b4794fec59ff598c45b1a86603b27 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Sun, 17 Mar 2019 16:57:37 +0100 Subject: [PATCH 19/21] ignore --- GitVersion.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GitVersion.yml b/GitVersion.yml index 433ba714..02261b3c 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -10,3 +10,5 @@ branches: - master is-release-branch: false track-merge-target: false +ignore: + sha: ['d979e3239f81843d583c81ac3b1370231dd43e45', 'e0f5d779c409b49b2e192e57be93cb4f19804dd3', '938179d7de817f61c2ebdc32dce6e5b08b841006', '73196267fd72a600bd1d84f35c4814ee910e37d1'] From 47e44058e154f6684e7cd1e3c1905c31e4c85956 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Mon, 18 Mar 2019 09:43:22 +0100 Subject: [PATCH 20/21] fix build errors --- .../Client/DynamicDataChainTests.cs | 128 ------------------ .../Models/Repo/ModpackTests.cs | 3 +- .../ViewModel/LibraryViewModelTests.cs | 10 +- 3 files changed, 6 insertions(+), 135 deletions(-) delete mode 100644 src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs diff --git a/src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs b/src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs deleted file mode 100644 index 0fa8cebe..00000000 --- a/src/ModSink.Common.Tests/Client/DynamicDataChainTests.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reactive.Concurrency; -using Bogus; -using DynamicData; -using FluentAssertions; -using ModSink.Common.Client; -using ModSink.Common.Models.DTO.Repo; -using ReactiveUI.Testing; -using Xunit; - -namespace ModSink.Common.Tests.Client -{ - public class DynamicDataChainTests - { - [Fact] - public void GetDownloadsFromModpacks() - { - using (TestUtils.WithScheduler(ImmediateScheduler.Instance)) - { - var modpacks = new SourceCache(_ => new Guid()); - var files = DynamicDataChain.GetDownloadsFromModpacks(modpacks.Connect()).AsObservableCache(); - files.Count.Should().Be(0); - var modpack = new Modpack - { - Mods = new List - { - new ModEntry - { - Mod = new Mod - { - Files = new Dictionary - { - {new Uri("http://a.b/"), new FileSignature(new HashValue(new byte[] {0x00}), 0)} - } - } - } - } - }; - modpacks.AddOrUpdate(modpack); - files.Count.Should().Be(0); - modpack.Selected = true; - files.Count.Should().Be(1); - modpack.Selected = false; - files.Count.Should().Be(0); - } - } - - [Fact] - public void GetModpacksFromReposTest() - { - using (TestUtils.WithScheduler(ImmediateScheduler.Instance)) - { - var faker = new Faker(); - var repos = new SourceCache(r => r.BaseUri); - var modpacks = ((IObservable>) repos.Connect() - .TransformMany(r => r.Modpacks, m => m.Id)).AsObservableCache(); - modpacks.Count.Should().Be(0); - repos.AddOrUpdate( - new Repo - { - BaseUri = new Uri(faker.Internet.UrlWithPath()), - Modpacks = new List {new Modpack(), new Modpack()} - }); - modpacks.Count.Should().Be(2); - repos.Clear(); - modpacks.Count.Should().Be(0); - } - } - - [Fact] - public void ObservableCacheRemoveKeyClears() - { - var source = new SourceCache(i => i); - var dest = source.Connect().RemoveKey().AsObservableList(); - source.AddOrUpdate(""); - source.Items.Should().HaveCount(1); - source.Clear(); - source.Items.Should().HaveCount(0); - dest.Items.Should().HaveCount(0); - } - - [Fact] - public void ObservableCacheRemoveKeyTransformClears() - { - var source = new SourceCache(i => i); - var dest = source.Connect().TransformMany(i => Enumerable.Repeat("", 1), i => i).AsObservableCache(); - source.AddOrUpdate(""); - source.Items.Should().HaveCount(1); - dest.Items.Should().HaveCount(1); - source.Clear(); - source.Items.Should().HaveCount(0); - dest.Items.Should().HaveCount(0); - } - - [Fact] - public void ObservableListClears() - { - var source = new SourceList(); - var dest = source.AsObservableList(); - source.Add(""); - source.Clear(); - source.Items.Should().HaveCount(0); - dest.Items.Should().HaveCount(0); - } - - [Fact] - public void ObservableListConnectClears() - { - var source = new SourceList(); - var dest = source.Connect().AsObservableList(); - source.Add(""); - source.Clear(); - source.Items.Should().HaveCount(0); - dest.Items.Should().HaveCount(0); - } - - [Fact] - public void SourceListClears() - { - var source = new SourceList(); - source.Add(""); - source.Clear(); - source.Items.Should().HaveCount(0); - } - } -} \ No newline at end of file diff --git a/src/ModSink.Common.Tests/Models/Repo/ModpackTests.cs b/src/ModSink.Common.Tests/Models/Repo/ModpackTests.cs index a97f07b5..e9eca7d1 100644 --- a/src/ModSink.Common.Tests/Models/Repo/ModpackTests.cs +++ b/src/ModSink.Common.Tests/Models/Repo/ModpackTests.cs @@ -7,8 +7,7 @@ public class ModpackTests : TestWithFaker { public static readonly Faker ModpackFaker = new Faker().StrictMode(true) .RuleFor(m => m.Name, f => f.Company.CompanyName()) - .RuleFor(m => m.Mods, ModEntryTests.ModEntryFaker.Generate(3)) - .RuleFor(m => m.Selected, f => f.Random.Bool()); + .RuleFor(m => m.Mods, ModEntryTests.ModEntryFaker.Generate(3)); public override Faker Faker { get; } = ModpackFaker; } diff --git a/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs b/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs index 0446006f..3506bf26 100644 --- a/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs +++ b/src/ModSink.UI.Tests/ViewModel/LibraryViewModelTests.cs @@ -1,10 +1,10 @@ using System; -using System.Data; using DynamicData; using FluentAssertions; using Microsoft.Reactive.Testing; -using ModSink.Common.Models.DTO.Repo; +using ModSink.Common.Models.Client; using ModSink.UI.ViewModel; +using ReactiveUI.Testing; using Xunit; namespace ModSink.UI.Tests.ViewModel @@ -14,12 +14,12 @@ public class LibraryViewModelTests [Fact(Skip = "Outdated")] public void AddModpack() { - ReactiveUI.Testing.TestUtils.With(new TestScheduler(), scheduler => + new TestScheduler().With(scheduler => { - var cache = new SourceCache(_=> Guid.NewGuid()); + var cache = new SourceCache(_ => Guid.NewGuid()); var vm = new LibraryViewModel(cache); vm.Modpacks.Should().BeEmpty(); - cache.AddOrUpdate(new Modpack()); + cache.AddOrUpdate(new Modpack(new Common.Models.DTO.Repo.Modpack())); scheduler.AdvanceBy(1); vm.Modpacks.Should().HaveCount(1); }); From d2151b8544dc7a3caa3f79f7a74a9c2667c7c993 Mon Sep 17 00:00:00 2001 From: J2ghz Date: Mon, 3 Jun 2019 19:21:10 +0200 Subject: [PATCH 21/21] cleanup --- .../Models/Repo/FileSignatureTests.cs | 3 +- .../Client/IFileAccessService.cs | 11 ++---- src/ModSink.Common/Models/Client/Group.cs | 8 ++-- src/ModSink.Common/Models/Client/Mod.cs | 22 +++++++++++ src/ModSink.Common/Models/Client/ModEntry.cs | 17 +++++++++ src/ModSink.Common/Models/Client/Modpack.cs | 37 +------------------ src/ModSink.Common/Models/Client/Repo.cs | 8 +--- .../Models/DTO/Repo/FileSignature.cs | 1 - .../Services/FileStorageService.cs | 1 - 9 files changed, 49 insertions(+), 59 deletions(-) create mode 100644 src/ModSink.Common/Models/Client/Mod.cs create mode 100644 src/ModSink.Common/Models/Client/ModEntry.cs diff --git a/src/ModSink.Common.Tests/Models/Repo/FileSignatureTests.cs b/src/ModSink.Common.Tests/Models/Repo/FileSignatureTests.cs index 47a3fb95..d8dcabba 100644 --- a/src/ModSink.Common.Tests/Models/Repo/FileSignatureTests.cs +++ b/src/ModSink.Common.Tests/Models/Repo/FileSignatureTests.cs @@ -22,8 +22,7 @@ public void SameEqual() { var a = new FileSignature(new HashValue(new byte[] {0x99, 0xE9, 0xD8, 0x51, 0x37, 0xDB, 0x46, 0xEF}), 355); var b = new FileSignature(new HashValue(new byte[] {0x99, 0xE9, 0xD8, 0x51, 0x37, 0xDB, 0x46, 0xEF}), 355); - a.Equals(b).Should().BeTrue("FileSignature with same properties should be equal") - ; + a.Equals(b).Should().BeTrue("FileSignature with same properties should be equal"); } } } \ No newline at end of file diff --git a/src/ModSink.Common/Client/IFileAccessService.cs b/src/ModSink.Common/Client/IFileAccessService.cs index 7bc36278..d5979ff0 100644 --- a/src/ModSink.Common/Client/IFileAccessService.cs +++ b/src/ModSink.Common/Client/IFileAccessService.cs @@ -1,22 +1,17 @@ -using System; -using System.Collections; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; -using System.Threading.Tasks; using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Client { public interface IFileAccessService { - IEnumerable FilesAvailable(); - Stream Read(FileSignature fileSignature,bool temporary); - - Stream Write(FileSignature fileSignature,bool temporary); + Stream Read(FileSignature fileSignature, bool temporary); void TemporaryFinished(FileSignature fileSignature); + Stream Write(FileSignature fileSignature, bool temporary); } } \ No newline at end of file diff --git a/src/ModSink.Common/Models/Client/Group.cs b/src/ModSink.Common/Models/Client/Group.cs index 67e342ac..6be5ae94 100644 --- a/src/ModSink.Common/Models/Client/Group.cs +++ b/src/ModSink.Common/Models/Client/Group.cs @@ -1,12 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; namespace ModSink.Common.Models.Client { public class Group { - public ICollection Repos { get; set; } public string Name { get; set; } + public ICollection Repos { get; set; } } -} +} \ No newline at end of file diff --git a/src/ModSink.Common/Models/Client/Mod.cs b/src/ModSink.Common/Models/Client/Mod.cs new file mode 100644 index 00000000..b723bffd --- /dev/null +++ b/src/ModSink.Common/Models/Client/Mod.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using ModSink.Common.Models.DTO.Repo; + +namespace ModSink.Common.Models.Client +{ + public class Mod + { + public Mod(DTO.Repo.Mod mod) + { + Name = mod.Name; + Version = mod.Version; + Files = mod.Files; + } + + public IDictionary Files { get; set; } + + public string Name { get; set; } + + public string Version { get; set; } + } +} \ No newline at end of file diff --git a/src/ModSink.Common/Models/Client/ModEntry.cs b/src/ModSink.Common/Models/Client/ModEntry.cs new file mode 100644 index 00000000..70bc61f2 --- /dev/null +++ b/src/ModSink.Common/Models/Client/ModEntry.cs @@ -0,0 +1,17 @@ +namespace ModSink.Common.Models.Client +{ + public class ModEntry + { + public ModEntry(DTO.Repo.ModEntry me) + { + Default = me.Default; + Required = me.Required; + Mod = new Mod(me.Mod); + } + + public bool Default { get; set; } + public Mod Mod { get; set; } + + public bool Required { get; set; } + } +} \ No newline at end of file diff --git a/src/ModSink.Common/Models/Client/Modpack.cs b/src/ModSink.Common/Models/Client/Modpack.cs index 5743a74a..4ef9a225 100644 --- a/src/ModSink.Common/Models/Client/Modpack.cs +++ b/src/ModSink.Common/Models/Client/Modpack.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Models.Client { @@ -18,37 +16,4 @@ public Modpack(DTO.Repo.Modpack modpack) public ICollection Mods { get; set; } public string Name { get; set; } } - - public class ModEntry - { - - public ModEntry(DTO.Repo.ModEntry me) - { - Default = me.Default; - Required = me.Required; - Mod = new Mod(me.Mod); - } - - public bool Default { get; set; } - public Mod Mod { get; set; } - - public bool Required { get; set; } - - } - - public class Mod - { - public Mod(DTO.Repo.Mod mod) - { - Name = mod.Name; - Version = mod.Version; - Files = mod.Files; - } - - public IDictionary Files { get; set; } - - public string Name { get; set; } - - public string Version { get; set; } - } -} +} \ No newline at end of file diff --git a/src/ModSink.Common/Models/Client/Repo.cs b/src/ModSink.Common/Models/Client/Repo.cs index c1dae259..317eee24 100644 --- a/src/ModSink.Common/Models/Client/Repo.cs +++ b/src/ModSink.Common/Models/Client/Repo.cs @@ -1,17 +1,13 @@ using System; using System.Collections.Generic; -using System.Text; using ModSink.Common.Models.DTO.Repo; namespace ModSink.Common.Models.Client { public class Repo { + public Uri BaseUri { get; set; } public IReadOnlyDictionary Files { get; set; } - public IReadOnlyCollection Modpacks { get; set; } - - public Uri BaseUri { get; set; } - } -} +} \ No newline at end of file diff --git a/src/ModSink.Common/Models/DTO/Repo/FileSignature.cs b/src/ModSink.Common/Models/DTO/Repo/FileSignature.cs index 0372f53c..8ca72dc4 100644 --- a/src/ModSink.Common/Models/DTO/Repo/FileSignature.cs +++ b/src/ModSink.Common/Models/DTO/Repo/FileSignature.cs @@ -27,7 +27,6 @@ public FileSignature(HashValue hash, long length) /// public ulong Length { get; set; } - public bool Equals(FileSignature other) { return Hash.Equals(other.Hash) && Length == other.Length; diff --git a/src/ModSink.Common/Services/FileStorageService.cs b/src/ModSink.Common/Services/FileStorageService.cs index ddb184f6..9b3a2040 100644 --- a/src/ModSink.Common/Services/FileStorageService.cs +++ b/src/ModSink.Common/Services/FileStorageService.cs @@ -12,7 +12,6 @@ public class FileStorageService private readonly IFileAccessService fileAccessService; - public FileStorageService(IFileAccessService fileAccessService) { this.fileAccessService = fileAccessService;