Tools.Webkit
1.0.1
See the version list below for details.
dotnet add package Tools.Webkit --version 1.0.1
NuGet\Install-Package Tools.Webkit -Version 1.0.1
<PackageReference Include="Tools.Webkit" Version="1.0.1" />
paket add Tools.Webkit --version 1.0.1
#r "nuget: Tools.Webkit, 1.0.1"
// Install Tools.Webkit as a Cake Addin #addin nuget:?package=Tools.Webkit&version=1.0.1 // Install Tools.Webkit as a Cake Tool #tool nuget:?package=Tools.Webkit&version=1.0.1
Webkit
Webkit is a SDK for ASP.NET applications. This SDK provides a wide range of useful tools for data management, logging, authentication, authorization, security, sessions, telemetry and more.
Table of Content
Webkit.Extensions
Webkit contains a couple extension methods to make data conversion and management a lot easier.
Webkit.Extensions.Logging
Action<object> DefaultLog(object data)
The method used when Log methods are called. This is defaulted to Console.WriteLine
LoggingExtensions.DefaultLog = (object data) =>
{
Console.WriteLine(data);
}
<void> <T>.Log(T value)
Performs a .ToString() on value and calls the logging action.
int number = 3;
number.Log(); // 3
<void> <T>.Log(T value, string prependText)
Performs a .ToString() on value, prepends text then calls the logging action.
int number = 3;
number.Log("Number: "); // Number: 3
<void> <T>.Log(T value, string prependText, string appendText)
Performs a .ToString() on value, prepends and appends text then calls the logging action.
int number = 3;
number.Log("There are ", " items left"); // There are 3 items left
<void> <T>.LogAsJson(T value)
Performs a Json.Serialize on value and calls the logging action.
int number = 3;
number.Log(); // 3
<void> <T>.LogAsJson(T value, string prependText)
Performs a Json.Serialize on value, prepends text then calls the logging action.
int number = 3;
number.Log("Number: "); // Number: 3
<void> <T>.LogAsJson(T value, string prependText, string appendText)
Performs a Json.Serialize on value, prepends and appends text then calls the logging action.
int number = 3;
number.Log("There are ", " items left"); // There are 3 items left
<void> <T>.LogAsXml(T value)
Converts value to a XML sheet then calls the logging action.
int number = 3;
number.Log(); // 3
<void> <T>.LogAsXml(T value, string prependText)
Converts value to a XML sheet, prepends text then calls the logging action.
int number = 3;
number.Log("Number: "); // Number: 3
<void> <T>.LogAsXml(T value, string prependText, string appendText)
Converts value to a XML sheet, prepends and appends text then calls the logging action.
int number = 3;
number.Log("There are ", " items left"); // There are 3 items left
Webkit.Extensions.Console
Webkit has a couple extensions to make console logging with color quicker and easier.
<void> ConsoleColor.WriteLine(object value)
Writes value and appends Environment.NewLine to the console with specified console color.
ConsoleColor.Yellow.WriteLine("[Warning] Service is disabled, this may impact user experience."); // [Warning] Service is disabled, this may impact user experience.\r\n
<void> ConsoleColor.Write(object value)
Writes value to the console with specified console color.
ConsoleColor.Yellow.Write("[Warning] Service is disabled, this may impact user experience."); // [Warning] Service is disabled, this may impact user experience.
Webkit.Extensions.DataConversion
These extensions help convert and manage data to different formats.
<string> Stream.AsString()
Converts a stream to a string.
<string> string.Collapse()
Collapses the newlines in the string, making it one line.
@"Lorem ipsum
dolor sit
amet".Collapse();
// Lorem ipsum dolor sit amet
<string> IHeaderDictionary.AsString()
Converts a dictionary of headers to a string.
Request.Headers.AsString();
/*
Host: example.com
Content-Type: text/plain
Content-Length: 57
*/
<string> <T>.AsJson()
Converts any value to a json string
User user = new User()
{
Name = "John",
Email = "john@example.com"
};
user.AsJson();
/*
{
"Name": "John",
"Email": "john@example.com"
}
*/
<string> <T>.AsXml()
Converts any value to a XML sheet
User user = new User()
{
Name = "John",
Email = "john@example.com"
};
user.AsXml();
/*
<User xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>John</Name>
<Email>john@example.com</Email>
</User>
*/
Webkit.Security
Webkit contains a couple methods to manage data that needs to be cryptographically secure.
<string> CryptographicGenerator.Seed(int length)
Generates a cryptographically safe and universally unique seed. The seed will always be 9 characters longer than specified.
CryptographicGenerator.Seed(40); // Ujg2LLlbu1BspM6kmPk6dT7D71KpmoxbP3uNwJGP-8DC39DE328E6BD3
<string> CryptographicGenerator.UnicodeSeed(int length)
Generates a cryptographically safe and universally unique seed using the unicode range. The seed will always be 9 characters longer than specified.
CryptographicGenerator.UnicodeSeed(40); // ㉔ᩰ⩠ᇤみ᪸ㅇ┗᪄⯿㏹᰷┚₎ḇ◱⡈⚺ᅗ❽⁊ᐬ⫴⏿⺢ሱᴥᙵᙳᓃṵ⯱ᮈ⺶⽢᤹❽㏡⚐㊯-8DC39DE94A69998
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
- System.Runtime.Caching (>= 8.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Tools.Webkit:
Package | Downloads |
---|---|
Tools.Windows.DockerOrchestrator
An orchestration API designed to be used on Windows platforms with a Docker installation present. |
GitHub repositories
This package is not used by any popular GitHub repositories.