Repository navigation
Expand file tree
/
Copy pathIConfigHelp.cs
More file actions
60 lines (54 loc) · 2.54 KB
/
Copy pathIConfigHelp.cs
File metadata and controls
60 lines (54 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace SS.Core.ComponentInterfaces
{
/// <summary>
/// An <see cref="IConfigHelpAttribute"/> and the module it came from.
/// </summary>
/// <param name="Attribute">Attribute containing info about a config setting.</param>
/// <param name="Module">The module the <paramref name="Attribute"/> is in. <see langword="null"/> for attributes not in a module.</param>
public readonly record struct ConfigHelpRecord(IConfigHelpAttribute Attribute, Type? Module);
/// <summary>
/// Interface for getting information about config settings.
/// </summary>
public interface IConfigHelp : IComponentInterface
{
/// <summary>
/// Locks the config help data for reading.
/// </summary>
void Lock();
/// <summary>
/// Unlocks the config help data for reading.
/// </summary>
void Unlock();
/// <summary>
/// Gets a list of known config sections.
/// </summary>
/// <remarks>
/// Remember to use <see cref="Lock"/> and <see cref="Unlock"/>.
/// </remarks>
IReadOnlyList<string> Sections { get; }
/// <summary>
/// Gets keys for a config section.
/// </summary>
/// <remarks>
/// Remember to use <see cref="Lock"/> and <see cref="Unlock"/>.
/// </remarks>
/// <param name="section">The section to get key for.</param>
/// <param name="keyList">When this method returns, a list containing the keys in the section.</param>
/// <returns><see langword="true"/> if information was found. Otherwise, <see langword="false"/>.</returns>
bool TryGetSectionKeys(ReadOnlySpan<char> section, [MaybeNullWhen(false)] out IReadOnlyList<string> keyList);
/// <summary>
/// Gets help information about a setting.
/// </summary>
/// <remarks>
/// Remember to use <see cref="Lock"/> and <see cref="Unlock"/>.
/// </remarks>
/// <param name="section">The section of the setting.</param>
/// <param name="key">The key of the setting.</param>
/// <param name="helpList">A list of help records, one for each <see cref="ConfigHelpAttribute"/>..</param>
/// <returns><see langword="true"/> if information was found. Otherwise, <see langword="false"/>.</returns>
bool TryGetSettingHelp(ReadOnlySpan<char> section, ReadOnlySpan<char> key, [MaybeNullWhen(false)] out IReadOnlyList<ConfigHelpRecord> helpList);
}
}