Permalink
Browse files

Cleanup

  • Loading branch information...
1 parent dfdef4b commit e5a4992ce2343534a863bf78757727ef2524dc5c @NickCraver NickCraver committed Jul 24, 2016
Showing with 6 additions and 8 deletions.
  1. +4 −8 Opserver.Core/ExtensionMethods.cs
  2. +1 −0 Opserver.Core/StringSplits.cs
  3. +1 −0 Opserver.sln.DotSettings
@@ -70,7 +70,7 @@ public static partial class ExtensionMethods
/// </summary>
public static string ReadableTypeDescription(this Type t) =>
t.IsGenericType
- ? $"{t.Name.Split('`')[0]}<{string.Join(",", t.GetGenericArguments().Select(a => a.Name))}>"
+ ? $"{t.Name.Split(StringSplits.Tilde)[0]}<{string.Join(",", t.GetGenericArguments().Select(a => a.Name))}>"
: t.Name;
/// <summary>
@@ -127,14 +127,10 @@ public static string Pluralize(this long count, string name, bool includeNumber
/// force string to be maxlen or smaller
/// </summary>
public static string Truncate(this string s, int maxLength) =>
- s.IsNullOrEmpty()
- ? s
- : (s.Length > maxLength ? s.Remove(maxLength) : s);
+ s.IsNullOrEmpty() ? s : (s.Length > maxLength ? s.Remove(maxLength) : s);
public static string TruncateWithEllipsis(this string s, int maxLength) =>
- s.IsNullOrEmpty() || s.Length <= maxLength
- ? s
- : Truncate(s, Math.Max(maxLength, 3) - 3) + "...";
+ s.IsNullOrEmpty() || s.Length <= maxLength ? s : Truncate(s, Math.Max(maxLength, 3) - 3) + "";
public static string CleanCRLF(this string s) =>
string.IsNullOrWhiteSpace(s)
@@ -157,7 +153,7 @@ public static string NormalizeHostOrFQDN(this string s, bool defaultToHttps = fa
public static IEnumerable<T> WithIssues<T>(this IEnumerable<T> items) where T : IMonitorStatus =>
items.Where(i => i.MonitorStatus != MonitorStatus.Good);
-
+
public static string GetReasonSummary(this IEnumerable<IMonitorStatus> items) =>
string.Join(", ", items.WithIssues().Select(i => i.MonitorStatusReason));
@@ -25,6 +25,7 @@ public static class StringSplits
ForwardSlash = {'/'},
BackSlash = {'\\'},
DoubleQuote = {'"'},
+ Tilde = {'`'},
Period_Plus = {'.', '+'},
NewLine_CarriageReturn = {'\n', '\r'},
Comma_SemiColon = {',', ';'},
@@ -72,5 +72,6 @@
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FLOCAL_005FVARIABLE/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FOBJECT_005FPROPERTY_005FOF_005FFUNCTION/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FPARAMETER/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
+ <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsParsFormattingSettingsUpgrader/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsWrapperSettingsUpgrader/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>

0 comments on commit e5a4992

Please sign in to comment.