Skip to content

Commit a56114a

Browse files
committed
[add] missing XML comments
1 parent ffc2157 commit a56114a

5 files changed

Lines changed: 147 additions & 3 deletions

File tree

src/Simplify.Web/Modules/Data/DataCollector.cs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,43 @@
44

55
namespace Simplify.Web.Modules.Data;
66

7+
/// <summary>
8+
/// Provides the data collector.
9+
/// </summary>
10+
/// <seealso cref="IDataCollector" />
711
public class DataCollector(string mainContentVariableName, string titleVariableName, IStringTable stringTable) : IDataCollector
812
{
13+
/// <summary>
14+
/// Gets the name of the title variable.
15+
/// </summary>
16+
/// <value>
17+
/// The name of the title variable.
18+
/// </value>
919
public string TitleVariableName { get; } = titleVariableName;
1020

21+
/// <summary>
22+
/// Gets a data collector items which will be inserted into master template file.
23+
/// </summary>
24+
/// <value>
25+
/// The items.
26+
/// </value>
1127
public IDictionary<string, string> Items { get; } = new Dictionary<string, string>();
1228

29+
/// <summary>
30+
/// Gets the <see cref="string"/> with the specified key.
31+
/// </summary>
32+
/// <value>
33+
/// The <see cref="string"/>.
34+
/// </value>
35+
/// <param name="key">The key.</param>
1336
public string this[string key] => Items[key];
1437

38+
/// <summary>
39+
/// Set the template variable value (all occurrences will be replaced).
40+
/// </summary>
41+
/// <param name="variableName">Variable name in master template file.</param>
42+
/// <param name="value">Value to set.</param>
43+
/// <exception cref="ArgumentException">Value cannot be null or empty. - variableName</exception>
1544
public void Add(string? variableName, string? value)
1645
{
1746
if (string.IsNullOrEmpty(variableName))
@@ -28,6 +57,11 @@ public void Add(string? variableName, string? value)
2857
Items[variableName!] += value;
2958
}
3059

60+
/// <summary>
61+
/// Set the template variable value with a data from template (all occurrences will be replaced).
62+
/// </summary>
63+
/// <param name="variableName">Variable name in master template file.</param>
64+
/// <param name="template">The template.</param>
3165
public void Add(string variableName, ITemplate? template)
3266
{
3367
if (template == null)
@@ -36,17 +70,49 @@ public void Add(string variableName, ITemplate? template)
3670
Add(variableName, template.Get());
3771
}
3872

73+
/// <summary>
74+
/// Set the template main content variable value (all occurrences will be replaced).
75+
/// </summary>
76+
/// <param name="value">Value to set.</param>
3977
public void Add(string? value) => Add(mainContentVariableName, value);
4078

79+
/// <summary>
80+
/// Set the template main content variable value with a data from template (all occurrences will be replaced).
81+
/// </summary>
82+
/// <param name="template">The template.</param>
4183
public void Add(ITemplate template) => Add(mainContentVariableName, template);
4284

85+
/// <summary>
86+
/// Set the template title variable value (all occurrences will be replaced).
87+
/// </summary>
88+
/// <param name="value">Value to set.</param>
4389
public void AddTitle(string? value) => Add(TitleVariableName, value);
4490

91+
/// <summary>
92+
/// Set the template variable value from StringTable (all occurrences will be replaced).
93+
/// </summary>
94+
/// <param name="variableName">Variable name in master template file.</param>
95+
/// <param name="stringTableKey">StringTable key.</param>
4596
public void AddSt(string variableName, string stringTableKey) => Add(variableName, stringTable.GetItem(stringTableKey));
4697

98+
/// <summary>
99+
/// Set the template main content variable value from StringTable (all occurrences will be replaced).
100+
/// </summary>
101+
/// <param name="stringTableKey">StringTable key.</param>
47102
public void AddSt(string stringTableKey) => Add(stringTable.GetItem(stringTableKey));
48103

104+
/// <summary>
105+
/// Set the template title variable value from StringTable (all occurrences will be replaced).
106+
/// </summary>
107+
/// <param name="stringTableKey">StringTable key.</param>
49108
public void AddTitleSt(string stringTableKey) => AddTitle(stringTable.GetItem(stringTableKey));
50109

110+
/// <summary>
111+
/// Checking if some variable data is already exist in a data collector.
112+
/// </summary>
113+
/// <param name="variableName">Variable name.</param>
114+
/// <returns>
115+
/// <c>true</c> if the variable name exists; otherwise, <c>false</c>.
116+
/// </returns>
51117
public bool IsDataExist(string variableName) => Items.ContainsKey(variableName);
52118
}

src/Simplify.Web/Modules/Data/FileReader.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace Simplify.Web.Modules.Data;
1010
/// <summary>
1111
/// Provides the localizable files reader, reads the files from data folder.
1212
/// </summary>
13+
/// <seealso cref="IFileReader" />
1314
/// <remarks>
1415
/// Initializes a new instance of the <see cref="FileReader" /> class.
1516
/// </remarks>
@@ -49,8 +50,22 @@ public static void ClearCache()
4950

5051
#region Paths
5152

53+
/// <summary>
54+
/// Gets the file path.
55+
/// </summary>
56+
/// <param name="fileName">Name of the file.</param>
5257
public string GetFilePath(string fileName) => GetFilePath(fileName, _languageManager.Language);
5358

59+
/// <summary>
60+
/// Gets the file path.
61+
/// </summary>
62+
/// <param name="fileName">Name of the file.</param>
63+
/// <param name="language">The language.</param>
64+
/// <exception cref="ArgumentNullException">
65+
/// fileName
66+
/// or
67+
/// language
68+
/// </exception>
5469
public string GetFilePath(string? fileName, string? language)
5570
{
5671
if (string.IsNullOrEmpty(fileName)) throw new ArgumentNullException(nameof(fileName));
@@ -71,8 +86,20 @@ public string GetFilePath(string? fileName, string? language)
7186

7287
#region Text
7388

89+
/// <summary>
90+
/// Loads a text from a file located in data folder.
91+
/// </summary>
92+
/// <param name="fileName">File name.</param>
93+
/// <param name="memoryCache">Load file from memory cache if possible.</param>
7494
public string? LoadTextDocument(string fileName, bool memoryCache = false) => LoadTextDocument(fileName, _languageManager.Language, memoryCache);
7595

96+
/// <summary>
97+
/// Load a text from a file with specific language located in data folder.
98+
/// </summary>
99+
/// <param name="fileName">File name.</param>
100+
/// <param name="language">File language.</param>
101+
/// <param name="memoryCache">Load file from memory cache if possible.</param>
102+
/// <exception cref="ArgumentNullException">fileName</exception>
76103
public string? LoadTextDocument(string fileName, string language, bool memoryCache = false)
77104
{
78105
if (string.IsNullOrEmpty(fileName))
@@ -102,8 +129,20 @@ public string GetFilePath(string? fileName, string? language)
102129

103130
#region XML
104131

132+
/// <summary>
133+
/// Loads a xml document from a file located in data folder.
134+
/// </summary>
135+
/// <param name="fileName">File name.</param>
136+
/// <param name="memoryCache">Load file from memory cache if possible.</param>
105137
public XDocument? LoadXDocument(string fileName, bool memoryCache = false) => LoadXDocument(fileName, _languageManager.Language, memoryCache);
106138

139+
/// <summary>
140+
/// Loads a xml document from a file with specific language located in data folder.
141+
/// </summary>
142+
/// <param name="fileName">File name.</param>
143+
/// <param name="language">File language.</param>
144+
/// <param name="memoryCache">Load file from memory cache if possible.</param>
145+
/// <exception cref="ArgumentNullException">fileName</exception>
107146
public XDocument? LoadXDocument(string fileName, string language, bool memoryCache = false)
108147
{
109148
if (string.IsNullOrEmpty(fileName))

src/Simplify.Web/Modules/Data/IDataCollector.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,30 @@ public interface IDataCollector
1111
/// <summary>
1212
/// Gets the name of the title variable.
1313
/// </summary>
14+
/// <value>
15+
/// The name of the title variable.
16+
/// </value>
1417
string TitleVariableName { get; }
1518

1619
/// <summary>
1720
/// Gets a data collector items which will be inserted into master template file.
1821
/// </summary>
22+
/// <value>
23+
/// The items.
24+
/// </value>
1925
IDictionary<string, string> Items { get; }
2026

2127
/// <summary>
2228
/// List of a data collector items.
2329
/// </summary>
30+
/// <value>
31+
/// The <see cref="string"/>.
32+
/// </value>
2433
/// <param name="key">Item name.</param>
2534
string this[string key] { get; }
2635

2736
/// <summary>
28-
/// Set the template variable value (all occurrences will be replaced).
37+
/// Set the template variable value (all occurrences will be replaced).
2938
/// </summary>
3039
/// <param name="variableName">Variable name in master template file.</param>
3140
/// <param name="value">Value to set.</param>
@@ -59,8 +68,8 @@ public interface IDataCollector
5968
/// <summary>
6069
/// Set the template variable value from StringTable (all occurrences will be replaced).
6170
/// </summary>
62-
/// <param name="stringTableKey">StringTable key.</param>
6371
/// <param name="variableName">Variable name in master template file.</param>
72+
/// <param name="stringTableKey">StringTable key.</param>
6473
void AddSt(string variableName, string stringTableKey);
6574

6675
/// <summary>
@@ -79,5 +88,8 @@ public interface IDataCollector
7988
/// Checking if some variable data is already exist in a data collector.
8089
/// </summary>
8190
/// <param name="variableName">Variable name.</param>
91+
/// <returns>
92+
/// <c>true</c> if the variable name exists; otherwise, <c>false</c>.
93+
/// </returns>
8294
bool IsDataExist(string variableName);
8395
}

src/Simplify.Web/Modules/Data/IStringTable.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ public interface IStringTable
1010
/// <summary>
1111
/// Gets StringTable items.
1212
/// </summary>
13+
/// <value>
14+
/// The items.
15+
/// </value>
1316
IDictionary<string, object?> Items { get; }
1417

1518
/// <summary>
@@ -22,7 +25,9 @@ public interface IStringTable
2225
/// </summary>
2326
/// <typeparam name="T">Enum.</typeparam>
2427
/// <param name="enumValue">Enum value.</param>
25-
/// <returns>Associated value.</returns>
28+
/// <returns>
29+
/// Associated value.
30+
/// </returns>
2631
string? GetAssociatedValue<T>(T enumValue) where T : struct;
2732

2833
/// <summary>

src/Simplify.Web/Modules/Data/StringTable.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace Simplify.Web.Modules.Data;
1111
/// <summary>
1212
/// Provides the localizable text items string table.
1313
/// </summary>
14+
/// <seealso cref="IStringTable" />
1415
/// <param name="stringTableFiles">The string table files.</param>
1516
/// <param name="defaultLanguage">The default language.</param>
1617
/// <param name="languageManagerProvider">The language manager provider.</param>
@@ -27,15 +28,32 @@ public sealed class StringTable(IReadOnlyList<string> stringTableFiles,
2728

2829
private ILanguageManager _languageManager = null!;
2930

31+
/// <summary>
32+
/// Gets StringTable items.
33+
/// </summary>
34+
/// <value>
35+
/// The items.
36+
/// </value>
3037
public IDictionary<string, object?> Items { get; private set; } = null!;
3138

39+
/// <summary>
40+
/// Setups this string table.
41+
/// </summary>
3242
public void Setup()
3343
{
3444
_languageManager = languageManagerProvider.Get();
3545

3646
TryLoad();
3747
}
3848

49+
/// <summary>
50+
/// Gets an enum associated value from string table by enum type + enum element name.
51+
/// </summary>
52+
/// <typeparam name="T">Enum.</typeparam>
53+
/// <param name="enumValue">Enum value.</param>
54+
/// <returns>
55+
/// Associated value.
56+
/// </returns>
3957
public string? GetAssociatedValue<T>(T enumValue) where T : struct
4058
{
4159
var currentItems = (IDictionary<string, object>)Items;
@@ -46,6 +64,10 @@ public void Setup()
4664
: null;
4765
}
4866

67+
/// <summary>
68+
/// Gets an item from string table.
69+
/// </summary>
70+
/// <param name="itemName">Name of the item.</param>
4971
public string? GetItem(string itemName)
5072
{
5173
var currentItems = (IDictionary<string, object>)Items;

0 commit comments

Comments
 (0)