private static void StartService() { Console.WriteLine("Starting service..."); ExecSc($"start {_serviceName}"); Console.WriteLine("Service Started!"); ConsoleProgram.PressToContinue(); }
private static void UnregisterService() { Console.WriteLine("Unregistering service..."); ExecSc($"delete {_serviceName}"); Console.WriteLine("Service Unregistered!"); ConsoleProgram.PressToContinue(); }
private static void QueryService() { Console.WriteLine("Querying service..."); ExecSc($"query {_serviceName}"); Console.WriteLine("Service queried!"); ConsoleProgram.PressToContinue(); }
private static void DisableService() { Console.WriteLine("Disabling service..."); ExecSc($"config {_serviceName} start=disabled"); Console.WriteLine("Service disabled!"); ConsoleProgram.PressToContinue(); }
private static void SetDiscordWebHookUri() { Console.WriteLine("Enter Discord Webhook Uri: "); var webhook = Console.ReadLine(); UpdateFile("DiscordWebHookUri", webhook); ConsoleProgram.PressToContinue(); }
private static void SetTwitchApiClientId() { Console.WriteLine("Enter Twitch App Client ID: "); var clientId = Console.ReadLine(); UpdateFile("TwitchApiClientId", clientId); ConsoleProgram.PressToContinue(); }
private static void SetTwitchApiClientSecret() { Console.WriteLine("Enter Twitch App Client Secret: "); var secret = Console.ReadLine(); UpdateFile("TwitchApiClientSecret", secret); ConsoleProgram.PressToContinue(); }
private static void RegisterService() { System.Console.WriteLine("Registering service..."); var processPath = ConsoleProgram.GetBasePath(); var exePath = Path.Join(processPath, _exeName); var args = $"create {_serviceName} start=auto binpath=\"{exePath}\" displayname=\"{_serviceDisplayName}\""; ExecSc(args); args = $"description {_serviceName} \"{_serviceDescription}\""; ExecSc(args); args = $"failure {_serviceName} actions= restart/60000ms/restart/60000/restart/60000ms// reset= 3600"; ExecSc(args); System.Console.WriteLine("Service Registered!"); ConsoleProgram.PressToContinue(); }
private static void SetTwitchApiCheckIntervalSeconds() { bool isNumber = false; int interval; do { Console.WriteLine("Enter Twitch API Check Interval Seconds: "); var webhook = Console.ReadLine(); isNumber = int.TryParse(webhook, out interval); if (!isNumber) { Console.WriteLine("Response must be a number."); } } while (!isNumber); UpdateFile("TwitchApiCheckIntervalSeconds", interval); ConsoleProgram.PressToContinue(); }
public ChannelConfigPage(Program program) : base("Twitch Channels Configuration", program, new Option("Show channels", () => { ShowChannels(); ConsoleProgram.PressToContinue(); program.NavigateTo <ChannelConfigPage>(); }), new Option("Add channel", () => { AddChannel(); ConsoleProgram.PressToContinue(); program.NavigateTo <ChannelConfigPage>(); }), new Option("Remove channel", () => { RemoveChannel(); ConsoleProgram.PressToContinue(); program.NavigateTo <ChannelConfigPage>(); }), new Option("Exit Configtool", () => Environment.Exit(0))) { }
public BotConfigPage(Program program) : base("Bot Settings Configuration", program, new Option("Set TwitchApiClientId", () => { SetTwitchApiClientId(); program.NavigateTo <BotConfigPage>(); }), new Option("Set TwitchApiClientSecret", () => { SetTwitchApiClientSecret(); program.NavigateTo <BotConfigPage>(); }), new Option("Set DiscordWebHookUri", () => { SetDiscordWebHookUri(); program.NavigateTo <BotConfigPage>(); }), new Option("Set TwitchApiCheckIntervalSeconds", () => { SetTwitchApiCheckIntervalSeconds(); program.NavigateTo <BotConfigPage>(); }), new Option("Enable console logging", () => { UpdateFile("EnableConsoleLogging", true); ConsoleProgram.PressToContinue(); program.NavigateTo <BotConfigPage>(); }), new Option("Disable console logging", () => { UpdateFile("EnableConsoleLogging", false); ConsoleProgram.PressToContinue(); program.NavigateTo <BotConfigPage>(); }), new Option("Enable file logging", () => { UpdateFile("EnableFileLogging", true); ConsoleProgram.PressToContinue(); program.NavigateTo <BotConfigPage>(); }), new Option("Disable file logging", () => { UpdateFile("EnableFileLogging", false); ConsoleProgram.PressToContinue(); program.NavigateTo <BotConfigPage>(); }), new Option("Skip active streams on startup", () => { UpdateFile("SkipActiveStreamsOnStartup", true); ConsoleProgram.PressToContinue(); program.NavigateTo <BotConfigPage>(); }), new Option("Notify active streams on startup", () => { UpdateFile("SkipActiveStreamsOnStartup", false); ConsoleProgram.PressToContinue(); program.NavigateTo <BotConfigPage>(); }), new Option("Manage Channels", () => program.NavigateTo <ChannelConfigPage>()), new Option("Exit Configtool", () => Environment.Exit(0))) { }