TSI.DotNet.Utilities 1.0.3

.NET Core 2.0
dotnet add package TSI.DotNet.Utilities --version 1.0.3
NuGet\Install-Package TSI.DotNet.Utilities -Version 1.0.3
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="TSI.DotNet.Utilities" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TSI.DotNet.Utilities --version 1.0.3
#r "nuget: TSI.DotNet.Utilities, 1.0.3"
#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.
// Install TSI.DotNet.Utilities as a Cake Addin
#addin nuget:?package=TSI.DotNet.Utilities&version=1.0.3

// Install TSI.DotNet.Utilities as a Cake Tool
#tool nuget:?package=TSI.DotNet.Utilities&version=1.0.3

TSI Dotnet Utility Components


Use the nuget package manager TSI Dotnet Utility to install component.

Install-Package TSI.DotNet.Utilities -Version (@latest)

1. Cryptography

Encrypt and Decrypt your strings.


Library to encrypt and decrypt the user registered password. Here we are going to maintain the custom key in configuration, so that the component user can set various key based on their projects to make the library unique.


To tight up the user information security.


//Import Namespace
using TSI.DotNet.Utilities;

Cryptography cryptography = new Cryptography();
string encryptedText = cryptography.Encryption("Your encryption text", "Your secret key");

Cryptography cryptography = new Cryptography();
string decryptedText = cryptography.Decryption("Your decryption text", "Your secret key");
<<<<<<<<< Temporary merge branch 1

2. ImageCompression

Compress image for custom size


Whenever the website or Mobile app users uploading the high pixel/resolution images or requirement to create a copy of thumbnail for an image uploaded, we can use this image compression library to compress the image with valid resolution. The component user have option to configure the compress resolution from settings.


//Import Namespace
using TSI.DotNet.Utilities;

Install-Package SixLabors.ImageSharp -Version 1.0.0-beta0007

ImageCompression.Compress.Start("Required Image size","Input image path","Output image path to save after compressed");

3. GoogleSheet

To avoid sharing reports as xls file in email, when multiple report user trying to comment the report from various places as single file.


When a customer requested to generate their reports through google sheet Daily, Weekly, Monthly or custom schedule basis, the component user can use this library by passing a set of database records, Sheetname, title etc., to create Google sheet records.


//Import Namespace
using TSI.DotNet.Utilities;

Steps to configure google sheet account

1. Login to your google sheet generation gmail account and go to https://developers.google.com/sheets/api/quickstart/dotnet
2. Click "Enable the Google Sheets API"
3. Download credentials.json file and place in project main folder.
   ex: GoogleSheetLibrary\bin\Debug\credentials.json

GoogleSheet.GenerateGoogleSheet("Your google sheetname", "IList set of data to bind in sheet")
Note: IList first row should be set of column names

4. EmailService

Email sending service library


By passing the required configuration into the library the developer can send the email for below configurations

  1. Multiple To feature
  2. Multiple CC feature
  3. Mulitiple BCC feature
  4. Accepting HTML template option
  5. Multiple Attchment feature
  6. Configure email display name


//Import Namespace
using TSI.DotNet.Utilities;

string msg = string.Empty;
EmailService emailService = new EmailService(
new EmailConfig
    Username = "username",
    Password = "password",
    Host = "Host name",
    Port = port,
    EnableSsl = true,
    FromEmail = "***@**.**",
    DisplayName = "Your title",
    ToEmail = new string[] { "**@**.**" },
    CCEmail = new string[] { "**@**.**" },
    BCCEmail = new string[] { "**.**@**.**" },
    Subject = "Test Email",
    Body = "Your plain/html content",
    IsBodyHtml = true/false,
    Attachments = new string[] { @"Path of attachment1", @"Path of attachment2", @"Path of attachment3", @"Path of attachment4" }
if (emailService.SendEmail(ref msg))
    //Your code

5. Google Authenticator

Google Two Factor Authenticator


It's easier than you think for someone to steal your password Any of these common actions could put you at risk of having your password stolen:

Using the same password on more than one site Downloading software from the Internet Clicking on links in email messages 2-Step Verification can help keep bad guys out, even if they have your password.


//Import Namespace
using TSI.DotNet.Utilities;

//Create Barcode image or Manual key for first setup
//User unique value - Should be unique for each user like userid or email etc.,
//AuthKey - Any Custom key unique for project level
//Title should display in GA app for this account

GoogleAuthenticator googleAuthenticator = new GoogleAuthenticator("User unique value", "AuthKey");
var setup = googleAuthenticator.GenerateTwoFactorAuthentication("Title");
if (googleAuthenticator.ValidatePin("your pin from GA"))
    //Your  code after successful validation
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. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 499 3/20/2020
1.0.2 394 3/16/2020
1.0.1 448 3/14/2020
1.0.0 430 3/4/2020

- Google Two-Factor Authentication,
- Email Serive