39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Deploymentcenter.Client;
|
|
|
|
public interface ILicensePrompt
|
|
{
|
|
Task<string?> RequestLicenseKeyAsync(string productSlug);
|
|
void ShowLicenseError(string title, string message);
|
|
void ShowLicenseInfo(string title, string message);
|
|
}
|
|
|
|
public class ConsoleLicensePrompt : ILicensePrompt
|
|
{
|
|
public Task<string?> RequestLicenseKeyAsync(string productSlug)
|
|
{
|
|
Console.ForegroundColor = ConsoleColor.Yellow;
|
|
Console.WriteLine($"\n[🔑 Lizenzschlüssel erforderlich für '{productSlug}']");
|
|
Console.ResetColor();
|
|
Console.Write("Bitte Lizenzschlüssel eingeben: ");
|
|
string? input = Console.ReadLine();
|
|
return Task.FromResult(input?.Trim());
|
|
}
|
|
|
|
public void ShowLicenseError(string title, string message)
|
|
{
|
|
Console.ForegroundColor = ConsoleColor.Red;
|
|
Console.WriteLine($"\n[✖ {title}] {message}");
|
|
Console.ResetColor();
|
|
}
|
|
|
|
public void ShowLicenseInfo(string title, string message)
|
|
{
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
Console.WriteLine($"\n[✔ {title}] {message}");
|
|
Console.ResetColor();
|
|
}
|
|
}
|