Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should Arguments be exempt from ContainsIllegalCharacters? #28

Open
edgar1016 opened this issue Mar 3, 2021 · 4 comments
Open

Should Arguments be exempt from ContainsIllegalCharacters? #28

edgar1016 opened this issue Mar 3, 2021 · 4 comments

Comments

@edgar1016
Copy link

edgar1016 commented Mar 3, 2021

I was testing adding none localized visual novels that require Japanese locale. I use the program locale emulator to run these games. Locale emulator allows for running the LEProc.exe with the argument -run "path-to-exe" to load Japanese games with a shortcut.

Currently using periods is considered invalid in the Arguments text box for example -run "C:\Users\edgar\Desktop\Kara no Shoujo - FULL VOICE HD SIZE EDITION\Launcher.exe" would be invalid because it has a period in Launcher.exe.

.Must(ContainsIllegalCharacters).WithMessage(App.ResMan.GetString("ValidationArgumentsIllegalChars"));

So I was wondering if maybe this line should be removed or maybe add some sort of integration where the LEProc.exe path is stored and the software can run it with the argument containing the game executable's path. This could be toggled on an individual basis like the Enable Custom Arguments toggle maybe it could be something like Use Locale Emulator. I also don't like the idea of just adding a period to

string allowableLetters = $@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890/\-_ !?;:'+={'"'}";

This line also keeps me from adding games with Japanese characters in its executable obviously. Also there's can't be more than once game added with the same executable path so adding game using LEProc.exe is a no go for now.

@micah686
Copy link
Owner

micah686 commented Mar 3, 2021

I was actually waiting for something like this, where I figure out what characters shouldn't be allowed. I'll work on editing the allowed characters. As for the LE path, I'm also planning to have it so that it will allow games with the same executable with different arguments.

@micah686
Copy link
Owner

micah686 commented Mar 4, 2021

Ok, this has been fixed in 3c5c7cd. I removed the check for duplicate exe files in the database, and removed the Illegal characters check for Arguments. I might add back in a check at a later point in time for one of these two functions to validate that the path is valid, but I'll wait on that.:
GetInvalidFileNameChars()
GetInvalidPathChars()

@edgar1016
Copy link
Author

Thanks much appreciated. I was messing with those too but I found that GetInvalidPathChars() doesn't allow for periods and GetInvalidFileNameChars() doesn't allow "/" I think. I have a solution in my head where we can keep the previous code and I could create a toggle that makes the play button run LEProc.exe and the argument would be something like "-run \"" + SelectedGame.ExePath + ""\";. I'm still learning C# I'm mostly familiar with Java but I'll work on this overtime as well.

@micah686
Copy link
Owner

micah686 commented Mar 7, 2021

My thought was to add back some of the old code, but make these changes:

  • Only allow the same exe file multiple times if the arguments are different.
  • Use the GetInvalid....Chars(), but then strip out certain characters. So we could keep things like '/', but strip out obviously bad unicode characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants