-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainGUI.cs
More file actions
678 lines (586 loc) · 20.5 KB
/
MainGUI.cs
File metadata and controls
678 lines (586 loc) · 20.5 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
// ============================================================================
// PROJECT: Synix Game Server Control Panel
// AUTHOR: Jason Turner (ubidzz)
// COPYRIGHT: © 2026 All Rights Reserved.
//
// LEGAL NOTICE:
// This source code is proprietary and confidential.
// 1. Permission is granted for PERSONAL, NON-COMMERCIAL use only.
// 2. You may modify this code for your own use, but you may NOT redistribute,
// rebrand, or sell this code or derivative works without written consent.
// 3. The "Synix" brand and logic remain the property of Jason Turner.
// ============================================================================
using Synix_Control_Panel.Design;
using Synix_Control_Panel.ServerHandler;
using Synix_Control_Panel.SteamCMDHandler;
using Synix_Control_Panel.SynixEngine;
using Synix_Control_Panel.FileFolderHandler;
using Synix_Control_Panel.UI;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows.Forms.DataVisualization.Charting;
using static Synix_Control_Panel.SynixEngine.Core;
namespace Synix_Control_Panel
{
public partial class MainGUI : Form
{
public static BindingList<GameServer> serverList = [];
private static System.Net.NetworkInformation.NetworkInterface[]? _activeInterfaces = null;
public bool isDownloadActive = false;
private static bool isInitializing = false;
public static MainGUI? Instance { get; private set; }
public double systemTotalRamGb = 128;
private int chartTickCounter = 0;
private const int maxGraphPoints = 60;
private static Font boldFont = new Font("Segoe UI", 9, FontStyle.Bold);
private static Font regularFont = new Font("Segoe UI", 9, FontStyle.Regular);
private bool isPrivacyLoading = false;
public MainGUI()
{
InitializeComponent();
Instance = this;
FileHandler.LoadServers();
_ = Core.Instance;
GridStyler.DarkTheme(dataGridView1);
UIStyleHelper.InitializeToggles(this);
dataGridView1.DataSource = serverList;
typeof(DataGridView).InvokeMember("DoubleBuffered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty, null, dataGridView1, new object[] { true });
GridStyler.ApplyTransparentTheme(dataGridView1);
Instance = this;
chkPrivacyMode.Text = "Privacy Mode";
chkPrivacyMode.Checked = Properties.Settings.Default.PrivacyMode;
isPrivacyLoading = chkPrivacyMode.Checked;
_ = LoadNetworkInfo();
_ = VersionCheck();
}
private void tmrResourceUpdates_Tick(object sender, EventArgs e)
{
CheckRunningStatus();
// 1. Grab telemetry
double cpu = Core.Instance.TotalCpuUsage;
double ram = Core.Instance.TotalRamUsageGb;
lblTotalCpu.Text = $"CPU: {cpu:N1}%";
lblTotalRam.Text = $"RAM: {ram:N2} GB / {systemTotalRamGb:N1} GB (Usable)";
if (chartHeartbeat.Series.FindByName("TotalCPU") == null)
Design.GridStyler.HeartbeatChart(chartHeartbeat, systemTotalRamGb);
// 2. Manually append the new data directly to the existing chart collection
chartHeartbeat.Series["TotalCPU"].Points.AddXY(chartTickCounter, cpu);
chartHeartbeat.Series["TotalRAM"].Points.AddXY(chartTickCounter, ram);
// 3. Remove the oldest points to keep the collection size stable and prevent managed memory growth
if (chartHeartbeat.Series["TotalCPU"].Points.Count > 30)
{
chartHeartbeat.Series["TotalCPU"].Points.RemoveAt(0);
chartHeartbeat.Series["TotalRAM"].Points.RemoveAt(0);
}
// 4. Scroll the view dynamically based on the actual points
var chartArea = chartHeartbeat.ChartAreas[0];
chartArea.AxisX.Minimum = chartHeartbeat.Series["TotalCPU"].Points.First().XValue;
chartArea.AxisX.Maximum = chartHeartbeat.Series["TotalCPU"].Points.Last().XValue;
// 5. Restart Check
bool needsTimeCheck = serverList.Any(s => s.IsScheduledRestartEnabled);
if (needsTimeCheck)
{
string currentExactTime = DateTime.Now.ToString("HH:mm:ss");
foreach (var server in serverList)
{
if (server.IsScheduledRestartEnabled && currentExactTime == (server.RestartTime + ":00"))
{
_ = Core.Instance.ExecuteStartSequence(server, "MAINTENANCE");
}
}
}
chartTickCounter++;
}
private void CheckRunningStatus()
{
string[] spinFrames = { "|", "/", "--", "\\" };
foreach (var server in serverList)
{
string status = server.Status ?? "";
if (status.StartsWith("Updating"))
{
string currentFrame = status.Replace("Updating ", "");
int currentIndex = Array.IndexOf(spinFrames, currentFrame);
int nextIndex = (currentIndex + 1) % spinFrames.Length;
server.Status = "Updating " + spinFrames[nextIndex];
}
else if (status.StartsWith("Validating"))
{
string currentFrame = status.Replace("Validating ", "");
int currentIndex = Array.IndexOf(spinFrames, currentFrame);
int nextIndex = (currentIndex + 1) % spinFrames.Length;
server.Status = "Validating " + spinFrames[nextIndex];
}
else if (status.StartsWith("Installing"))
{
string currentFrame = status.Replace("Installing ", "");
int currentIndex = Array.IndexOf(spinFrames, currentFrame);
int nextIndex = (currentIndex + 1) % spinFrames.Length;
server.Status = "Installing " + spinFrames[nextIndex];
}
else if (status.StartsWith("Backing Up"))
{
string currentFrame = status.Replace("Backing Up ", "");
int currentIndex = Array.IndexOf(spinFrames, currentFrame);
int nextIndex = (currentIndex + 1) % spinFrames.Length;
server.Status = "Backing Up " + spinFrames[nextIndex];
}
}
UpdateGrid();
}
private void StreamerModeCheck()
{
if (isPrivacyLoading)
{
AppendLog("[🛡️ BLOCK] Streamer mode is active", Color.Red);
return;
}
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
// Use the variable that Heartbeat_Tick has been updating
if (isDownloadActive || Core.Instance.isDownloadActive)
{
e.Cancel = true;
MessageBox.Show("Cannot close Synix while a server is installing, updating or Backing Up!",
"Operation in Progress", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
private async Task LoadNetworkInfo()
{
// 1. Get the LAN IP instantly
if (!isPrivacyLoading)
{
string localIP = await Core.Instance.GetLocalIP();
lblLocalIP1.Text = $"LAN IP: {localIP}";
// 2. Get the Public IP in the background
lblPublicIP.Text = "Public IP: Fetching...";
string publicIP = await Core.Instance.GetPublicIP();
lblPublicIP.Text = $"Public IP: {publicIP}";
}
}
private void lblPublicIP_Click(object sender, EventArgs e)
{
// Strip the prefix and copy just the IP
string ip = lblPublicIP.Text.Replace("Public IP: ", "");
if (ip != StatusManager.GetStatus(ServerState.Stopped) && ip != "Fetching...")
{
Clipboard.SetText(ip);
if (!isPrivacyLoading)
{
AppendLog($"[🚨 SYNIX] Public IP {ip} was copied to clipboard.", Color.Cyan);
}
else
{
AppendLog($"[🚨 SYNIX] Public IP [HIDDEN] was copied to clipboard.", Color.Cyan);
}
}
}
private void lblLocalIP_Click(object sender, EventArgs e)
{
string LANip = lblLocalIP1.Text.Replace("LAN IP: ", "");
Clipboard.SetText(LANip);
if (!isPrivacyLoading)
{
AppendLog($"[🚨 SYNIX] Local IP {LANip} was copied to clipboard.", Color.Cyan);
}
else
{
AppendLog($"[🚨 SYNIX] Local IP [HIDDEN] was copied to clipboard.", Color.Cyan);
}
}
public void AppendLog(string message, Color? textColor = null, bool isBold = false)
{
try
{
FileHandler.WriteLog("Synix_Log", $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] {message}{Environment.NewLine}");
}
catch { /* Silent fail */ }
if (!this.IsHandleCreated || this.IsDisposed) return;
if (rtbLog.InvokeRequired)
{
rtbLog.BeginInvoke(new Action(() => AppendLog(message, textColor, isBold)));
return;
}
string timeStamp = $"[{DateTime.Now:HH:mm:ss}] ";
rtbLog.SelectionStart = rtbLog.TextLength;
rtbLog.SelectionLength = 0;
rtbLog.SelectionColor = textColor ?? rtbLog.ForeColor;
if (rtbLog.Lines.Length > 500)
{
rtbLog.ReadOnly = false;
rtbLog.Select(0, rtbLog.GetFirstCharIndexFromLine(100));
rtbLog.SelectedText = "";
rtbLog.ClearUndo();
rtbLog.ReadOnly = true;
}
rtbLog.SelectionFont = isBold ? boldFont : regularFont;
rtbLog.AppendText(timeStamp + message + Environment.NewLine);
rtbLog.SelectionStart = rtbLog.Text.Length;
rtbLog.ScrollToCaret();
rtbLog.Update();
}
private async void MainGUI_Shown(object sender, EventArgs e)
{
Core.Instance.RebindProcesses();
double physicalRam = 16.0;
await Task.Run(() => physicalRam = MonitoringHandler.ResourceMonitor.GetTotalSystemRamGB());
double reserved = Math.Max(physicalRam * 0.10, 5.0);
systemTotalRamGb = physicalRam - reserved;
Design.GridStyler.HeartbeatChart(chartHeartbeat, systemTotalRamGb);
Design.GridStyler.DashboardLabels(lblTotalCpu, lblTotalRam);
chartHeartbeat.Series["TotalCPU"].Points.AddXY(chartTickCounter, 0);
chartHeartbeat.Series["TotalRAM"].Points.AddXY(chartTickCounter, 0);
chartHeartbeat.Update();
chartTickCounter++;
tmrResourceUpdates.Start();
await Task.Run(() => SteamCMD.EnsureSteamCMD((msg, color) => AppendLog(msg, color)));
}
public void UpdateGrid()
{
if (this.InvokeRequired)
{
this.BeginInvoke(new Action(UpdateGrid));
return;
}
// All the "Nuclear Refresh" and scroll logic is hidden in the helper
GridHelper.RefreshWithPersistence(dataGridView1, serverList);
}
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
// Let the GridStyler handle the colors
GridStyler.SetStatusColor(dataGridView1, e);
}
private void ResourceGraph_Click(object sender, EventArgs e)
{
// Pass the current list of servers to the new monitor window
ResourceMonitorGUI monitor = new ResourceMonitorGUI();
monitor.Show(); // .Show() lets them keep the panel open while using the main app
}
private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
// Just draw the rows using the solid colors from GridStyler
GridStyler.PaintTransparentRows(dataGridView1, e);
}
private GameServer? GetSelectedServer()
{
if (dataGridView1.CurrentRow == null)
{
AppendLog("[🚨 ERROR] No row is currently selected!", Color.Red);
MessageBox.Show("Please select a server in the list first.", "No Server Selected");
return null;
}
if (!(dataGridView1.CurrentRow.DataBoundItem is GameServer selectedServer))
{
AppendLog("[🚨 ERROR] Invalid GameServer object!", Color.Red);
return null;
}
if (dataGridView1.CurrentRow != null && dataGridView1.CurrentRow.DataBoundItem is GameServer server)
{
return server;
}
return null;
}
private async void btnAddServer_Click(object sender, EventArgs e)
{
// UI-specific check
if (isInitializing) return;
await Core.Instance.AddServerAndReport();
}
private void btnEdit_Click(object sender, EventArgs e)
{
if (isInitializing) return;
var selectedServer = GetSelectedServer();
if (!Core.Instance.PassSpamLock(selectedServer, out string lockMsg, "EditConfig"))
{
AppendLog(lockMsg, Color.Orange);
return;
}
Core.Instance.EditServerAndReport(selectedServer);
}
private async void btnUpdate_Click(object sender, EventArgs e)
{
if (isInitializing) return;
var selectedServer = GetSelectedServer();
if (!Core.Instance.PassSpamLock(selectedServer, out string lockMsg, "Update"))
{
AppendLog(lockMsg, Color.Orange);
return;
}
await Core.Instance.UpdateServerAndReport(selectedServer, "UPDATE");
}
private async void btnFileValidation_Click(object sender, EventArgs e)
{
if (isInitializing) return;
var selectedServer = GetSelectedServer();
if (!Core.Instance.PassSpamLock(selectedServer, out string lockMsg, "Validate"))
{
AppendLog(lockMsg, Color.Orange);
return;
}
await Core.Instance.UpdateServerAndReport(selectedServer, "VALIDATE");
}
private void btnDelete_Click(object sender, EventArgs e)
{
if (isInitializing) return;
var selectedServer = GetSelectedServer();
if (!Core.Instance.PassSpamLock(selectedServer, out string lockMsg, "Delete"))
{
AppendLog(lockMsg, Color.Orange);
return;
}
Core.Instance.DeleteServerAndReport(selectedServer);
dataGridView1.CurrentCell = null;
dataGridView1.DataSource = null;
dataGridView1.DataSource = serverList;
}
private async void btnBackup_Click(object sender, EventArgs e)
{
var selectedServer = GetSelectedServer();
if (!Core.Instance.PassSpamLock(selectedServer, out string lockMsg, "Backup"))
{
AppendLog(lockMsg, Color.Orange);
return;
}
await Task.Run(() =>
{
Core.Instance.ExecuteBackup(selectedServer, StartContext.Manual);
});
}
private async void btnStart_Click(object sender, EventArgs e)
{
var selectedServer = GetSelectedServer();
if (!Core.Instance.PassSpamLock(selectedServer, out string lockMsg, "Start"))
{
AppendLog(lockMsg, Color.Orange);
return;
}
await Core.Instance.ExecuteStartSequence(selectedServer);
}
private async void btnStop_Click(object sender, EventArgs e)
{
var selectedServer = GetSelectedServer();
if (!Core.Instance.PassSpamLock(selectedServer, out string lockMsg, "Stop"))
{
AppendLog(lockMsg, Color.Orange);
return;
}
await Core.Instance.StopServerAndReport(selectedServer);
}
private void btnOpenConfig_Click(object sender, EventArgs e)
{
StreamerModeCheck();
if (isPrivacyLoading) return;
var selectedServer = GetSelectedServer();
if (!Core.Instance.PassSpamLock(selectedServer, out string lockMsg, "Config"))
{
AppendLog(lockMsg, Color.Orange);
return;
}
Core.Instance.OpenConfigEditor(selectedServer);
}
private void btnOpenFolder_Click(object sender, EventArgs e)
{
var selectedServer = GetSelectedServer();
Core.Instance.OpenServerFolder(selectedServer);
}
private void btnOpenBackup_Click(object sender, EventArgs e)
{
var selectedServer = GetSelectedServer();
Core.Instance.OpenBackFolder(selectedServer);
}
private async void btnPublicConnection_Click(object sender, EventArgs e)
{
var selectedServer = GetSelectedServer();
AppendLog($"[📡 NETWORK] Testing WAN Connectivity for {selectedServer.ServerName}...", Color.White);
try
{
string publicIp = await Core.Instance.GetPublicIP();
bool isResponding = await Core.Instance.TestServerConnectivity(publicIp, selectedServer.QueryPort);
string ipText = "[HIDDEN]";
if (!isPrivacyLoading)
{
ipText = publicIp;
}
if (isResponding)
{
AppendLog($"[🌐 ONLINE] {selectedServer.ServerName} is visible at {ipText}:{selectedServer.QueryPort}!", Color.Green);
}
else
{
AppendLog($"[🛡️ BLOCK] {selectedServer.ServerName} is running but HIDDEN. Check Router/Firewall for UDP {selectedServer.QueryPort} or try setting a different query port.", Color.Red);
}
}
catch (Exception ex)
{
AppendLog($"[🚨 ERROR] Could not retrieve Public IP: {ex.Message}", Color.Yellow);
}
}
private async void btnLocalConnection_Click(object sender, EventArgs e)
{
var selectedServer = GetSelectedServer();
AppendLog($"[📡 NETWORK] Testing LAN Connectivity for {selectedServer.ServerName}...", Color.White);
try
{
string localIp = await Core.Instance.GetLocalIP();
bool isResponding = await Core.Instance.TestServerConnectivity(localIp, selectedServer.QueryPort);
string ipText = "[HIDDEN]";
if (!isPrivacyLoading)
{
ipText = localIp;
}
if (isResponding)
{
AppendLog($"[🌐 ONLINE] {selectedServer.ServerName} is visible at {ipText}:{selectedServer.QueryPort}!", Color.Green);
}
else
{
AppendLog($"[🛡️ BLOCK] {selectedServer.ServerName} is running but HIDDEN. Check Router/Firewall for UDP {selectedServer.QueryPort} or try setting a different query port.", Color.Red);
}
}
catch (Exception ex)
{
AppendLog($"[🚨 ERROR] Could not retrieve Public IP: {ex.Message}", Color.Yellow);
}
}
private void btnServerActionsMenu_Click(object sender, EventArgs e)
{
contextMenuStrip.Show(btnServerActions, new System.Drawing.Point(0, 0), ToolStripDropDownDirection.AboveRight);
}
private async void btnRestart_Click(object sender, EventArgs e)
{
var selectedServer = GetSelectedServer();
if (!Core.Instance.PassSpamLock(selectedServer, out string lockMsg, "Restart"))
{
AppendLog(lockMsg, Color.Orange);
return;
}
await Core.Instance.ExecuteStartSequence(selectedServer, "RESTART");
}
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0)
{
var selectedServer = GetSelectedServer();
Help.ServerInfo infoForm = new Help.ServerInfo(selectedServer);
infoForm.Show();
}
}
private void btnHelp_Click(object sender, EventArgs e)
{
using (Synix_Control_Panel.SynixEngine.HelpGUI helpWindow = new Synix_Control_Panel.SynixEngine.HelpGUI())
{
helpWindow.ShowDialog();
}
}
private async Task VersionCheck()
{
string currentVersion = "Unknown";
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
string[] resourceNames = assembly.GetManifestResourceNames();
string actualResourcePath = null;
foreach (string name in resourceNames)
{
if (name.EndsWith("version.txt"))
{
actualResourcePath = name;
break;
}
}
if (actualResourcePath != null)
{
using (Stream stream = assembly.GetManifestResourceStream(actualResourcePath))
{
if (stream != null)
{
using (StreamReader reader = new StreamReader(stream))
{
currentVersion = reader.ReadToEnd().Trim();
}
}
}
}
string versionUrl = "https://raw.githubusercontent.com/ubidzz/Synix-Control-Panel/refs/heads/master/SynixEngine/version.txt";
btnDownloadUpdate.Visible = false;
UIStyleHelper.StyleWarningLabel(lblUpdateStatus, "MiddleLeft");
lblUpdateStatus.Text = "Checking for updates...";
try
{
using (HttpClient client = new())
{
client.Timeout = TimeSpan.FromSeconds(5);
string latestVersion = (await client.GetStringAsync(versionUrl)).Trim();
if (latestVersion == currentVersion)
{
lblUpdateStatus.Text = "You are running the latest version " + currentVersion;
lblUpdateStatus.ForeColor = Color.Black;
lblUpdateStatus.TextAlign = ContentAlignment.MiddleRight;
lblUpdateStatus.BackColor = Color.Green;
}
else
{
lblUpdateStatus.Text = "A newer Synix " + latestVersion + " version is available! Running Version: " + currentVersion + "";
lblUpdateStatus.ForeColor = Color.White;
lblUpdateStatus.TextAlign = ContentAlignment.MiddleRight;
lblUpdateStatus.BackColor = Color.Red;
btnDownloadUpdate.Visible = true;
btnDownloadUpdate.Text = "Download from GitHub";
}
}
}
catch
{
lblUpdateStatus.Text = "[🚨 ERROR] Could not check for updates.";
lblUpdateStatus.ForeColor = Color.Black;
lblUpdateStatus.TextAlign = ContentAlignment.MiddleRight;
lblUpdateStatus.BackColor = Color.Red;
}
}
private void btnDownloadUpdate_Click(object sender, EventArgs e)
{
try
{
string url = "https://github.com/ubidzz/Synix-Control-Panel/releases";
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = url,
UseShellExecute = true
};
Process.Start(psi);
}
catch (Exception ex)
{
AppendLog($"[🚨 ERROR] Could not open browser: {ex.Message}", Color.Red);
}
}
private async void chkPrivacyMode_CheckedChanged(object sender, EventArgs e)
{
isPrivacyLoading = chkPrivacyMode.Checked;
Properties.Settings.Default.PrivacyMode = chkPrivacyMode.Checked;
Properties.Settings.Default.Save();
if (chkPrivacyMode.Checked)
{
lblPublicIP.Text = "Public IP: [HIDDEN]";
lblLocalIP1.Text = "LAN IP: [HIDDEN]";
}
await LoadNetworkInfo();
}
private void btnExportBatch_Click(object sender, EventArgs e)
{
if (isInitializing) return;
var selectedServer = GetSelectedServer();
if (selectedServer == null) return;
if (!Core.Instance.PassSpamLock(selectedServer, out string lockMsg, "Export"))
{
AppendLog(lockMsg, Color.Orange);
return;
}
bool success = Core.Instance.ExportServerToBatch(selectedServer);
if (success)
{
MessageBox.Show($"Batch file generated successfully!\n\nSaved directly to:\n{selectedServer.InstallPath}",
"Export Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}