Skip to content

Commit

Permalink
[HaCreator] Initialization -- re-check if the old path actually exist…
Browse files Browse the repository at this point in the history
… before adding it to the combobox (QOL)
  • Loading branch information
lastbattle committed Dec 20, 2022
1 parent 6ce3f06 commit 11d6d51
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions HaCreator/GUI/Initialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using System.Drawing;
using HaSharedLibrary.Wz;
using MapleLib;
using System.Windows.Shapes;

namespace HaCreator.GUI
{
Expand Down Expand Up @@ -72,9 +73,9 @@ private void button_initialise_Click(object sender, EventArgs e)
MessageBox.Show("Please select the MapleStory folder.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!ApplicationSettings.MapleFolder.Contains(wzPath) && !IsPathCommon(wzPath))
if (!ApplicationSettings.MapleFoldersList.Contains(wzPath) && !IsPathCommon(wzPath))
{
ApplicationSettings.MapleFolder = ApplicationSettings.MapleFolder == "" ? wzPath : (ApplicationSettings.MapleFolder + "," + wzPath);
ApplicationSettings.MapleFoldersList = ApplicationSettings.MapleFoldersList == "" ? wzPath : (ApplicationSettings.MapleFoldersList + "," + wzPath);
}
WzMapleVersion fileVersion = (WzMapleVersion)versionBox.SelectedIndex;
if (InitializeWzFiles(wzPath, fileVersion))
Expand Down Expand Up @@ -275,14 +276,17 @@ private void Initialization_Load(object sender, EventArgs e)
versionBox.SelectedIndex = 0;
try
{
string[] paths = ApplicationSettings.MapleFolder.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
foreach (string x in paths)
string[] paths = ApplicationSettings.MapleFoldersList.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
foreach (string path in paths)
{
pathBox.Items.Add(x);
if (!Directory.Exists(path)) // check if the old path actually exist before adding it to the combobox
continue;

pathBox.Items.Add(path);
}
foreach (string path in WzFileManager.COMMON_MAPLESTORY_DIRECTORY)
foreach (string path in WzFileManager.COMMON_MAPLESTORY_DIRECTORY) // default path list
{
if (Directory.Exists(path))
if (Directory.Exists(path))
{
pathBox.Items.Add(path);
}
Expand Down
2 changes: 1 addition & 1 deletion HaCreator/WzSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static class UserSettings
public static class ApplicationSettings
{
public static int MapleVersionIndex = 3;
public static string MapleFolder = "";
public static string MapleFoldersList = ""; // list of maplestory folder seperated by ','
public static int MapleFolderIndex = 0;

public static ItemTypes theoreticalVisibleTypes = ItemTypes.All; // These two are marked theoretical because the visible\edited types in effect (Board.VisibleTypes\EditedTypes)
Expand Down

0 comments on commit 11d6d51

Please sign in to comment.