Skip to content

Commit

Permalink
[MapleLib] support for KMST exe ver
Browse files Browse the repository at this point in the history
  • Loading branch information
lastbattle committed Sep 20, 2021
1 parent c2b34eb commit 5535bf5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions MapleLib/WzLib/WzFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ private static short GetMapleStoryVerFromExe(string wzFilePath)
{
// https://github.com/lastbattle/Harepacker-resurrected/commit/63e2d72ac006f0a45fc324a2c33c23f0a4a988fa#r56759414
// <3 mechpaul
//System.Diagnostics.FileVersionInfo.FileVersion

const string MAPLESTORY_EXE_NAME = "MapleStory.exe";
const string MAPLESTORYT_EXE_NAME = "MapleStoryT.exe";

FileInfo wzFileInfo = new FileInfo(wzFilePath);
if (!wzFileInfo.Exists)
return 0;
Expand All @@ -341,9 +341,20 @@ private static short GetMapleStoryVerFromExe(string wzFilePath)
for (int i = 0; i < 5; i++) // just attempt 5 layers here
{
FileInfo[] msExeFileInfos = currentDirectory.GetFiles(MAPLESTORY_EXE_NAME, SearchOption.TopDirectoryOnly);
FileInfo[] msTExeFileInfos = currentDirectory.GetFiles(MAPLESTORYT_EXE_NAME, SearchOption.TopDirectoryOnly);

FileInfo msExeFileInfo = null;
if (msExeFileInfos.Length > 0 && msExeFileInfos[0].Exists)
{
FileInfo msExeFileInfo = msExeFileInfos[0];
msExeFileInfo = msExeFileInfos[0];
}
else if (msTExeFileInfos.Length > 0 && msTExeFileInfos[0].Exists)
{
msExeFileInfo = msTExeFileInfos[0];
}

if (msExeFileInfo != null)
{
var versionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(currentDirectory.FullName, msExeFileInfo.FullName));

var windowsVer = versionInfo.FileMajorPart;
Expand Down

2 comments on commit 5535bf5

@Lapig
Copy link
Contributor

@Lapig Lapig commented on 5535bf5 Sep 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the heck outta this branch up to this commit and didn't have any problems to speak of accross the process of importing eluna to kms 354
Maple_210922_145517

thank you for your service :salute:

@lastbattle
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;)

Please sign in to comment.