mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-13 15:34:36 +01:00
Validate if launcher/game path is correct
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Principal;
|
||||
@@ -24,6 +25,30 @@ public partial class MainView : UserControl
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Directory.Exists(txtGamePath.Text))
|
||||
{
|
||||
ShowWarningMsg("Game path folder does not exist", "Error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Directory.Exists(txtLauncherPath.Text))
|
||||
{
|
||||
ShowWarningMsg("Launcher folder does not exist", "Error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!File.Exists(Path.Combine(txtLauncherPath.Text, "nikke_launcher.exe")))
|
||||
{
|
||||
ShowWarningMsg("Launcher path is invalid. Make sure that nikke_launcher.exe exists in the launcher folder", "Error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!File.Exists(Path.Combine(txtGamePath.Text, "nikke.exe")))
|
||||
{
|
||||
ShowWarningMsg("Game path is invalid. Make sure that nikke.exe exists in the launcher folder", "Error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (CmbServerSelection.SelectedIndex == 1)
|
||||
{
|
||||
if (!IPAddress.TryParse(TxtIpAddress.Text, out _))
|
||||
@@ -34,6 +59,7 @@ public partial class MainView : UserControl
|
||||
}
|
||||
if (TxtIpAddress.Text == null) TxtIpAddress.Text = "";
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
ServerSwitcher.SaveCfg(CmbServerSelection.SelectedIndex == 0, txtGamePath.Text, txtLauncherPath.Text, TxtIpAddress.Text);
|
||||
|
||||
Reference in New Issue
Block a user