NUlliiON / RDPWrapInstaller

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RDPWrapInstaller

RDPWrapInstaller is an implementation of the RDPWrapper installer that allows you to programmatically manage the installation, uninstallation and other features of RDPWrapper

Installing via NuGet (soon)

Install-Package ...

Usage

Creating instance

var rdpWrap = new RDPWrap();

Install

await rdpWrap.Install();

Uninstall

await rdpWrap.Uninstall();

Reload

await rdpWrap.Reload();

Usage example

private static RDPWrap _rdpWrap;
        
static async Task Main(string[] args)
{
    _rdpWrap = new RDPWrap();
    
    Console.WriteLine("I - install\n" +
                      "U - uninstall");
    Console.Write("Command: ");
    try
    {
        char cmd = Char.ToLower(Console.ReadKey().KeyChar);
        Console.WriteLine();
        var task = cmd switch
        {
            'i' => Install(),
            'u' => Uninstall(),
            _ => throw new ArgumentOutOfRangeException()
        };
        await task;
        Console.WriteLine("Command completed.");
    }
    catch (Exception ex)
    {
        Console.WriteLine("Error: " + ex);
    }

    Console.ReadLine();
}

private static async Task Install()
{
    if (!_rdpWrap.IsInstalled())
        await _rdpWrap.Install();
}

private static async Task Uninstall()
{
    if (_rdpWrap.IsInstalled())
        await _rdpWrap.Uninstall();
}

License

RDPWrapInstaller is licensed under the MIT license.

About

License:MIT License


Languages

Language:C# 100.0%