-
Notifications
You must be signed in to change notification settings - Fork 558
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CsvReader, CsvWriter, ExcelReader, ExcelWriter, HtmlWriter, PdfWriter
- Loading branch information
1 parent
41e7c35
commit fce9b5d
Showing
39 changed files
with
349 additions
and
225 deletions.
There are no files selected for viewing
11 changes: 8 additions & 3 deletions
11
src/Microservices/Common/ClassifiedAds.CrossCuttingConcerns/Csv/ICsvReader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
||
namespace ClassifiedAds.CrossCuttingConcerns.Csv; | ||
|
||
public interface ICsvReader<T> | ||
where T : ICsvResponse | ||
{ | ||
IEnumerable<T> Read(Stream stream); | ||
Task<T> ReadAsync(Stream stream); | ||
} | ||
|
||
public interface ICsvResponse | ||
{ | ||
} |
11 changes: 8 additions & 3 deletions
11
src/Microservices/Common/ClassifiedAds.CrossCuttingConcerns/Csv/ICsvWriter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
||
namespace ClassifiedAds.CrossCuttingConcerns.Csv; | ||
|
||
public interface ICsvWriter<T> | ||
where T : ICsvRequest | ||
{ | ||
void Write(IEnumerable<T> collection, Stream stream); | ||
Task WriteAsync(T data, Stream stream); | ||
} | ||
|
||
public interface ICsvRequest | ||
{ | ||
} |
8 changes: 7 additions & 1 deletion
8
src/Microservices/Common/ClassifiedAds.CrossCuttingConcerns/Excel/IExcelReader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
||
namespace ClassifiedAds.CrossCuttingConcerns.Excel; | ||
|
||
public interface IExcelReader<T> | ||
where T : IExcelResponse | ||
{ | ||
Task<T> ReadAsync(Stream stream); | ||
} | ||
|
||
public interface IExcelResponse | ||
{ | ||
T Read(Stream stream); | ||
} |
8 changes: 7 additions & 1 deletion
8
src/Microservices/Common/ClassifiedAds.CrossCuttingConcerns/Excel/IExcelWriter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
||
namespace ClassifiedAds.CrossCuttingConcerns.Excel; | ||
|
||
public interface IExcelWriter<T> | ||
where T : IExcelRequest | ||
{ | ||
void Write(T data, Stream stream); | ||
Task WriteAsync(T data, Stream stream); | ||
} | ||
|
||
public interface IExcelRequest | ||
{ | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Microservices/Common/ClassifiedAds.CrossCuttingConcerns/Html/IHtmlWriter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
||
namespace ClassifiedAds.CrossCuttingConcerns.Html; | ||
|
||
public interface IHtmlWriter<T> | ||
where T : IHtmlRequest | ||
{ | ||
Task WriteAsync(T data, Stream stream); | ||
|
||
Task<string> GetStringAsync(T data); | ||
} | ||
|
||
public interface IHtmlRequest | ||
{ | ||
} |
8 changes: 0 additions & 8 deletions
8
src/Microservices/Common/ClassifiedAds.CrossCuttingConcerns/HtmlGenerator/IHtmlGenerator.cs
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
src/Microservices/Common/ClassifiedAds.CrossCuttingConcerns/Pdf/IPdfWriter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
||
namespace ClassifiedAds.CrossCuttingConcerns.Pdf; | ||
|
||
public interface IPdfWriter<T> | ||
where T : IPdfRequest | ||
{ | ||
Task WriteAsync(T data, Stream stream); | ||
|
||
Task<byte[]> GetBytesAsync(T data); | ||
} | ||
|
||
public interface IPdfRequest | ||
{ | ||
} |
16 changes: 0 additions & 16 deletions
16
src/Microservices/Common/ClassifiedAds.CrossCuttingConcerns/PdfConverter/IPdfConverter.cs
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
src/Microservices/Common/ClassifiedAds.Infrastructure/Csv/CsvReader.cs
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
src/Microservices/Common/ClassifiedAds.Infrastructure/Csv/CsvWriter.cs
This file was deleted.
Oops, something went wrong.
9 changes: 3 additions & 6 deletions
9
...tors/HtmlGeneratorCollectionExtensions.cs → ...tructure/Html/HtmlCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
src/Microservices/Common/ClassifiedAds.Infrastructure/HtmlGenerators/HtmlGenerator.cs
This file was deleted.
Oops, something went wrong.
8 changes: 2 additions & 6 deletions
8
...DinkToPdfConverterCollectionExtensions.cs → ...inkToPdf/DinkToPdfCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
using ClassifiedAds.CrossCuttingConcerns.PdfConverter; | ||
using ClassifiedAds.Infrastructure.PdfConverters.DinkToPdf; | ||
using DinkToPdf; | ||
using DinkToPdf; | ||
using DinkToPdf.Contracts; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection; | ||
|
||
public static class DinkToPdfConverterCollectionExtensions | ||
public static class DinkToPdfCollectionExtensions | ||
{ | ||
public static IServiceCollection AddDinkToPdfConverter(this IServiceCollection services) | ||
{ | ||
services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools())); | ||
services.AddSingleton<IPdfConverter, DinkToPdfConverter>(); | ||
|
||
return services; | ||
} | ||
} |
9 changes: 2 additions & 7 deletions
9
...teerSharpConverterCollectionExtensions.cs → ...arp/PuppeteerSharpCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
using ClassifiedAds.CrossCuttingConcerns.PdfConverter; | ||
using ClassifiedAds.Infrastructure.PdfConverters.PuppeteerSharp; | ||
using PuppeteerSharp; | ||
using PuppeteerSharp; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection; | ||
|
||
public static class PuppeteerSharpConverterCollectionExtensions | ||
public static class PuppeteerSharpCollectionExtensions | ||
{ | ||
public static IServiceCollection AddPuppeteerSharpPdfConverter(this IServiceCollection services) | ||
{ | ||
var browserFetcher = new BrowserFetcher(); | ||
browserFetcher.DownloadAsync().GetAwaiter().GetResult(); | ||
|
||
services.AddSingleton<IPdfConverter, PuppeteerSharpConverter>(); | ||
|
||
return services; | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
...mmon/ClassifiedAds.Infrastructure/PdfConverters/PuppeteerSharp/PuppeteerSharpConverter.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.