7ed05abdb8
- 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.
112 lines
4.6 KiB
C#
112 lines
4.6 KiB
C#
// using aeqw89.DataKeys;
|
|
// using Beam.Dynamic;
|
|
// using System;
|
|
// using System.Collections.Generic;
|
|
// using System.Collections.Immutable;
|
|
// using System.Collections.ObjectModel;
|
|
// using System.Linq;
|
|
// using System.Text;
|
|
// using System.Threading.Tasks;
|
|
// using Beam.Data;
|
|
// using Beam.Fluent;
|
|
// using Beam.Models;
|
|
|
|
/*
|
|
* MAJOR TODO FIX THIS MESS
|
|
*/
|
|
|
|
//
|
|
// namespace Beam.Temporary.Cli {
|
|
//
|
|
// public record class ResourceDictionaryBuilder(string SiteKey) {
|
|
// private List<Func<WebResourceBuilder>> _builders;
|
|
//
|
|
//
|
|
// private record class WebResourceBuilder(string ResourceKey) {
|
|
// private Func<Template> _template;
|
|
// private Func<IReadOnlyDictionary<DataKey<DataBindings>, DataBindings>> _bindings;
|
|
// private string _name;
|
|
// private string _description;
|
|
// private Uri _domain;
|
|
//
|
|
// }
|
|
//
|
|
// private record class ResourceDictionaryRegistrar(
|
|
// string SiteKey,
|
|
// string FriendlyName,
|
|
// IEnumerable<WebResource> Resources,
|
|
// IReadOnlyDictionary<string, Template> Templates,
|
|
// IReadOnlyDictionary<string, DataBindings> Bindings) : IResourceDictionaryRegistrar {
|
|
//
|
|
// private Dictionary<string, ImmutableState> _states;
|
|
//
|
|
// public IResourceDictionaryRegistrar AddInitialState(string key, ImmutableState state) {
|
|
// _states[key] = state;
|
|
// return this;
|
|
// }
|
|
//
|
|
// public void Register(BeamDataContext sdd) {
|
|
// foreach (var resource in Resources)
|
|
// sdd.Resources.TryAdd(resource.Key, resource);
|
|
// // foreach (var template in Templates)
|
|
// // sdd.Templates.TryAdd(new DataKey<WebResource>(template.Key), template.Value);
|
|
// foreach (var binding in Bindings)
|
|
// sdd.Bindings.TryAdd(new DataKey<DataBindings>(binding.Key), binding.Value);
|
|
// foreach (var state in _states)
|
|
// sdd.InitialStates.TryAdd(new DataKey<ImmutableState>(state.Key), state.Value);
|
|
//
|
|
// sdd.ResourceDictionaries.TryAdd(new DataKey<ResourceDictionary>(SiteKey), new ResourceDictionary() {
|
|
// Key = new DataKey<ResourceDictionary>(SiteKey),
|
|
// FriendlyName = FriendlyName,
|
|
// InitialStates =
|
|
// });
|
|
// }
|
|
// }
|
|
// }
|
|
//
|
|
// public interface IResourceDictionaryRegistrar {
|
|
// public IResourceDictionaryRegistrar AddInitialState(string key, ImmutableState state);
|
|
// public void Register(BeamDataContext sdd);
|
|
// }
|
|
//
|
|
// public interface IBindingsBuilder {
|
|
// public IBindingsBuilder AddBinding(DataBindings bindings);
|
|
// public IBindingsBuilder AddBinding(Action<DataBindings> configure);
|
|
// public IReadOnlyDictionary<DataKey<DataBindings>, DataBindings> Build();
|
|
// }
|
|
//
|
|
// public interface IResourceDictionaryBuilder {
|
|
// public IResourceDictionaryBuilder AddResource(Func<ITemplateBuilderStage, IWebResourceBuilderStage> configure);
|
|
// public IResourceDictionaryBuilder WithResources(Func<ITemplateBuilderStage, IWebResourceBuilderStage>[] configure);
|
|
// public IResourceDictionaryBuilder WithFriendlyName(string friendlyName);
|
|
// public IResourceDictionaryRegistrar Then();
|
|
// }
|
|
//
|
|
// public interface IWebResourceBuilderStage {
|
|
// public IWebResourceBuilderStage WithName(string name); // Stage 3
|
|
// public IWebResourceBuilderStage WithDescription(string description); // Stage 3
|
|
// public IWebResourceBuilderStage WithDomain(Uri domain); // Stage 3
|
|
// public WebResource Build();
|
|
// }
|
|
//
|
|
// public interface IBindingBuilderStage {
|
|
// public IWebResourceBuilderStage WithBindings(Action<IBindingsBuilder> configure);
|
|
// public IWebResourceBuilderStage WithBindings(IReadOnlyDictionary<DataKey<DataBindings>, DataBindings> bindings);
|
|
// }
|
|
//
|
|
// public interface ITemplateBuilderStage {
|
|
// public IBindingBuilderStage WithTemplate(Action<ITemplateBuilder> configure);
|
|
// public IBindingBuilderStage WithTemplate(Template template);
|
|
// }
|
|
//
|
|
// public interface ITemplateBuilder {
|
|
// public ITemplateBuilder WithFactory(StateChangerFactory factory);
|
|
// public ITemplateBuilder WithUrlBuilder(LinkBuilder builder);
|
|
// public ITemplateBuilder WithUrlBuilder(Action<LinkBuilder> configure);
|
|
// public Template Build();
|
|
// }
|
|
//
|
|
|
|
|
|
// }
|