TSI.DotNet.Utilities 1.0.3

Dotnet Utilities Components

Install-Package TSI.DotNet.Utilities -Version 1.0.3
dotnet add package TSI.DotNet.Utilities --version 1.0.3
<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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TSI.DotNet.Utilities, 1.0.3"
#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 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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

TSI Dotnet Utility Components

Installation

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.

Description

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.

Goal

To tight up the user information security.

Usage

//Import Namespace
using TSI.DotNet.Utilities;

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

//Decryption
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

Description

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.

Usage

//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.

Description

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.

Usage

//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

Description

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

Usage

//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

Description

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.

Usage

//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
}

TSI Dotnet Utility Components

Installation

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.

Description

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.

Goal

To tight up the user information security.

Usage

//Import Namespace
using TSI.DotNet.Utilities;

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

//Decryption
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

Description

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.

Usage

//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.

Description

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.

Usage

//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

Description

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

Usage

//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

Description

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.

Usage

//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
}

Release Notes

- Google Two-Factor Authentication,
- Email Serive

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.3 206 3/20/2020
1.0.2 188 3/16/2020
1.0.1 231 3/14/2020
1.0.0 203 3/4/2020