Mistware.Utils 1.1.0

dotnet add package Mistware.Utils --version 1.1.0
                    
NuGet\Install-Package Mistware.Utils -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mistware.Utils" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mistware.Utils" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Mistware.Utils" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Mistware.Utils --version 1.1.0
                    
#r "nuget: Mistware.Utils, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Mistware.Utils@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Mistware.Utils&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Mistware.Utils&version=1.1.0
                    
Install as a Cake Tool

Mistware.Utils - miscellaneous C# utilities

Mistware is an identity chosen to evoke the concept of Vapourware.

These are utilities to simplify the task of creating web applications. They may be idiosyncratic and are almost certainly based on ideas from a previous era, but I find them useful and put them here to use them more easily.

Please don't blame me if you waste time trying to find something useful here and merely end up asking "why!!". You have been warned, the clue is in the name, perhaps there is nothing particularly useful here.

To minimise dependencies, Cache, Encryption and Xml classes were removed.

Features

  • Config. Static class to handle application settings. Consolidated configuration from environment (variables) and config file (which defaults to "web.config"). The Setup method reads in environment variables and config file settings. Thereafter settings can be accessed via Get and Set methods. Or using a number of built in properties: ContentRoot, WebRoot, AppName, AppURL, Env, Debug, LogFile.
  • DateTime. Date and Time Extensions. Midnight (time in DateTime is zero), Noon and SetTime. DOW, Jan1WeekDay, DOY, First, Last, Next, IsLeapYear, ISOWeekNum, ISOWeekOne, ISOYear, ToDateStamp, ToLogStamp, ToDateString, ToISODateString.
  • FileRead. StreamReader wrapper to read text file from filesystem or the internet. Can read the file a line at a time or the whole file at once.
  • Log. A singleton that logs fatal, error, warning, information and debug messages from applications. Has a default rolling file and console logger, which can be overridden by any other logger that implements the ILog interface.
  • MIME. Class with single static method (GetMimeType) that returns the MIME type associated with an extension (e.g. “application/pdf” for “.pdf”). If the extension is not found, “application/octet-stream” is returned.
  • String. String extensions: Truncate, Left, Mid, Right, ThrowOnNullOrEmpty, HasValue, IsNull, IsInteger, ToInteger, ToDouble, ToBool, ToEnum, CleanString, EscapeSingleQuote, StripQuotes, RemoveNonNumeric, ToDateTime, AsciiCtlStrip, MailMerge, NormalPath, Padding, MultiPart, ToDict, DictToString, Wordise, Match, ToStream, ToInList, ListTrim, ListToUpper, Validate, StringToList, ListToString.
  • XmlFileRead. A simple XML parser used by the Config class. It is not recommended that this be used for any other purpose, so no documentation is provided.

Documentation

Each class has Intellisense documentation. There is also a MistwareUtils.doc file, with additional usage guidance.

Usage

To add the nuget package to a .Net Core application:

dotnet add package Mistware.Utils 

Testing

Mistware.Utils has a basic test suite in the test folder (MistwareUtilsTest.csproj)

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Mistware.Utils:

Package Downloads
Mistware.Files

Library of C# utilities to support file upload / download and storage on Azure or local filestores.

Mistware.Postman

Library to do Mail Merge, using SendGrid as the mail engine.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 228 2/1/2025
1.0.2 1,135 4/22/2020
1.0.1 656 3/2/2020
1.0.0 634 3/2/2020