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:
qwsdcvghyu89
2025-09-22 01:51:46 +10:00
parent a7d148a96f
commit 7ed05abdb8
128 changed files with 2058 additions and 1804 deletions
+14
View File
@@ -0,0 +1,14 @@
namespace Beam.Exceptions;
/// <summary>
/// The kind of exception that should never happen
/// </summary>
[Serializable]
public class AssertionException : Exception {
public AssertionException() { }
public AssertionException(string message) : base(message) { }
public AssertionException(string message, Exception inner) : base(message, inner) { }
protected AssertionException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}
+116
View File
@@ -0,0 +1,116 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Beam.Exceptions {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Exceptions {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Exceptions() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Beam.Exceptions.Exceptions", typeof(Exceptions).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to A fragment is locked when it should be free; failed to obtain updater..
/// </summary>
public static string fragment_locked {
get {
return ResourceManager.GetString("fragment_locked", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The argument at index &apos;{0}&apos; with name &apos;{1}&apos; is not marked optional and is missing..
/// </summary>
public static string link_builder_argument_missing {
get {
return ResourceManager.GetString("link_builder_argument_missing", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The flag &apos;{0}&apos; is incompatible with the flag(s) &apos;{1}&apos;.
/// </summary>
public static string link_builder_incompatible_flag {
get {
return ResourceManager.GetString("link_builder_incompatible_flag", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The query flag is only allowed on the last segment; found on segment index &apos;{0}&apos;.
/// </summary>
public static string link_builder_query_only_at_last {
get {
return ResourceManager.GetString("link_builder_query_only_at_last", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The stimulus must be an integer; got &apos;{0}&apos;.
/// </summary>
public static string num_state_changer_stimulus_must_be_int {
get {
return ResourceManager.GetString("num_state_changer_stimulus_must_be_int", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Encountered an error while changing state.
/// </summary>
public static string state_change_error {
get {
return ResourceManager.GetString("state_change_error", resourceCulture);
}
}
}
}
+39
View File
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="link_builder_argument_missing" xml:space="preserve">
<value>The argument at index '{0}' with name '{1}' is not marked optional and is missing.</value>
</data>
<data name="link_builder_incompatible_flag" xml:space="preserve">
<value>The flag '{0}' is incompatible with the flag(s) '{1}'</value>
</data>
<data name="link_builder_query_only_at_last" xml:space="preserve">
<value>The query flag is only allowed on the last segment; found on segment index '{0}'</value>
</data>
<data name="num_state_changer_stimulus_must_be_int" xml:space="preserve">
<value>The stimulus must be an integer; got '{0}'</value>
</data>
<data name="state_change_error" xml:space="preserve">
<value>Encountered an error while changing state</value>
</data>
<data name="fragment_locked" xml:space="preserve">
<value>A fragment is locked when it should be free; failed to obtain updater.</value>
</data>
</root>
+11
View File
@@ -0,0 +1,11 @@
namespace Beam.Exceptions;
[Serializable]
public class MapException : ArgumentException {
public MapException() { }
public MapException(string message) : base(message) { }
public MapException(string message, Exception inner) : base(message, inner) { }
protected MapException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}