Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Check maple running
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholastay committed Apr 21, 2017
1 parent 9ed097d commit 36baacd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
15 changes: 13 additions & 2 deletions Xenon/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ public partial class MainWindow : Window
public MainWindow()
{
InitializeComponent();

checkIfMapleExists();
checkMapleProcess();

if (!String.IsNullOrEmpty(Properties.Settings.Default.username))
{
Expand All @@ -45,13 +46,23 @@ private void Window_Loaded(object sender, RoutedEventArgs e)

private void checkIfMapleExists()
{
if (!Nexon.Maple.GameExists())
if (!Nexon.Maple.GameExists)
{
MessageBox.Show("MapleStory.exe was not found. Are you sure you put Xenon into the MapleStory folder? Ensure it is NOT in the \"appdata\" folder that Nexon Launcher creates, but one step above that (by default it should be called \"maplestory\".", "Xenon", MessageBoxButton.OK, MessageBoxImage.Warning);
Close();
}
}

private void checkMapleProcess()
{
if (Nexon.Maple.GameRunning)
{
MessageBoxResult mbr = MessageBox.Show("MapleStory seems to be running on your computer. Please note that Xenon cannot be used to multi-client, and is rather only a launcher replacement! Continue anyway?", "Xenon", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (mbr == MessageBoxResult.No)
Close();
}
}

private void Button_Click(object sender, RoutedEventArgs e)
=> PerformLogin();

Expand Down
5 changes: 4 additions & 1 deletion Xenon/Nexon/Maple.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ static class Maple
{
public static string MaplePath = Path.Combine(Util.AppDirectory, "MapleStory.exe");

public static bool GameExists()
public static bool GameExists
=> File.Exists(MaplePath);

public static bool GameRunning
=> Process.GetProcessesByName("MapleStory").Length > 0;

private static string launchToken;

private static Regex remoteVerRegex = new Regex(@"pub(\d+)_(\d+)_(\d+)\.manifest");
Expand Down

0 comments on commit 36baacd

Please sign in to comment.