Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetStringTable()

Dictionary< int, string > System.Diagnostics.PerformanceCounterLib.GetStringTable ( bool isHelp)
inlineprivate

Definition at line 175 of file PerformanceCounterLib.cs.

176 {
177 RegistryKey performanceData = Registry.PerformanceData;
179 try
180 {
181 string[] array = null;
182 int num = 14;
183 int num2 = 0;
184 while (num > 0)
185 {
186 try
187 {
188 array = (isHelp ? ((string[])performanceData.GetValue("Explain " + _perfLcid)) : ((string[])performanceData.GetValue("Counter " + _perfLcid)));
189 if (array == null || array.Length == 0)
190 {
191 num--;
192 if (num2 == 0)
193 {
194 num2 = 10;
195 continue;
196 }
198 num2 *= 2;
199 continue;
200 }
201 }
202 catch (IOException)
203 {
204 array = null;
205 }
206 catch (InvalidCastException)
207 {
208 array = null;
209 }
210 break;
211 }
212 if (array == null)
213 {
215 }
216 else
217 {
218 dictionary = new Dictionary<int, string>(array.Length / 2);
219 for (int i = 0; i < array.Length / 2; i++)
220 {
221 string text = array[i * 2 + 1];
222 if (text == null)
223 {
224 text = string.Empty;
225 }
226 if (!int.TryParse(array[i * 2], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
227 {
228 if (isHelp)
229 {
231 }
233 }
234 dictionary[result] = text;
235 }
236 }
237 }
238 finally
239 {
240 performanceData.Dispose();
241 }
242 return dictionary;
243 }
static CultureInfo InvariantCulture
static string CounterNameCorrupt
Definition SR.cs:82
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string CategoryHelpCorrupt
Definition SR.cs:80
Definition SR.cs:7
static void Sleep(int millisecondsTimeout)
Definition Thread.cs:658

References System.Diagnostics.PerformanceCounterLib._perfLcid, System.array, System.SR.CategoryHelpCorrupt, System.SR.CounterNameCorrupt, System.dictionary, System.SR.Format(), System.Globalization.CultureInfo.InvariantCulture, System.Threading.Thread.Sleep(), and System.text.