Skip to content

Commit e12a2fc

Browse files
committed
Add documentation to all events and fix analyzer warnings
1 parent 10b8258 commit e12a2fc

18 files changed

Lines changed: 271 additions & 16 deletions

ComponentSelectorAdditions/ComponentResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public ComponentResult(CategoryNode<Type>? category, Type type, string? group)
8686
}
8787

8888
/// <inheritdoc/>
89-
public override bool Equals(object obj)
89+
public override bool Equals(object? obj)
9090
=> obj is ComponentResult otherResult && otherResult.Type == Type;
9191

9292
/// <inheritdoc/>

ComponentSelectorAdditions/ComponentSelectorAdditions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<PackageId>ComponentSelectorAdditions</PackageId>
1111
<Title>Component Selector Additions</Title>
1212
<Authors>Banane9</Authors>
13-
<Version>0.9.0-beta</Version>
13+
<Version>0.10.0-beta</Version>
1414
<Description>This MonkeyLoader mod for Resonite overhauls the Component Selector / Protoflux Node Selector to have a search, as well as favorites and recents categories.</Description>
1515
<PackageReadmeFile>README.md</PackageReadmeFile>
1616
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>

ComponentSelectorAdditions/Events/BuildButtonEvent.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,49 @@
99

1010
namespace ComponentSelectorAdditions.Events
1111
{
12+
/// <summary>
13+
/// Abstract base class for button generation events.
14+
/// </summary>
1215
public abstract class BuildButtonEvent : CancelableBuildUIEvent
1316
{
17+
/// <summary>
18+
/// Gets whether the target of the button being generated is
19+
/// a direct <see cref="CategoryNode{T}.Elements">element</see>
20+
/// of the current <see cref="RootCategory">root category</see>.
21+
/// </summary>
1422
public bool IsDirectItem { get; }
23+
24+
/// <summary>
25+
/// Gets the category that the target of the button belongs to, if available.
26+
/// </summary>
1527
public CategoryNode<Type>? ItemCategory { get; }
28+
29+
/// <summary>
30+
/// Gets the current root category of the <see cref="ComponentSelector">selector</see>
31+
/// that the button is being generated for, if available.
32+
/// </summary>
1633
public CategoryNode<Type>? RootCategory { get; }
34+
35+
/// <summary>
36+
/// Gets the selector that the button is being generated for.
37+
/// </summary>
1738
public ComponentSelector Selector { get; }
1839

40+
/// <summary>
41+
/// Creates a new button generation event with the given data.
42+
/// </summary>
43+
/// <param name="selector">The selector that the button is being generated for.</param>
44+
/// <param name="ui">The <see cref="UIBuilder"/> to use while generating extra UI elements.</param>
45+
/// <param name="rootCategory">
46+
/// The current root category of the <see cref="ComponentSelector">selector</see>
47+
/// that the button is being generated for, if available.
48+
/// </param>
49+
/// <param name="itemCategory">The category that the target of the button belongs to, if available.</param>
50+
/// <param name="isDirectItem">
51+
/// Whether the target of the button being generated is
52+
/// a direct <see cref="CategoryNode{T}.Elements">element</see>
53+
/// of the current <see cref="RootCategory">root category</see>.
54+
/// </param>
1955
protected BuildButtonEvent(ComponentSelector selector, UIBuilder ui, CategoryNode<Type>? rootCategory, CategoryNode<Type>? itemCategory, bool isDirectItem) : base(ui)
2056
{
2157
Selector = selector;

ComponentSelectorAdditions/Events/BuildCategoryButtonEvent.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
namespace ComponentSelectorAdditions.Events
1010
{
11+
/// <summary>
12+
/// Represents the event data for the Build Category Button Event.
13+
/// </summary>
14+
/// <remarks>
15+
/// This is used to generate the button for opening a nested
16+
/// <see cref="CategoryNode{T}">category</see> in a <see cref="ComponentSelector">selector</see>.
17+
/// </remarks>
1118
public sealed class BuildCategoryButtonEvent : BuildButtonEvent
1219
{
1320
/// <inheritdoc/>

ComponentSelectorAdditions/Events/BuildComponentButtonEvent.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,23 @@
88

99
namespace ComponentSelectorAdditions.Events
1010
{
11+
/// <summary>
12+
/// Represents the event data for the Build Component Button Event.
13+
/// </summary>
14+
/// <remarks>
15+
/// This is used to generate the button to attach a concrete component,
16+
/// or to open the custom generic selection page for open generics.
17+
/// </remarks>
1118
public sealed class BuildComponentButtonEvent : BuildButtonEvent
1219
{
20+
/// <summary>
21+
/// Gets the component result that the button targets.
22+
/// </summary>
1323
public ComponentResult Component { get; }
1424

25+
/// <summary>
26+
/// Gets the current selector path.
27+
/// </summary>
1528
public SelectorPath Path { get; }
1629

1730
/// <inheritdoc/>

ComponentSelectorAdditions/Events/BuildCustomGenericBuilder.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,27 @@
1111

1212
namespace ComponentSelectorAdditions.Events
1313
{
14+
/// <summary>
15+
/// Represents the event data for the Build Custom Generic Builder Event.
16+
/// </summary>
17+
/// <remarks>
18+
/// This is used to generate the UI for picking custom generic arguments for generic components.
19+
/// </remarks>
1420
public sealed class BuildCustomGenericBuilder : BuildUIEvent
1521
{
1622
internal readonly HashSet<Button> OtherAddedButtonsSet = new();
1723

24+
/// <summary>
25+
/// Gets or sets whether a create custom type button has been added already during this event.
26+
/// </summary>
27+
/// <value><see langword="true"/> if a create custom type button has been added; otherwise, <see langword="false"/>.</value>
1828
[MemberNotNullWhen(true, nameof(CreateCustomTypeButton))]
1929
public bool AddsCreateCustomTypeButton => CreateCustomTypeButton is not null;
2030

31+
/// <summary>
32+
/// Gets or sets whether the inputs for generic arguments have been added already during this event.
33+
/// </summary>
34+
/// <value><see langword="true"/> if the inputs for generic arguments have been added; otherwise, <see langword="false"/>.</value>
2135
public bool AddsGenericArgumentInputs { get; set; }
2236

2337
/// <summary>
@@ -34,8 +48,19 @@ public sealed class BuildCustomGenericBuilder : BuildUIEvent
3448
/// </summary>
3549
public Button? CreateCustomTypeButton { get; set; }
3650

51+
/// <summary>
52+
/// Gets the generic arguments that inputs need to be generated for.
53+
/// </summary>
3754
public Type[] GenericArguments { get; }
55+
56+
/// <summary>
57+
/// Gets the other buttons that have been added to the custom generic builder.
58+
/// </summary>
3859
public IEnumerable<Button> OtherAddedButtons => OtherAddedButtonsSet.AsSafeEnumerable();
60+
61+
/// <summary>
62+
/// Gets the selector that the custom generic builder is being build for.
63+
/// </summary>
3964
public ComponentSelector Selector { get; }
4065

4166
internal BuildCustomGenericBuilder(ComponentSelector selector, UIBuilder ui, Type component) : base(ui)
@@ -45,12 +70,27 @@ internal BuildCustomGenericBuilder(ComponentSelector selector, UIBuilder ui, Typ
4570
GenericArguments = component.GetGenericArguments();
4671
}
4772

73+
/// <summary>
74+
/// Adds <see cref="OtherAddedButtons">another</see> button to the custom generic builder.
75+
/// </summary>
76+
/// <param name="button">The button to add.</param>
77+
/// <returns><see langword="true"/> if it was newly added; otherwise, <see langword="false"/>.</returns>
4878
public bool AddOtherButton(Button button)
4979
=> OtherAddedButtonsSet.Add(button);
5080

81+
/// <summary>
82+
/// Determines whether <see cref="OtherAddedButtons">another</see> button is already part of the custom generic builder.
83+
/// </summary>
84+
/// <param name="button">The button to check for.</param>
85+
/// <returns><see langword="true"/> if it was found; otherwise, <see langword="false"/>.</returns>
5186
public bool HasOtherButton(Button button)
5287
=> OtherAddedButtonsSet.Contains(button);
5388

89+
/// <summary>
90+
/// Removes <see cref="OtherAddedButtons">another</see> button from the custom generic builder.
91+
/// </summary>
92+
/// <param name="button">The button to remove.</param>
93+
/// <returns><see langword="true"/> if it was found and removed; otherwise, <see langword="false"/>.</returns>
5494
public bool RemoveOtherButton(Button button)
5595
=> OtherAddedButtonsSet.Remove(button);
5696
}

ComponentSelectorAdditions/Events/BuildGroupButtonEvent.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,22 @@
88

99
namespace ComponentSelectorAdditions.Events
1010
{
11+
/// <summary>
12+
/// Represents the event data for the Build Group Button Event.
13+
/// </summary>
14+
/// <remarks>
15+
/// This is used to generate the button to open a group of components.
16+
/// </remarks>
1117
public sealed class BuildGroupButtonEvent : BuildButtonEvent
1218
{
19+
/// <summary>
20+
/// Gets the group identifier that the button targets.
21+
/// </summary>
1322
public string Group { get; }
23+
24+
/// <summary>
25+
/// Gets the group name that the button should show.
26+
/// </summary>
1427
public string GroupName { get; }
1528

1629
/// <inheritdoc/>

ComponentSelectorAdditions/Events/BuildSelectorEvent.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,54 @@
66

77
namespace ComponentSelectorAdditions.Events
88
{
9+
/// <summary>
10+
/// Abstract base class for Build Selector Events.
11+
/// </summary>
912
public abstract class BuildSelectorEvent : BuildUIEvent
1013
{
14+
/// <summary>
15+
/// Gets or sets whether a back button has been added already during this event.
16+
/// </summary>
17+
/// <value><see langword="true"/> if a back button has been added; otherwise, <see langword="false"/>.</value>
1118
public bool AddsBackButton { get; set; }
19+
20+
/// <summary>
21+
/// Gets or sets whether a cancel button has been added already during this event.
22+
/// </summary>
23+
/// <value><see langword="true"/> if a cancel button has been added; otherwise, <see langword="false"/>.</value>
1224
public bool AddsCancelButton { get; set; }
1325

26+
/// <summary>
27+
/// Gets or sets whether a <see cref="SearchBar">search bar</see> has been added already during this event.
28+
/// </summary>
29+
/// <value><see langword="true"/> if a search bar has been added; otherwise, <see langword="false"/>.</value>
1430
[MemberNotNullWhen(true, nameof(SearchBar))]
1531
public bool AddsSearchBar => SearchBar is not null;
1632

33+
/// <summary>
34+
/// Gets or sets the search bar that has been added.
35+
/// </summary>
1736
public SelectorSearchBar? SearchBar { get; set; }
37+
38+
/// <summary>
39+
/// Gets the selector that is being build.
40+
/// </summary>
1841
public ComponentSelector Selector { get; }
42+
1943
internal Action<SelectorPath, bool>? SelectorUIChangedHandlers => SelectorUIChanged;
2044

2145
internal BuildSelectorEvent(ComponentSelector selector, UIBuilder ui) : base(ui)
2246
{
2347
Selector = selector;
2448
}
2549

50+
/// <summary>
51+
/// Fired when the selector UI is changed.<br/>
52+
/// The <see langword="bool"/> determines, whether the back button should be shown.
53+
/// </summary>
54+
/// <remarks>
55+
/// This allows UI generated from this event to respond to changes in the path or back button state.
56+
/// </remarks>
2657
public event Action<SelectorPath, bool>? SelectorUIChanged;
2758
}
2859
}

ComponentSelectorAdditions/Events/BuildSelectorFooterEvent.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,23 @@
44
namespace ComponentSelectorAdditions.Events
55
{
66
/// <summary>
7-
/// Represents the event fired when a <see cref="ComponentSelector"/>'s footer is constructed.
7+
/// Represents the event data for the Build Selector Footer Event.
88
/// </summary>
9+
/// <remarks>
10+
/// Fired when a <see cref="ComponentSelector"/>'s footer is constructed.
11+
/// </remarks>
912
public sealed class BuildSelectorFooterEvent : BuildSelectorEvent
1013
{
14+
/// <summary>
15+
/// Gets whether a back button was already added in
16+
/// the <see cref="BuildSelectorHeaderEvent">header</see>.
17+
/// </summary>
1118
public bool HasBackButton { get; }
1219

20+
/// <summary>
21+
/// Gets whether a cancel button was already added in
22+
/// the <see cref="BuildSelectorHeaderEvent">header</see>.
23+
/// </summary>
1324
public bool HasCancelButton { get; }
1425

1526
internal BuildSelectorFooterEvent(ComponentSelector selector, UIBuilder ui, SelectorSearchBar? searchBar, bool hasBackButton, bool hasCancelButton)

ComponentSelectorAdditions/Events/BuildSelectorHeaderEvent.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
namespace ComponentSelectorAdditions.Events
55
{
6+
/// <summary>
7+
/// Represents the event data for the Build Selector Footer Event.
8+
/// </summary>
9+
/// <remarks>
10+
/// Fired when a <see cref="ComponentSelector"/>'s header is constructed.
11+
/// </remarks>
612
public sealed class BuildSelectorHeaderEvent : BuildSelectorEvent
713
{
814
/// <inheritdoc/>

0 commit comments

Comments
 (0)