public static IEnumerable <Type> FindDerivedTypes([NotNull] Type baseType, Tristate classOnly) { var path = Path.GetDirectoryName(AppContext.BaseDirectory); classOnly = classOnly.ArgumentDefined(nameof(classOnly)); return(FindDerivedTypes(new DirectoryInfo(path), SearchOption.AllDirectories, baseType, classOnly)); }
public static void AppendKeyValue([NotNull] this StringBuilder sb, [NotNull] string key, [NotNull] string value, Tristate includeQuotes = Tristate.True, Tristate includeComma = Tristate.True) { sb = sb.ArgumentNotNull(); key = key.ArgumentNotNullOrEmpty(); value = value.ArgumentNotNullOrEmpty(); includeQuotes = includeQuotes.ArgumentDefined(); includeComma = includeComma.ArgumentDefined(); _ = sb.Append(key); _ = sb.Append(ControlChars.Equal); if (includeQuotes is Tristate.True or Tristate.UseDefault) { _ = sb.Append(ControlChars.Quote); var lastSpecialIndex = 0; int specialIndex; while (true) { specialIndex = value.IndexOfAny(_specialCharacters, lastSpecialIndex); if (specialIndex >= 0) { //TODO: THIS CONDITION NOT BEING TESTED FOR APPEND _ = sb.Append(value, lastSpecialIndex, specialIndex - lastSpecialIndex); _ = sb.Append(ControlChars.Backslash); _ = sb.Append(value[specialIndex]); lastSpecialIndex = specialIndex + 1; } else { _ = sb.Append(value, lastSpecialIndex, value.Length - lastSpecialIndex); break; } } _ = sb.Append(ControlChars.Quote); }