CsharpConsJobLib 1.0.4

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

// Install CsharpConsJobLib as a Cake Tool
#tool nuget:?package=CsharpConsJobLib&version=1.0.4

CsharpConsJob Library

CsharpConsJob is a lightweight C# Library written by Berka Ayowa that helps you create & schedule C# jobs

Latest version 1.0.4

##We recommend installing the latest library version 1.0.4 from Nuget and search CsharpConsJobLib from NuGet and install.

static void Main(string[] args)
{

    //Setting events
    //Setup a Function to call if any error occured 'OnException'
    JobRegistry.OnException += OnException;

    //This 'OnLogEvent' method is depreciated
    //JobRegistry.OnLogEvent += OnLog;

    //Setup a Function to print job activy on the console 'OnJobLog'
    JobRegistry.OnJobLogEvent += OnJobLog;

    //Adding job in chain
    JobRegistry.Instance

    //Every second
    //.Add<NotificationReport>("* * * ? * * *")

    //Every x seconds e.g every 30 seconds
    .Add<Email>("*/30 * * ? * * *")

    //Every mimutes
    //.Add<DaillyReport>("0 * * ? * * *")

    //Every x minutes e.g Every 2 minutes
    //.Add<SMS>("0 */1 * ? * * *")

    //Every Hour
    //.Add<BalanceStatement>("0 0 * ? * * *")

    //Every x hour e.g Every 2 hours
    //.Add<BalanceStatement>("0 0 */2 ? * * *")
    //.Add<NotificationReport>("0 0 14 19 * * *")

    //Every day at x hours e.g Every at 00:00
    //.Add<NotificationReport>("0 0 9 ? * * *")

    //Every day at x time e.g Every at 00:1
    //.Add<NotificationReport>("0 0 00:1 ? * * *")

    //Add a list of jobs , this functionality is available in version 1.0.2 up
    .Add("0 0 9:50 ? * * *", new List<Job>(){ new NotificationReport(), new BalanceStatement()})

    //CmdCommand.Execute is available in version 1.0.3 up
    //Run cmd command every x seconds e.g executing 'ipconfig' command every 10 seconds
    .Add("*/10 * * ? * * *", CmdCommand.Execute("ipconfig", (string result) =>
    {
        // Display the command output.
        Console.WriteLine(result);
    }))

    //Run cmd command every x seconds e.g cd in test folder and run git pull command every 10 seconds
    .Add("*/15 * * ? * * *", CmdCommand.Execute(@"cd C:\test&git pull", (string result) => {
        // Display the command output.
        Console.WriteLine(result);
    }))


    .Run();

}

public static void OnException(object source, Exception exception)
{
    //Display error if any occurs
    Console.WriteLine(DateTime.Now.ToString() + " - Exception - " + exception.Message);
}

public static void OnLog(object obj)
{
    //You can also log this to a file or just onscreen log
    Console.WriteLine(DateTime.Now.ToString() + " - " + obj.ToString());
}

public static void OnJobLog(LogType logType, object obj)
{
    //You can also log this to a file or just onscreen log
    Console.WriteLine(DateTime.Now.ToString() + " - " + obj.ToString());
}
Property
Name Description Example
Add Add job class to the job to the registry . JobRegistry.Instance.Add<NotificationReport>("* * * ? * *", Job)
Events
Name Description Example
OnException This event get triggered when any error occures JobRegistry.OnException += OnException
OnLogEvent This event get triggered to notify current job actions JobRegistry.OnLogEvent += OnLog
Action
Name Description Example
Run This action starts running the jobs available in the job registry JobRegistry.Instance.Run();

For generating more cron expressions you can check here or email us on ayowaberka@gmail.com for assistance or just to say hello 😃

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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.4 487 1/24/2022
1.0.3 281 12/30/2021
1.0.2 247 12/21/2021
1.0.1 361 12/21/2021
1.0.0 420 12/20/2021