-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
212 lines (189 loc) · 9.44 KB
/
Program.cs
File metadata and controls
212 lines (189 loc) · 9.44 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
using TorBoxSDK.Examples.ErrorHandling;
using TorBoxSDK.Examples.GettingStarted;
using TorBoxSDK.Examples.Helpers;
using TorBoxSDK.Examples.Main.General;
using TorBoxSDK.Examples.Main.Integrations;
using TorBoxSDK.Examples.Main.Notifications;
using TorBoxSDK.Examples.Main.Queued;
using TorBoxSDK.Examples.Main.Rss;
using TorBoxSDK.Examples.Main.Stream;
using TorBoxSDK.Examples.Main.Torrents;
using TorBoxSDK.Examples.Main.Usenet;
using TorBoxSDK.Examples.Main.User;
using TorBoxSDK.Examples.Main.Vendors;
using TorBoxSDK.Examples.Main.WebDownloads;
using TorBoxSDK.Examples.Relay;
using TorBoxSDK.Examples.Search;
Console.WriteLine("""
╔══════════════════════════════════════════════════════════╗
║ TorBoxSDK — Examples Runner ║
╠══════════════════════════════════════════════════════════╣
║ ║
║ Getting Started ║
║ 1. Basic DI Setup ║
║ 2. Configuration from appsettings.json ║
║ 3. Standalone Setup (No DI) ║
║ ║
║ ── Main Client ───────────────────────────────────── ║
║ ║
║ Main > Torrents ║
║ 4. List Torrents ║
║ 5. Create Torrent ║
║ 6. Control Torrent (pause/resume/delete) ║
║ 7. Download Torrent ║
║ 8. Check Cached ║
║ 9. Edit Torrent, Info by File & Magnet-to-File ║
║ ║
║ Main > Usenet ║
║ 10. List Usenet Downloads ║
║ 11. Create Usenet Download ║
║ 12. Usenet Advanced (Cache, Edit, Async Create) ║
║ ║
║ Main > Web Downloads ║
║ 13. List Web Downloads ║
║ 14. Create Web Download & Hosters ║
║ 15. Web Downloads Advanced (Cache, Edit, Async) ║
║ ║
║ Main > User ║
║ 16. Profile & Account Info ║
║ 17. Manage Settings ║
║ 18. Authentication & Device Auth ║
║ 19. Search Engines Management ║
║ 20. Transactions & PDF Export ║
║ ║
║ Main > Notifications ║
║ 21. Manage Notifications ║
║ ║
║ Main > RSS ║
║ 22. RSS Feeds ║
║ ║
║ Main > Integrations ║
║ 23. Cloud Storage Integration (Google Drive) ║
║ 24. All Cloud Providers (Dropbox, OneDrive, etc.) ║
║ 25. OAuth & Discord Integration ║
║ 26. Job Management ║
║ ║
║ Main > Vendors ║
║ 27. Vendor Account Management ║
║ ║
║ Main > Queued ║
║ 28. Queued Downloads ║
║ ║
║ Main > Stream ║
║ 29. Stream Media Files ║
║ ║
║ Main > General ║
║ 30. Service Status & Stats ║
║ 31. Speedtest Files ║
║ ║
║ ── Search Client ─────────────────────────────────── ║
║ ║
║ Search ║
║ 32. Search Torrents ║
║ 33. Search Usenet ║
║ 34. Search Meta (Movies, TV) ║
║ 35. Search Tutorials ║
║ 36. Download Search Results & Get by ID ║
║ ║
║ ── Relay Client ──────────────────────────────────── ║
║ ║
║ Relay ║
║ 37. Relay Status & Inactivity Check ║
║ ║
║ ── Other ─────────────────────────────────────────── ║
║ ║
║ Error Handling ║
║ 38. Comprehensive Error Handling Patterns ║
║ ║
║ 0. Exit ║
║ ║
╚══════════════════════════════════════════════════════════╝
""");
while (true)
{
Console.Write("Select an example (0-38): ");
string? input = Console.ReadLine();
if (!int.TryParse(input, out int choice))
{
Console.WriteLine("Invalid input. Please enter a number between 0 and 38.");
continue;
}
if (choice == 0)
{
Console.WriteLine("Goodbye!");
break;
}
if (choice is < 1 or > 38)
{
Console.WriteLine("Invalid choice. Please enter a number between 0 and 38.");
continue;
}
try
{
await (choice switch
{
// Getting Started
1 => BasicSetupExample.RunAsync(),
2 => ConfigurationExample.RunAsync(),
3 => StandaloneSetupExample.RunAsync(),
// Main > Torrents
4 => ListTorrentsExample.RunAsync(),
5 => CreateTorrentExample.RunAsync(),
6 => ControlTorrentExample.RunAsync(),
7 => DownloadTorrentExample.RunAsync(),
8 => CheckCachedExample.RunAsync(),
9 => EditTorrentExample.RunAsync(),
// Main > Usenet
10 => ListUsenetExample.RunAsync(),
11 => CreateUsenetExample.RunAsync(),
12 => UsenetAdvancedExample.RunAsync(),
// Main > Web Downloads
13 => ListWebDownloadsExample.RunAsync(),
14 => CreateWebDownloadExample.RunAsync(),
15 => WebDownloadsAdvancedExample.RunAsync(),
// Main > User
16 => GetProfileExample.RunAsync(),
17 => ManageSettingsExample.RunAsync(),
18 => AuthenticationExample.RunAsync(),
19 => SearchEnginesExample.RunAsync(),
20 => TransactionsExample.RunAsync(),
// Main > Notifications
21 => NotificationsExample.RunAsync(),
// Main > RSS
22 => RssFeedsExample.RunAsync(),
// Main > Integrations
23 => CloudIntegrationExample.RunAsync(),
24 => AllCloudProvidersExample.RunAsync(),
25 => OAuthExample.RunAsync(),
26 => JobManagementExample.RunAsync(),
// Main > Vendors
27 => VendorExample.RunAsync(),
// Main > Queued
28 => QueuedDownloadsExample.RunAsync(),
// Main > Stream
29 => StreamExample.RunAsync(),
// Main > General
30 => GeneralExample.RunAsync(),
31 => SpeedtestExample.RunAsync(),
// Search
32 => SearchTorrentsExample.RunAsync(),
33 => SearchUsenetExample.RunAsync(),
34 => SearchMetaExample.RunAsync(),
35 => SearchTutorialsExample.RunAsync(),
36 => DownloadSearchResultsExample.RunAsync(),
// Relay
37 => RelayExample.RunAsync(),
// Error Handling
38 => ErrorHandlingExample.RunAsync(),
_ => Task.CompletedTask,
});
}
catch (Exception ex)
{
Console.Error.WriteLine($"Unexpected error: {ex.Message}");
}
Console.WriteLine();
Console.WriteLine("Press Enter to return to the menu...");
Console.ReadLine();
}
ExampleHelper.DisposeProvider();