History

GrafanaAdapters: Removed cancellation token from 1.0 historian Grafana adapter GetMetadata function since this is not supported.

J. Ritchie Carroll committed 9 years ago

Commit 41513d41 parent b26a4ae3 files · +15 −18Browse files

Showing the changes to Source/Libraries/GSF.Core.Shared/StringExtensions.cs (1 of 3 files). Show all

Unified · Split

Source/Libraries/GSF.Core.Shared/StringExtensions.cs+12−12
@@ -221,7 +221,7 @@ namespace GSF · 220 unmodified lines
221221 throw new ArgumentNullException(nameof(type));
222222
223223 // Initialize culture info if not specified.
224− if ((object)culture == null)
224+ if (culture == null)
225225 culture = CultureInfo.InvariantCulture;
226226
227227 try
@@ -332,7 +332,7 @@ namespace GSF · 104 unmodified lines
332332 /// </remarks>
333333 public static string JoinKeyValuePairs(this IDictionary<string, string> pairs, char parameterDelimiter = ';', char keyValueDelimiter = '=', char startValueDelimiter = '{', char endValueDelimiter = '}')
334334 {
335− if ((object)pairs == null)
335+ if (pairs == null)
336336 throw new ArgumentNullException(nameof(pairs));
337337
338338 char[] delimiters = { parameterDelimiter, keyValueDelimiter };
@@ -387,7 +387,7 @@ namespace GSF · 48 unmodified lines
387387 [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
388388 public static Dictionary<string, string> ParseKeyValuePairs(this string value, char parameterDelimiter = ';', char keyValueDelimiter = '=', char startValueDelimiter = '{', char endValueDelimiter = '}', bool ignoreDuplicateKeys = true)
389389 {
390− if (value == (string)null)
390+ if (value == null)
391391 throw new ArgumentNullException(nameof(value));
392392
393393 if (parameterDelimiter == keyValueDelimiter ||
@@ -564,7 +564,7 @@ namespace GSF · 170 unmodified lines
564564 public static string ReplaceCharacters(this string value, char replacementCharacter, Func<char, bool> characterTestFunction)
565565 {
566566 // <pex>
567− if (characterTestFunction == (Func<char, bool>)null)
567+ if (characterTestFunction == null)
568568 throw new ArgumentNullException(nameof(characterTestFunction));
569569 // </pex>
570570
@@ -596,7 +596,7 @@ namespace GSF · 25 unmodified lines
596596 public static string RemoveCharacters(this string value, Func<char, bool> characterTestFunction)
597597 {
598598 // <pex>
599− if (characterTestFunction == (Func<char, bool>)null)
599+ if (characterTestFunction == null)
600600 throw new ArgumentNullException(nameof(characterTestFunction));
601601 // </pex>
602602
@@ -716,7 +716,7 @@ namespace GSF · 113 unmodified lines
716716 public static string ReplaceCrLfs(this string value, char replacementCharacter)
717717 {
718718 // <pex>
719− if (value == (string)null)
719+ if (value == null)
720720 throw new ArgumentNullException(nameof(value));
721721 // </pex>
722722
@@ -1092,7 +1092,7 @@ namespace GSF · 369 unmodified lines
10921092 public static char RegexDecode(this string value)
10931093 {
10941094 // <pex>
1095− if (value == (string)null)
1095+ if (value == null)
10961096 throw new ArgumentNullException(nameof(value));
10971097 // </pex>
10981098
@@ -1164,7 +1164,7 @@ namespace GSF · 65 unmodified lines
11641164 {
11651165 IntPtr intPtr;
11661166
1167− if ((object)value == null)
1167+ if (value == null)
11681168 return null;
11691169
11701170 intPtr = IntPtr.Zero;
@@ -1195,7 +1195,7 @@ namespace GSF · 24 unmodified lines
11951195 if (string.IsNullOrEmpty(value))
11961196 return "";
11971197
1198− if ((object)culture == null)
1198+ if (culture == null)
11991199 culture = CultureInfo.CurrentCulture;
12001200
12011201 return culture.TextInfo.ToTitleCase(value.ToLower());
@@ -1652,7 +1652,7 @@ namespace GSF · 450 unmodified lines
16521652 if (value.Length <= length)
16531653 return value;
16541654
1655− int s1_Len = (int)(length / 2) - 1;
1655+ int s1_Len = length / 2 - 1;
16561656
16571657 return string.Concat(value.Substring(0, s1_Len), "...", value.Substring(value.Length - s1_Len + 1 - length % 2));
16581658 }
@@ -1790,7 +1790,7 @@ namespace GSF · 131 unmodified lines
17901790 if (!double.TryParse(value, out test))
17911791 return "0";
17921792
1793− return test.ToString();
1793+ return test.ToString(CultureInfo.InvariantCulture);
17941794 }
17951795
17961796 bool isNeg = false;
@@ -1998,7 +1998,7 @@ namespace GSF · 201 unmodified lines
19981998 /// </summary>
19991999 /// <param name="value">Input string to process.</param>
20002000 /// <param name="characterTestFunction">The delegate function used to match characters.</param>
2001− /// <param name="startIndex">The index in <paramref name="value"/> from which to begin looking for <paramref name="testChar"/>. Typically length of <paramref name="value"/> minus 1."</param>
2001+ /// <param name="startIndex">The index in <paramref name="value"/> from which to begin executing test function. Typically length of <paramref name="value"/> minus 1."</param>
20022002 /// <returns>The index of the matching character within <paramref name="value"/> or (-1) if not found.</returns>
20032003 public static int IndexOfPrevious(this string value, Func<char, bool> characterTestFunction, int startIndex = 0)
20042004 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t