Kiki79250CoC / SMWMTL

SMWMTL is a small program to simplify Super Mario World hacks by regrouping all useful tools to one. Instead to search in your bunch of folders to find the tool's executable, link it's location in SMWMTL will help you by launching it in just one click.
https://kiki79250.wixsite.com/smwmtl
0 stars 0 forks source link

SMWCentral comments bug report • Unable to start SMWMTL due to date format conflict (DD/MM/YYYY) #3

Closed Kiki79250CoC closed 2 years ago

Kiki79250CoC commented 2 years ago

Bug reported by Captain3 on SMWCentral in the comment section of SMWMTL's page


Description of the bug you encounter :

When you attempt to start SMWMTL on system that does not use date in the "DD/MM/YYYY" format, it displays an error and won't start.

Expected behavior from the application (without this bug) :

SMWMTL will just start as usual.

Error message content :

An error occurred creating the form. See Exception.InnerException for details. The error is: Conversion from string "15/05/2022" to type 'Date' is not valid.

Steps to reproduce this bug :

Just start SMWMTL, the error will pop-out itself.

Version(s) of SMWMTL you noticed the presence of the bug:

Operating System :

(Optional) Screenshots or other media :

None.

Kiki79250CoC commented 2 years ago

Bug fixed upon version 2.22 - Fixes applied in code with commit 3ac6dc4


Affected versions (according to bug report) :

Technical explainations of the bug :

Starting SMWMTL 2.10, compilation date is splitted in 3 separate values.

In these 3 versions of SMWMTL, the date retrieve code is the following :

' Software Compilation date
ReadOnly CompileDate As Date = $"{My.Resources.BUILD_DATE_DAY}/{My.Resources.BUILD_DATE_MONTH}/{My.Resources.BUILD_DATE_YEAR}"

This code have a very rudimentary functioning, as it only just request for the 3 values and put a / between them. The main problem I haven't noticed is that I thought this value will adapt itself to the format the user's system uses, but as you noticed, it isn't and created this buh that prevent to launch SMWMTL in system that does not currently using the DD/MM/YYYY to display date (like in the US, which uses MM/DD/YYYY).

And those changes was the reason of this crash bug, because your system understands the "15/05" as the 5th day of the 15th months, and obviously there's no 15 months in a year.

And it's this stupid error that creates this beautiful piece of modern art.

image

To fix this bug I simply changed the method for create this variable by using DateTime instead of Date

' Software Compilation date
ReadOnly CompileDate As New DateTime(My.Resources.BUILD_DATE_YEAR, My.Resources.BUILD_DATE_MONTH, My.Resources.BUILD_DATE_DAY)

This method is literally the same, it retrieves the same three values and make a date, except this time it will adapt the format to the one used by the end user's Operating System and the program can now launches as expected.

image