HotRS.Tools.Core
1.0.0.2
See the version list below for details.
dotnet add package HotRS.Tools.Core --version 1.0.0.2
NuGet\Install-Package HotRS.Tools.Core -Version 1.0.0.2
<PackageReference Include="HotRS.Tools.Core" Version="1.0.0.2" />
paket add HotRS.Tools.Core --version 1.0.0.2
#r "nuget: HotRS.Tools.Core, 1.0.0.2"
// Install HotRS.Tools.Core as a Cake Addin
#addin nuget:?package=HotRS.Tools.Core&version=1.0.0.2
// Install HotRS.Tools.Core as a Cake Tool
#tool nuget:?package=HotRS.Tools.Core&version=1.0.0.2
HotRS.Tools.Core
Various tools and extensions for .Net (6)
Follow/Contribute: https://github.com/rkreisel/HotRS.Tools.Core
Categories
Console Application Helper CloseIfNotAborted(int seconds = 60) - closes the application after the defined number of seconds if the user does not press a key.
Extensions
Assembly
GetTextFileFromAssembly(this Assembly asm, string filename)
Collection
IsNullOrEmpty<T>(this IEnumerable<T> source)
Configuration Three extensions to manage instantiated Configuration objects:
CleanUpJSONConfigs(this IConfiguration source, KeepWhich keepWhich = KeepWhich.First) CleanUpJSONConfigs(this IConfiguration source, IList<ConfigItem> items) PreferUserSecrets(this IConfiguration source)
Enum Three extensions to simplify using attributes on Enums:
GetEnumDescription<T>(this T value, bool useDisplayIfNoDesc = true, bool useDefaultIfNoDescOrDisplay = true) GetDataType<T>(this T value) GetValueFromDescription<T>(this T value, string description)
Exception Four extensions for Exceptions:
/* Access the normally readonly Data property. Useful for passing detailed information to the "catcher" of the exception. */ SetData<T>(this T source, IDictionary<string, string> data) //Access the normally readonly HelpLink property SetHelpLink<T>(this T source, string helpLink) /* Returns a simple List<Exception> with all the exceptions in the primary exception. */ GetInnerExceptions(this Exception ex) //Returns a list of all the exception messages as a single string AllExceptionMessages<T>(this T source, bool withCR = true)
Object A new custom CheckForNull extension that allows the developer to throw a custom exception of <T> with a custom message
CheckForNull<T>(this object o, string paramName, string message = "")
String A handful of string manipulation extensions:
ToNullableDateTime(this string s) ToNullableInt(this string s) AddCSVInjectionProtection(this string source) RemoveCSVInjectionProtection(this string source) DateStringFromExcelDateString(this string source, string format = null) AppendListToString<T>(this string source, List<T> list, string prefix = ", ")
ValidationError An extensions that formats the error messages into a string using the specified delimiter and optional line feed.
FormatErrors(this IList<ValidationResult> source, string delimiter = ", ", bool useLineFeed = false, bool includeMemberNames = false)
Helpers
File Upload (to web site) Methods to facilitate uploading of large files
UploadAsync(HttpContext context, FormOptions _defaultFormOptions, string fileStorePath) UploadSmallFileAsync(IFormFile file, string landingPath) GetEncoding(MultipartSection section)
HttpRequest (builder)
MIscellaneous
Directory
CleanUp(string folder, int hours) EnsurePathExists(string path)
Reflection
GetCurrentMethod()
ZipTools
GetManifest(string fileName) ExtractFile(string zipFileName, string itemPathAndName)
Office Excel
/* Gets the "name" of a column from its ordinal number. Use this to get the alphabetic value of an integer coulmn number. For instance 27 will return "AA" */ GetExcelColumnName(int columnNumber)
Office File Property Helper
/* Gets the extended file properties (Owner, LastUpdatedBy, whatever else is there) */ GetProperties(string fileName)
Testing Two methods that allow unit testing of private methods
GetPrivateMethod<T>(T source, string methodName) where T : class GetPrivateMethodAsync<T>(T source, string methodName) where T : class
Middleware Swagger Tool to add a FileUpload element to the Swagger screen
Utilities
A couple utility methods methods for JSON and XML files
ObfuscatedPropertyResolver(IEnumerable<string> propNamesToIgnore) ObfuscatingConverter PropertyRenameOrIgnoreSerializerContractResolver
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.1)
- Swashbuckle.AspNetCore.Swagger (>= 6.3.0)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial Release