Skip to content

Commit 06434f5

Browse files
committed
Added new functions to C# SDK API
1 parent 77f7260 commit 06434f5

File tree

1 file changed

+69
-2
lines changed
  • source/developers/plugins/csharp

1 file changed

+69
-2
lines changed

source/developers/plugins/csharp/api.html

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,33 @@ <h3>Example:</h3>
3030
}
3131
```
3232
</dd>
33+
34+
<dt id="ReadStringFromSection"><code>ReadStringFromSection</code> <small><span style="font-size: 0.85em;"><code>string ReadStringFromSection(string section, string option, string defValue, bool replace = true)</code></span></small></dt>
35+
<dd>
36+
<p>Returns a string representation of an option from a section.</p>
37+
<p>
38+
</p><ul>
39+
<li><code>section</code> : Section name to read the option from.</li>
40+
<li><code>option</code> : Option name to be read from the measure/meter.</li>
41+
<li><code>defValue</code> : Default value for the option if it is not found or invalid.</li>
42+
<li><code>replace</code> : If true, replaces section variables in the returned string.</li>
43+
</ul>
44+
<p></p>
45+
<h3>Example:</h3>
46+
``` cs
47+
internal void Reload(Rainmeter.API rm, ref double maxValue)
48+
{
49+
// The following will replace regular variables and
50+
// section variables in the 'Value' option.
51+
string value = rm.ReadStringFromSection("Section","Option", "DefaultValue");
52+
53+
// The following will only replace regular variables,
54+
// but NOT section variables like [MeasureNames].
55+
string action = rm.ReadStringFromSection("Section", "Action", "", false);
56+
}
57+
```
58+
</dd>
59+
3360
<dt id="ReadInt"><code>ReadInt</code> <small><code>int ReadInt(string option, int defValue)</code></small></dt>
3461
<dd>
3562
<p>Retrieves the option defined in the skin file and converts it to an integer.</p>
@@ -47,12 +74,32 @@ <h3>Example:</h3>
4774
}
4875
```
4976
</dd>
77+
78+
<dt id="ReadIntFromSection"><code>ReadIntFromSection</code> <small><code>int ReadIntFromSection(string section, string option, int defValue)</code></small></dt></code></small></dt>
79+
<dd>
80+
<p>Retrieves the option defined in a section and converts it to an integer.</p>
81+
<p>
82+
</p><ul>
83+
<li><code>section</code> : Section name to read the option from.</li>
84+
<li><code>option</code> : Option name to be read from the measure/meter.</li>
85+
<li><code>defValue</code> : Default value for the option if it is not found, invalid, or a formula could not be parsed.</li>
86+
</ul>
87+
<p></p>
88+
<h3>Example:</h3>
89+
``` cs
90+
internal void Reload(Rainmeter.API rm, ref double maxValue)
91+
{
92+
int value = rm.ReadIntFromSection("Section", "Option", 20);
93+
}
94+
```
95+
</dd>
96+
5097
<dt id="ReadDouble"><code>ReadDouble</code> <small><code>double ReadDouble(string option, double defValue)</code></small></dt>
5198
<dd>
52-
<p>Retrieves the option defined in the skin file and converts it to a double type.</p>
99+
<p>Retrieves the option defined in the plugin measure in the skin file and converts it to a double type.</p>
53100
<p>
54101
<ul>
55-
<li><code>option</code> : Option name to be read from the measure.</li>
102+
<li><code>option</code> : Option name to be read from the plugin measure.</li>
56103
<li><code>defValue</code> : Default value for the option if it is not found, invalid, or a formula could not be parsed.</li>
57104
</ul>
58105
</p>
@@ -63,6 +110,26 @@ <h3>Example:</h3>
63110
double value = rm.ReadDouble("Value", 20.0);
64111
}
65112
```
113+
</dd>
114+
<dt id="ReadDoubleFromSection"><code>ReadDoubleFromSection</code> <small><code>double ReadDoubleFromSection(string section, string option, double defValue)</code></small></dt>
115+
<dd>
116+
<p>Retrieves the option defined in any section and converts it to a double type.</p>
117+
<p>
118+
</p><ul>
119+
<li><code>section</code> : Section name to read the option from.</li>
120+
<li><code>option</code> : Option name to be read from the measure/meter.</li>
121+
<li><code>defValue</code> : Default value for the option if it is not found, invalid, or a formula could not be parsed.</li>
122+
</ul>
123+
<p></p>
124+
<h3>Example:</h3>
125+
``` cs
126+
internal void Reload(Rainmeter.API rm, ref double maxValue)
127+
{
128+
double value = rm.ReadDoubleFromSection("Section", "Option", 20.0);
129+
}
130+
```
131+
</dd>
132+
66133
</dd>
67134
<dt id="ReadPath"><code>ReadPath</code> <small><code>string ReadPath(string option, string defValue)</code></small></dt>
68135
<dd>

0 commit comments

Comments
 (0)