Skip to content

Commit

Permalink
resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
bezzad committed Sep 19, 2024
2 parents f0b8ebb + 8884dc3 commit 1a32afa
Show file tree
Hide file tree
Showing 71 changed files with 1,829 additions and 1,081 deletions.
50 changes: 15 additions & 35 deletions .github/workflows/dotnet-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,25 @@
name: Ubuntu x64

on: [push]
on: [ push ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.x

- name: Setup .NET Core 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Setup .NET Core 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Install Downloader Dependencies
run: dotnet restore ./src/Downloader/Downloader.csproj

- name: Build Downloader Project
run: dotnet build ./src/Downloader/Downloader.csproj

- name: Install Downloader.DummyHttpServer Dependencies
run: dotnet restore ./src/Downloader.DummyHttpServer/Downloader.DummyHttpServer.csproj

- name: Build Downloader.DummyHttpServer Project
run: dotnet build ./src/Downloader.DummyHttpServer/Downloader.DummyHttpServer.csproj
- name: Checkout code
uses: actions/checkout@v3

- name: Install Downloader.Test Dependencies
run: dotnet restore ./src/Downloader.Test/Downloader.Test.csproj
- name: Setup .NET Core 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Build Downloader.Test Project
run: dotnet build ./src/Downloader.Test/Downloader.Test.csproj
- name: Build solution
run: dotnet build -c Release ./src --verbosity minimal

- name: Test
run: dotnet test ./src/Downloader.Test/Downloader.Test.csproj --no-build --verbosity detailed
- name: Run tests
run: dotnet test -c Release ./src --verbosity normal --no-build --no-restore
50 changes: 15 additions & 35 deletions .github/workflows/dotnet-windows.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,25 @@
name: Windows x64

on: [push]
on: [ push ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.x

- name: Setup .NET Core 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Setup .NET Core 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Install Downloader Dependencies
run: dotnet restore ./src/Downloader/Downloader.csproj

- name: Build Downloader Project
run: dotnet build ./src/Downloader/Downloader.csproj

- name: Install Downloader.DummyHttpServer Dependencies
run: dotnet restore ./src/Downloader.DummyHttpServer/Downloader.DummyHttpServer.csproj

- name: Build Downloader.DummyHttpServer Project
run: dotnet build ./src/Downloader.DummyHttpServer/Downloader.DummyHttpServer.csproj
- name: Checkout code
uses: actions/checkout@v3

- name: Install Downloader.Test Dependencies
run: dotnet restore ./src/Downloader.Test/Downloader.Test.csproj
- name: Setup .NET Core 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Build Downloader.Test Project
run: dotnet build ./src/Downloader.Test/Downloader.Test.csproj
- name: Build solution
run: dotnet build -c Release ./src --verbosity minimal

- name: Test
run: dotnet test ./src/Downloader.Test/Downloader.Test.csproj --no-build --verbosity detailed
- name: Run tests
run: dotnet test -c Release ./src --verbosity normal --no-build --no-restore
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Windows x64](https://github.com/bezzad/Downloader/workflows/Windows%20x64/badge.svg)](https://github.com/bezzad/Downloader/actions/workflows/dotnet-windows.yml)
[![Ubuntu x64](https://github.com/bezzad/Downloader/workflows/Ubuntu%20x64/badge.svg)](https://github.com/bezzad/Downloader/actions/workflows/dotnet-ubuntu.yml)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/bezzad/downloader?branch=master&svg=true)](https://ci.appveyor.com/project/bezzad/downloader)
[![codecov](https://codecov.io/gh/bezzad/downloader/branch/master/graph/badge.svg)](https://codecov.io/gh/bezzad/downloader)
[![NuGet](https://img.shields.io/nuget/dt/downloader.svg)](https://www.nuget.org/packages/downloader)
[![NuGet](https://img.shields.io/nuget/vpre/downloader.svg)](https://www.nuget.org/packages/downloader)
Expand All @@ -15,9 +16,9 @@
:rocket: Fast, cross-platform and reliable multipart downloader with **.Net Core** supporting :rocket:

Downloader is a modern, fluent, asynchronous, testable and portable library for .NET. This is a multipart downloader with asynchronous progress events.
This library can be added to your `.Net Core v2` and later or `.Net Framework v4.5` or later projects.
This library can be added to your `.Net 8` or later projects.

Downloader is compatible with .NET Standard 2.0 and above, running on Windows, Linux, and macOS, in full .NET Framework or .NET Core.
Downloader is running on Windows, Linux, and macOS.

> For a complete example see [Downloader.Sample](https://github.com/bezzad/Downloader/blob/master/src/Samples/Downloader.Sample/Program.cs) project from this repository.
Expand Down Expand Up @@ -111,7 +112,7 @@ var downloadOpt = new DownloadConfiguration()
// minimum size of chunking to download a file in multiple parts, the default value is 512
MinimumSizeOfChunking = 1024,
// Before starting the download, reserve the storage space of the file as file size, the default value is false
ReserveStorageSpaceBeforeStartingDownload = true;
ReserveStorageSpaceBeforeStartingDownload = true,
// config and customize request headers
RequestConfiguration =
{
Expand Down
1 change: 1 addition & 0 deletions src/.idea/.idea.Downloader/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0;</TargetFrameworks>
<LangVersion>latestMajor</LangVersion>
<ServerGarbageCollection>true</ServerGarbageCollection>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
Expand All @@ -11,6 +10,7 @@
<SignAssembly>True</SignAssembly>
<DelaySign>True</DelaySign>
<AssemblyOriginatorKeyFile>sgKey.snk</AssemblyOriginatorKeyFile>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
Expand Down
4 changes: 3 additions & 1 deletion src/Downloader.DummyHttpServer/DummyApiException.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System.Net;
using System.Diagnostics.CodeAnalysis;
using System.Net;

namespace Downloader.DummyHttpServer;

[ExcludeFromCodeCoverage]
public class DummyApiException : WebException
{
public DummyApiException(string message)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using static System.Console;

namespace Downloader.DummyHttpServer;

[ExcludeFromCodeCoverage]
public class DummyApiExceptionFilterAttribute : ExceptionFilterAttribute
{
public override void OnException(ExceptionContext context)
Expand Down
6 changes: 4 additions & 2 deletions src/Downloader.DummyHttpServer/DummyData.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
using System;
using System.Diagnostics.CodeAnalysis;

namespace Downloader.DummyHttpServer;

/// <summary>
/// Class with helper methods to create random data
/// </summary>
[ExcludeFromCodeCoverage]
public static class DummyData
{
private static Random _rand = new Random(DateTime.Now.GetHashCode());
private static Random Rand = new Random(DateTime.Now.GetHashCode());

/// <summary>
/// Generates random bytes
Expand All @@ -19,7 +21,7 @@ public static byte[] GenerateRandomBytes(int length)
throw new ArgumentException("length has to be > 0");

byte[] buffer = new byte[length];
_rand.NextBytes(buffer);
Rand.NextBytes(buffer);
return buffer;
}

Expand Down
4 changes: 3 additions & 1 deletion src/Downloader.DummyHttpServer/DummyFileHelper.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.IO;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;

namespace Downloader.DummyHttpServer;

[ExcludeFromCodeCoverage]
public static class DummyFileHelper
{
public const string TempFilesExtension = ".temp";
Expand Down
2 changes: 2 additions & 0 deletions src/Downloader.DummyHttpServer/DummyLazyStream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;

namespace Downloader.DummyHttpServer;
Expand All @@ -10,6 +11,7 @@ public enum DummyDataType
Single
}

[ExcludeFromCodeCoverage]
public class DummyLazyStream : Stream
{
private readonly Random _random;
Expand Down
7 changes: 4 additions & 3 deletions src/Downloader.DummyHttpServer/HttpServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Server.Features;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Hosting;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Downloader.DummyHttpServer;

[ExcludeFromCodeCoverage]
public class HttpServer
{
private static IMemoryCache _cache = new MemoryCache(new MemoryCacheOptions());
private static IMemoryCache Cache = new MemoryCache(new MemoryCacheOptions());
private static IWebHost Server;
public static int Port { get; set; } = 3333;
public static CancellationTokenSource CancellationToken { get; set; }
Expand All @@ -30,7 +31,7 @@ public static void Run(int port)
if (CancellationToken.IsCancellationRequested)
return;

Server ??= _cache.GetOrCreate("DownloaderWebHost", e => {
Server ??= Cache.GetOrCreate("DownloaderWebHost", e => {
var host = CreateHostBuilder(port);
host.RunAsync(CancellationToken.Token).ConfigureAwait(false);
return host;
Expand Down
2 changes: 2 additions & 0 deletions src/Downloader.DummyHttpServer/MockMemoryStream.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

namespace Downloader.DummyHttpServer;

[ExcludeFromCodeCoverage]
public class MockMemoryStream : MemoryStream
{
private readonly long _failureOffset = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/Downloader.DummyHttpServer/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.Diagnostics.CodeAnalysis;

namespace Downloader.DummyHttpServer;

[ExcludeFromCodeCoverage]
internal class Startup
{
/// <summary>
Expand Down
11 changes: 6 additions & 5 deletions src/Downloader.Test/Downloader.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>
<IsPackable>false</IsPackable>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Sign.snk</AssemblyOriginatorKeyFile>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<IncludeSymbols>True</IncludeSymbols>
<Title>Downloader Tests</Title>
<LangVersion>latestMajor</LangVersion>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -25,19 +25,20 @@
<PackageReference Include="AssertMessage.Fody" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Fody" Version="6.8.1">
<PackageReference Include="Fody" Version="6.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading

0 comments on commit 1a32afa

Please sign in to comment.