CoreTools 1.2.0

.NET 5.0
dotnet add package CoreTools --version 1.2.0
NuGet\Install-Package CoreTools -Version 1.2.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="CoreTools" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CoreTools --version 1.2.0
#r "nuget: CoreTools, 1.2.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install CoreTools as a Cake Addin
#addin nuget:?package=CoreTools&version=1.2.0

// Install CoreTools as a Cake Tool
#tool nuget:?package=CoreTools&version=1.2.0

icon

CoreTools

Lightweight package with some utilities for .NET Core.

release nuget release_date downloads license

Dependencies

net5 net6 drawing_common

Content

Content of the package:

GraphicUtils

This static class contains the following functions:

Point GetCursorPos()

Returns the current cursor position on display.

GDIUtils

This static class contains the following functions:

Color GetPixelColor(Point pos, [bool takeScreenshotWhenPossible = false])

Returns the color of the pixel at a specified position.
Parameters:
pos: Position of the pixel from to get the color.
takeScreenshotWhenPossible: Take a screenshot when possible to get the pixel color (this may be slower and is supported only in Windows).

Color GetPixelColorAtCursorPos([bool takeScreenshotWhenPossible = false])

Returns the color of the pixel at the current cursor position on display.
Parameters:
takeScreenshotWhenPossible: Take a screenshot when possible to get the pixel color (this may be slower and is supported only in Windows).

Bitmap CaptureScreenshot(Point pos, Size size)

Captures a screenshot from a specified position, with a specified size.
Parameters:
pos: Top-left corner of the screenshot.
size: Size of the screenshot.

Bitmap CaptureScreenshotAtCursorPos(Size size, Size offset)

Captures a screenshot from the current cursor position on display, with a specified size, and offset.
Parameters:
size: Size of the screenshot.
offset: Offset of the screenshot.

Bitmap CaptureScreenshotAtCursorPos(Size size)

Captures a screenshot from the current cursor position on display, with a specified size.
Parameters:
size: Size of the screenshot.

SystemUtils

This static class contains the following functions:

FileInfo GetExecutingFile()

Returns the current application executing file.

DirectoryInfo GetExecutingDirectory()

Returns the current application executing directory.

ColorExtensions

This static class provides a set of Color extensions:

Color Invert()

Inverts the Color by subtracting every value R, G, B from 255.

SizeExtensions

This static class provides a set of Size extensions:

Size Invert()

Inverts the Size by replacing every value with its negative.

Size UniformSize(int dim)

Initializes a new Size with uniform dimensions.
Parameters:
dim: Dimensions.

StringExtensions

This static class provides a set of string extensions:

bool IsDouble()

Checks if the string is a double.

bool IsInt()

Checks if the string is an int.

bool IsNumeric()

Checks if the string contains only numeric chars.

string NormalizeForDouble([bool ignoreFractionalZeros = true])

Normalizes the string for the type double.
Parameters:
ignoreFractionalZeros: Ignore if there are only zeros as the fractional part to speed up the algorithm.

string NormalizeForInt()

Normalizes the string for the type int.

string Append(char c)

Appends a char at the end of the string.
Parameters:
c: char to append.

string Append(string str)

Appends a string at the end of the string.
Parameters:
str: string to append.

string Reduce(int count)

Cuts the string by removing a specified number of chars from the end of the string.
Parameters:
count: Number of chars to remove from the end of the string.

string TakeStr(int count)

Returns a string by taking only the specified number of chars from the start of the string.
Parameters:
count: Number of chars to take from the start of the string.

string ToInt(int defaultValue)

Converts the string to an int. In case of errors returns a specified default value.
Parameters:
defaultValue: The default value used in case of errors.

string ToDouble(double defaultValue)

Converts the string to a double. In case of errors returns a specified default value.
Parameters:
defaultValue: The default value used in case of errors.

T? ParseTo<T>(T? defaultValue)

Converts the string to the specific type using a TypeDescriptor converter. In case of errors returns a specified default value.
Parameters:
defaultValue: The default value used in case of errors.

License

Copyright (C) 2021-2022 devpelux (Salvatore Peluso)
Licensed under MIT license.

mit

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CoreTools:

Package Downloads
WpfCoreTools

Lightweight package with some utilities for .NET Core wpf applications. Documentation: https://github.com/devpelux/wpfcoretools

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 273 5/20/2022
1.1.1.1 267 4/28/2022
1.1.0 351 12/29/2021
1.0.1 185 12/25/2021
1.0.0 318 12/23/2021

Added TakeStr, ToInt, ToDouble, and ParseTo string extensions.
Improved docs.