-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
99 lines (95 loc) · 3.93 KB
/
Program.cs
File metadata and controls
99 lines (95 loc) · 3.93 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Threading;
using System.Threading.Tasks;
namespace WiFiManager
{
class Program
{
static async Task Main(string[] args)
{
Console.OutputEncoding = System.Text.Encoding.UTF8;
// USE 'using' to ensure proper disposal
using var manager = new WiFiManagerCLI();
if (args.Length > 0)
{
switch (args[0].ToLower())
{
case "scan":
await manager.ScanNetworks();
break;
case "interfaces":
case "iface":
manager.ListInterfaces();
break;
case "interface":
if (args.Length > 1 && int.TryParse(args[1], out int ifaceIndex))
manager.SwitchInterface(ifaceIndex);
else
ColorConsole.WriteError("❌ Usage: wifimgr interface <index>");
break;
case "list":
manager.ListProfiles();
break;
case "connect":
if (args.Length > 1)
await manager.Connect(args[1]);
else
ColorConsole.WriteError("❌ Usage: wifimgr connect <SSID>");
break;
case "disconnect":
manager.Disconnect();
break;
case "status":
manager.ShowStatus();
break;
case "monitor":
await manager.StartMonitoring();
break;
case "test-notification":
case "test-notif":
manager.TestNotification();
break;
case "delete":
if (args.Length > 1)
manager.DeleteProfile(args[1]);
else
ColorConsole.WriteError("❌ Usage: wifimgr delete <SSID>");
break;
case "help":
case "--help":
case "-h":
ShowHelp();
break;
default:
ColorConsole.WriteError($"❌ Unknown command: {args[0]}");
ShowHelp();
break;
}
}
else
{
ShowHelp();
}
}
static void ShowHelp()
{
ColorConsole.WriteHeader("📡 WiFi Manager CLI");
Console.WriteLine();
ColorConsole.WriteInfo("Usage: wifimgr <command> [options]");
Console.WriteLine();
ColorConsole.WriteSuccess("Commands:");
Console.WriteLine(" interfaces - 📡 List all WiFi interfaces");
Console.WriteLine(" interface <N> - 🔄 Switch to interface N");
Console.WriteLine(" scan - 🔍 Scan for available networks");
Console.WriteLine(" list - 📋 List saved profiles");
Console.WriteLine(" connect <SSID> - 🔌 Connect to a network");
Console.WriteLine(" disconnect - ⛔ Disconnect from current network");
Console.WriteLine(" status - 📊 Show connection status");
Console.WriteLine(" monitor - 👁️ Monitor WiFi (with notifications)");
Console.WriteLine(" test-notif - 🔔 Test notifications (Toast & Growl)");
Console.WriteLine(" delete <SSID> - 🗑️ Delete saved profile");
Console.WriteLine(" help - ❓ Show this help");
Console.WriteLine();
}
}
}