refactor: modularize Beam into new projects and interfaces
- Introduced modularity by splitting Beam into new projects: Beam.Abstractions, Beam.Models, and Beam.Downloaders. - Refactored existing classes into appropriate namespaces and projects. - Replaced specific implementations with abstractions (e.g., SourceLinkBuilder to LinkBuilder, State to IState, etc.). - Updated interfaces: added ITemplate, IArticleData, IDownloadReport, and others for improved extensibility. - Removed deprecated classes like SourceLinkBuilder and StateChangerFactory. - Enhanced link handling in downloaders by refactoring to use `string` over `SourceLink`. - Consolidated shared logic under Beam.Abstractions.
This commit is contained in:
@@ -6,11 +6,9 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
<ProjectReference Include="..\Beam.Models\Beam.Models.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Beam\Beam.csproj">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</ProjectReference>
|
||||
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Beam.Abstractions;
|
||||
using Beam.Models;
|
||||
|
||||
namespace Beam.Exports {
|
||||
public class PlainTextExporter : IExporter, IAsyncExporter {
|
||||
@@ -24,14 +27,14 @@ namespace Beam.Exports {
|
||||
var text = Convert();
|
||||
if (!Directory.Exists(Path.GetDirectoryName(path)))
|
||||
throw new ArgumentException(S.M.FileDirectoryDoesNotExist, nameof(path));
|
||||
File.WriteAllText(path, text, Encoding.Unicode);
|
||||
System.IO.File.WriteAllText(path, text, Encoding.Unicode);
|
||||
}
|
||||
|
||||
public virtual async Task WriteAsync(string path) {
|
||||
var text = await ConvertAsync();
|
||||
if (!Directory.Exists(path))
|
||||
throw new ArgumentException(S.M.FileDirectoryDoesNotExist, nameof(path));
|
||||
await File.WriteAllTextAsync(path, text);
|
||||
await System.IO.File.WriteAllTextAsync(path, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Text;
|
||||
using Beam.Abstractions;
|
||||
using Beam.Models;
|
||||
|
||||
namespace Beam.Exports {
|
||||
public class HtmlExporter : PlainTextExporter {
|
||||
|
||||
Reference in New Issue
Block a user