11using System ;
22
3+ // ReSharper disable UnusedParameter.Local
4+ // ReSharper disable UnusedAutoPropertyAccessor.Global
5+
36namespace Datacute . EmbeddedResourcePropertyGenerator ;
47
58/// <summary>
69/// Use a source generator to add properties to this class for each embedded resource file
7- /// with a filename matching the given <see cref="Extension"/ >
8- /// found in the given <see cref="Path"/ >.
10+ /// with a filename matching the given <see cref="Extension">Extension</see >
11+ /// found in the given <see cref="Path">Path</see >.
912/// <para>
1013/// If the path starts with "/" it is relative to the project root,
1114/// otherwise it is relative to the folder containing the class with this attribute.
@@ -14,16 +17,6 @@ namespace Datacute.EmbeddedResourcePropertyGenerator;
1417/// </summary>
1518/// <remarks>
1619/// <para>
17- /// Source generators only have access to <c>AdditionalFiles</c>.
18- /// All <c>EmbeddedResource</c> files can be automatically included as <c>AdditionalFiles</c>
19- /// by including the following line in the project file:
20- /// <code>
21- /// <ItemGroup>
22- /// <AdditionalFileItemNames>$(AdditionalFileItemNames);EmbeddedResource</AdditionalFileItemNames>
23- /// </ItemGroup>
24- /// </code>
25- /// </para>
26- /// <para>
2720/// The generated code includes a private nested class <c>EmbeddedResource</c> containing:
2821/// <list type="table">
2922/// <listheader><term>Method or Class</term><description>Purpose</description></listheader>
@@ -84,7 +77,7 @@ public sealed class EmbeddedResourcePropertiesAttribute : Attribute
8477{
8578 /// <value>The filename extension of the embedded resource files
8679 /// to include as properties, defaulting to ".txt".</value>
87- public string Extension { get ; private set ; }
80+ public string Extension { get ; set ; }
8881
8982 /// <value>The path of the directory of embedded resource files
9083 /// to include as properties.</value>
@@ -93,8 +86,52 @@ public sealed class EmbeddedResourcePropertiesAttribute : Attribute
9386 /// otherwise it is relative to the folder containing the class with this attribute.
9487 /// If the path is not specified, the class name is used.
9588 /// </remarks>
96- public string ? Path { get ; private set ; }
89+ public string ? Path { get ; set ; }
90+
91+ /// <value>
92+ /// Ignore the doc-comment cache and repeatedly read the embedded resource files to generate the doc-comments
93+ /// </value>
94+ /// <remarks>
95+ /// To include doc-comments on properties, embedded resource file are read once and the doc-comments are cached.
96+ /// The cache can be refreshed for embedded resource files matching this attributes path and extension,
97+ /// by temporarily setting this property to true.
98+ /// </remarks>
99+ public bool RegenerateDocCommentsWhileEditing { get ; set ; }
100+
101+ /// <value>
102+ /// Output a diagnostic trace log as a comment at the end of the generated files
103+ /// </value>
104+ /// <remarks>
105+ /// The log shows timestamps for each step of the Embedded Resource Property incremental source code generation process,
106+ /// </remarks>
107+ public bool DiagnosticTraceLog { get ; set ; }
108+
109+ /// <summary>
110+ /// Use a source generator to add properties to this class for each embedded resource file
111+ /// found in the <see cref="Path">path</see> with the folder name the same as this class,
112+ /// and where the file name's <see cref="Extension">extension</see> is ".txt"
113+ /// </summary>
114+ public EmbeddedResourcePropertiesAttribute ( ) : this ( ".txt" , null )
115+ {
116+ }
117+
118+ /// <summary>
119+ /// Use a source generator to add properties to this class for each embedded resource file
120+ /// found in the <see cref="Path">path</see> with the folder name the same as this class,
121+ /// and where the file name's <see cref="Extension">extension</see> matches the given extension.
122+ /// </summary>
123+ /// <param name="extension">The file name extension to include</param>
124+ public EmbeddedResourcePropertiesAttribute ( string extension = ".txt" ) : this ( extension , null )
125+ {
126+ }
97127
128+ /// <summary>
129+ /// Use a source generator to add properties to this class for each embedded resource file
130+ /// found in the specified <see cref="Path">path</see>,
131+ /// and where the file name's <see cref="Extension">extension</see> matches the given extension.
132+ /// </summary>
133+ /// <param name="extension">The file name extension to include</param>
134+ /// <param name="path">The folder path to include</param>
98135 public EmbeddedResourcePropertiesAttribute ( string extension = ".txt" , string ? path = null )
99136 {
100137 Extension = extension ;
0 commit comments