-
Notifications
You must be signed in to change notification settings - Fork 3
/
Program.cs
77 lines (68 loc) · 2.23 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System.Diagnostics;
using System.Drawing;
namespace OpenCCTV
{
internal class Program
{
private static void Main(string[] args)
{
Console.Title = "CCTV Browser by Serialized";
Console.CursorVisible = false;
OpenMenu();
Console.ReadKey(); /* Prevent from closing */
}
/// <summary>
/// Displays the main menu for OpenCCTV.
/// </summary>
private static void OpenMenu()
{
Console.Clear();
Interface.InterfaceMaker.PrintLogo();
Interface.InterfaceMaker.WriteLine(Color.White, "~", "Welcome to OpenCCTV - Select An Option\n\n");
Interface.InterfaceMaker.WriteLine(Color.White, "1", "View Countries\n");
Interface.InterfaceMaker.WriteLine(Color.White, "2", "Goto Repository\n");
ConsoleKey cki = getCki;
switch (cki)
{
case ConsoleKey.NumPad1:
case ConsoleKey.D1:
CCTV.Utils.CountryMenu();
break;
case ConsoleKey.NumPad2:
case ConsoleKey.D2:
OpenWebpage("https://github.com/nak0823/OpenCCTV"); // Star the repo ;)
OpenMenu();
break;
default:
OpenMenu();
break;
}
}
/// <summary>
/// Opens a webpage using cmd.
/// </summary>
/// <param name="url"></param>
public static void OpenWebpage(string url)
{
try
{
Process.Start(new ProcessStartInfo
{
FileName = "cmd",
Arguments = $"/c start {url}",
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
});
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
/// <summary>
/// Returns the users selected ConsoleKey.
/// </summary>
private static ConsoleKey getCki => Console.ReadKey(true).Key;
}
}