Skip to content

Commit

Permalink
[HaCreator] Fixed an issue detecting excluded directory and files whe…
Browse files Browse the repository at this point in the history
…n building the wz file list.
  • Loading branch information
lastbattle committed May 23, 2023
1 parent 43bce58 commit 709ce2a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions MapleLib/WzFileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
using System.Threading;
using System.Text.RegularExpressions;
using Microsoft.Xna.Framework;
using System.Diagnostics;

namespace MapleLib
{
public class WzFileManager : IDisposable
{
#region Constants
private static readonly string[] EXCLUDED_DIRECTORY_FROM_WZ_LIST = { "bak", "backup", "hshield", "blackcipher", "harepacker", "hacreator", "xml" };
private static readonly string[] EXCLUDED_DIRECTORY_FROM_WZ_LIST = { "bak", "backup", "original", "xml", "hshield", "blackcipher", "harepacker", "hacreator", "xml" };

public static readonly string[] COMMON_MAPLESTORY_DIRECTORY = new string[] {
@"C:\Nexon\MapleStory",
Expand Down Expand Up @@ -194,14 +195,14 @@ public void BuildWzFileList()

// Use Where() and Select() to filter and transform the directories
var directories = Directory.EnumerateDirectories(baseDir, "*", SearchOption.AllDirectories)
.Where(dir => !EXCLUDED_DIRECTORY_FROM_WZ_LIST.Any(x => x.ToLower() == new DirectoryInfo(Path.GetDirectoryName(dir)).Name.ToLower()));
.Where(dir => !EXCLUDED_DIRECTORY_FROM_WZ_LIST.Any(x => dir.ToLower().Contains(x)));

// Iterate over the filtered and transformed directories
foreach (string dir in directories)
{
//string folderName = new DirectoryInfo(Path.GetDirectoryName(dir)).Name.ToLower();
//Debug.WriteLine("----");
//Debug.WriteLine(dir);
string folderName = new DirectoryInfo(Path.GetDirectoryName(dir)).Name.ToLower();
Debug.WriteLine("----");
Debug.WriteLine(dir);

string[] iniFiles = Directory.GetFiles(dir, "*.ini");
if (iniFiles.Length <= 0 || iniFiles.Length > 1)
Expand Down Expand Up @@ -230,6 +231,9 @@ public void BuildWzFileList()

string wzDirectoryNameOfWzFile = dir.Replace(baseDir, "").ToLower();

if (EXCLUDED_DIRECTORY_FROM_WZ_LIST.Any(item => fileName2.ToLower().Contains(item)))
continue; // backup files

//Debug.WriteLine(partialWzFileName);
//Debug.WriteLine(wzDirectoryOfWzFile);

Expand Down

0 comments on commit 709ce2a

Please sign in to comment.