@@ -14,12 +14,6 @@ namespace WriterSharp.PluginApi.Settings
1414 public interface ISettingsManager
1515 {
1616
17- /// <summary>
18- /// Checks if the settings file is in use by another plugin.
19- /// </summary>
20- /// <returns><c>true</c> if in use</returns>
21- bool InUse ( ) ;
22-
2317 /// <summary>
2418 /// Gets the plugin's section.
2519 /// </summary>
@@ -28,10 +22,12 @@ public interface ISettingsManager
2822 Task < Dictionary < string , string > > GetSectionAsync ( ) ;
2923
3024 /// <summary>
31- /// Update's the plugin's section.
25+ /// Gets the plugin's section.
3226 /// </summary>
33- /// <param name="section">The new version of the section</param>
34- void UpdateSectionAsync ( Dictionary < string , string > section ) ;
27+ /// <param name="cancellationToken">A cancellation token to stop WriterSharp from getting the section</param>
28+ /// <returns>The section, as a dictionary</returns>
29+ /// <remarks>Useful if you're going to be editing the settings a lot.</remarks>
30+ Task < Dictionary < string , string > > GetSectionAsync ( CancellationToken cancellationToken ) ;
3531
3632 // ReSharper disable once GrammarMistakeInComment
3733 /// <summary>
@@ -41,6 +37,20 @@ public interface ISettingsManager
4137 /// <returns>A string or <c>null</c> if the value was <c>nil</c>.</returns>
4238 Task < string ? > GetValueAsync ( string key ) ;
4339
40+ /// <summary>
41+ /// Retrieves a value from the plugin's section given a key. If the key is missing, an exception is thrown.
42+ /// </summary>
43+ /// <param name="key">The key that matches the value</param>
44+ /// <param name="cancellationToken">A cancellation token</param>
45+ /// <returns>A string or <c>null</c> if the value was <c>nil</c>.</returns>
46+ Task < string ? > GetValueAsync ( string key , CancellationToken cancellationToken ) ;
47+
48+ /// <summary>
49+ /// Checks if the settings file is in use by another plugin.
50+ /// </summary>
51+ /// <returns><c>true</c> if in use</returns>
52+ bool InUse ( ) ;
53+
4454 /// <summary>
4555 /// Sets an existing key to match a value or adds a new one if necessary.
4656 /// </summary>
@@ -87,29 +97,6 @@ public interface ISettingsManager
8797 /// <param name="pair">A key-value pair containing a key string and a value boolean</param>
8898 Task SetValueAsync ( KeyValuePair < string , bool > pair ) ;
8999
90- /// <summary>
91- /// Gets the plugin's section.
92- /// </summary>
93- /// <param name="cancellationToken">A cancellation token to stop WriterSharp from getting the section</param>
94- /// <returns>The section, as a dictionary</returns>
95- /// <remarks>Useful if you're going to be editing the settings a lot.</remarks>
96- Task < Dictionary < string , string > > GetSectionAsync ( CancellationToken cancellationToken ) ;
97-
98- /// <summary>
99- /// Update's the plugin's section.
100- /// </summary>
101- /// <param name="section">The new version of the section</param>
102- /// <param name="cancellationToken">A cancellation token</param>
103- void UpdateSectionAsync ( Dictionary < string , string > section , CancellationToken cancellationToken ) ;
104-
105- /// <summary>
106- /// Retrieves a value from the plugin's section given a key. If the key is missing, an exception is thrown.
107- /// </summary>
108- /// <param name="key">The key that matches the value</param>
109- /// <param name="cancellationToken">A cancellation token</param>
110- /// <returns>A string or <c>null</c> if the value was <c>nil</c>.</returns>
111- Task < string ? > GetValueAsync ( string key , CancellationToken cancellationToken ) ;
112-
113100 /// <summary>
114101 /// Sets an existing key to match a value or adds a new one if necessary.
115102 /// </summary>
@@ -163,6 +150,19 @@ public interface ISettingsManager
163150 /// <param name="cancellationToken">A cancellation token</param>
164151 Task SetValueAsync ( KeyValuePair < string , bool > pair , CancellationToken cancellationToken ) ;
165152
153+ /// <summary>
154+ /// Update's the plugin's section.
155+ /// </summary>
156+ /// <param name="section">The new version of the section</param>
157+ void UpdateSectionAsync ( Dictionary < string , string > section ) ;
158+
159+ /// <summary>
160+ /// Update's the plugin's section.
161+ /// </summary>
162+ /// <param name="section">The new version of the section</param>
163+ /// <param name="cancellationToken">A cancellation token</param>
164+ void UpdateSectionAsync ( Dictionary < string , string > section , CancellationToken cancellationToken ) ;
165+
166166 }
167167
168168}
0 commit comments