Skip to content

godsharp/Mina

Repository files navigation

Mina

license GitHub code size in bytes

A simple window service library for .net .

Build Status

Branch Status
master Build status
dev Build status
release Build status
Name Stable Preview
Mina MyGet NuGet MyGet NuGet

Usage

Install

You can install Mina via NuGet:

PM> Install-Package GodSharp.Mina

Use

  1. Add a class and inherited from MinaService, then override methods OnInitialize, OnStart, OnStop, OnPause, OnContinue, OnCustomCommand, OnShutdown, which you need.
public class MinaSampleService:MinaService
{
    public override void OnStart(string[] args)
    {
    }

    public override void OnStop()
    {
    }

    public override void OnPause()
    {
    }

    public override void OnContinue()
    {
    }

    public override void OnShutdown()
    {
    }

    public override void OnCustomCommand(int command)
    {
    }
}
  1. Run service, you can use the following method.
MinaHost.Run(new MinaOption(),new MinaSampleService(),args);
MinaHost.Run((o)=>{},new MinaSampleService(),args);
MinaHost.Run<MinaSampleService>(new MinaOption(),args);
MinaHost.Run<MinaSampleService>((o)=>{},args);

Service

The service install/uninstall, start/restart/pause/continue/stop, command.

The example service name is sample.exe.

Help

Syntax:

service.exe -h[elp]
service.exe /h[elp]

Sample:

sample.exe -h
sample.exe -help
sample.exe /h
sample.exe /help

Install

Syntax:

service.exe -i[nstall]
service.exe /i[nstall]

Sample:

sample.exe -i
sample.exe -install
sample.exe /i
sample.exe /install

Uninstall

Syntax:

service.exe -u[ninstall]
service.exe /u[ninstall]

Sample:

sample.exe -u
sample.exe -uninstall
sample.exe /u
sample.exe /uninstall

Start

Syntax:

service.exe -start
service.exe /start

Sample:

sample.exe -start
sample.exe /start

Restart

Syntax:

service.exe -r[estart]
service.exe /r[estart]

Sample:

sample.exe -r
sample.exe -restart
sample.exe /r
sample.exe /restart

Pause

Syntax:

service.exe -p[ause]
service.exe /p[ause]

Sample:

sample.exe -p
sample.exe -pause
sample.exe /p
sample.exe /pause

Continue

Syntax:

service.exe -c[ontinue]
service.exe /c[ontinue]

Sample:

sample.exe -c
sample.exe -continue
sample.exe /c
sample.exe /continue

Stop

Syntax:

service.exe -stop
service.exe /stop

Sample:

sample.exe -stop
sample.exe /stop

Command

Syntax:

service.exe -cmd|command command-parameter
service.exe /cmd|command command-parameter

command-parameter is int type.

Sample:

sample.exe -cmd 1
sample.exe -command 1
sample.exe /cmd 1
sample.exe /command 1

Sample

See sample project

About

A simple window service library for .net .

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages