TCNOco / TcNo-Acc-Switcher

A Super-fast account switcher for Steam, Battle.net, Epic Games, Origin, Riot, Ubisoft and many others!
GNU General Public License v3.0
1.79k stars 120 forks source link

Some Errors I Found #167

Closed yofukashino closed 2 years ago

yofukashino commented 2 years ago
  1. First:

    Riot Cookies Location have been changed from "C:\Users\Administrator\AppData\Local\Riot Games\Riot Client\Cookies\Cookies" to "C:\Users\Administrator\AppData\Local\Riot Games\Riot Client\Data\Cookies\Cookies". so Please change it.

  2. Second

When I am am trying to Add Genshin to platforms, Its giving me errors. The error Logs are:

02/17/2022 08:03:14 (2022-02-16_01) UNHANDLED CRASH: System.IO.DirectoryNotFoundException: C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Server\wwwroot\
   at TcNo_Acc_Switcher_Client.MainWindow.RunServer() in C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Client\MainWindow.xaml.cs:line 81
   at System.Threading.Thread.StartHelper.Callback(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Thread.StartCallback()

and the code i added to platforms file is:

"Genshin Impact": {
      "Identifiers": [ "gi", "genshin", "genshinimpact" ],
      "ExeLocationDefault": "A:\MiHoYo\Genshin Impact\Genshin Impact game\GenshinImpact.exe",
      "ExesToEnd": [ "GenshinImpact.exe"],
      "PathListToClear": [ "SAME_AS_LOGIN_FILES" ],
      "LoginFiles": {
        "A:\\MiHoYo\\Genshin Impact\\Genshin Impact game\\GenshinImpact_Data\\webCaches\\Cookies": "webCaches\\Cookies",
        "A:\\MiHoYo\\Genshin Impact\\Genshin Impact game\\GenshinImpact_Data\\webCaches\\Cache\\index": "Cache\\index",
        "A:\\MiHoYo\\Genshin Impact\\Genshin Impact game\\GenshinImpact_Data\\webCaches\\Cache\\data_*": "Cache\\",
        "A:\\MiHoYo\\Genshin Impact\\Genshin Impact game\\GenshinImpact_Data\\webCaches\\Local Storage\\leveldb\\": "Local Storage\\leveldb\\",
        "A:\\MiHoYo\\Genshin Impact\\Genshin Impact game\\GenshinImpact_Data\\webCaches\\Code Cache\\js\\index-dir":"Code Cache\\js\\index-dir"
        "A:\\MiHoYo\\Genshin Impact\\Genshin Impact game\\GenshinImpact_Data\\webCaches\\GPUCache\\index": "GPUCache\\index",
        "A:\\MiHoYo\\Genshin Impact\\Genshin Impact game\\GenshinImpact_Data\\webCaches\\blob_storage": "blob_storage\\",
        "A:\\MiHoYo\\Genshin Impact\\Genshin Impact game\\GenshinImpact_Data\\TcNoAccSwitcher-ID.instance": "TcNoAccSwitcher-ID.instance"
      },
      "ExitBeforeInteract": true,
      "UniqueIdFile": "A:\\MiHoYo\\Genshin Impact\\Genshin Impact game\\GenshinImpact_Data\\TcNoAccSwitcher-ID.instance",
      "UniqueIdMethod": "CREATE_ID_FILE"
    }

What am I Doing wrong?

TCNOco commented 2 years ago

Thanks for the first, I'll have that updated today. The error seems unrelated to the platform code, which looks good. I'll install Genshin in a bit to test it out myself. Good job with this ^. Will get to adding assuming it works.

The %AppData%\TcNo Account Switcher\wwwroot folder seems to not have been copied for you. Check if it is there, or not. It contains all the front-end files for the program, including images etc. Go to the install folder (where the .exes are) and copy the originalwwwroot to %AppData%\TcNo Account Switcher\originalwwwroot, then rename it to just wwwroot. This should restore functionality.

yofukashino commented 2 years ago

The %AppData%\TcNo Account Switcher\wwwroot folder seems to not have been copied for you. Check if it is there, or not. It contains all the front-end files for the program, including images etc. Go to the install folder (where the .exes are) and copy the originalwwwroot to %AppData%\TcNo Account Switcher\originalwwwroot, then rename it to just wwwroot. This should restore functionality.

Well, the Folder is here but the path your program is checking for is wrong, fix it. you have set the path to "C:\Users\Appdata\Roaming\TcNo Account Switcher\wwwroot".

TCNOco commented 2 years ago

I highly doubt that. Where do you see this value? %AppData% is an environment variable so the username is automatically added, and expands to C:\Users\<username>\AppData\Roaming.

EDIT: On second look, the error doesn't point to anything to do with folders in the code (even though it does say DirectoryNotFoundException)... I can not figure out what is causing this. If you remove the platform you added, does it go back to normal? (Rename the platforms.json file to regenerate the original)

yofukashino commented 2 years ago

I highly doubt that. Where do you see this value? %AppData% is an environment variable so the username is automatically added, and expands to C:\Users\<username>\AppData\Roaming.

EDIT: On second look, the error doesn't point to anything to do with folders in the code (even though it does say DirectoryNotFoundException)... I can not figure out what is causing this. If you remove the platform you added, does it go back to normal? (Rename the platforms.json file to regenerate the original)

ik what is causing this and it is that check the first line of error it is 02/17/2022 08:09:24 (2022-02-16_01) UNHANDLED CRASH: System.IO.DirectoryNotFoundException: C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Server\wwwroot\ clearly saying here that its looking for TCNO folder under users and documents in it, you should change it to appdata. Sir you just messed up while writing it ig

TCNOco commented 2 years ago

Yeah, I see that, but I don't have it referenced ANYWHERE in my code:

image

as well as with an unescaped line here, only referenced for signing the .exes when I build them

image

I see the error you're getting but I can't recreate this. It doesn't make sense to me at all. The error, broken down is here:

I have no idea why it's looking for this folder when it's not referenced anywhere that I can find it. Over the 50k downloads and 500+ daily users you're the only one experiencing this, which is odd...

Back up the Platforms.json file you edited, delete the entire %AppData%\TcNo Account Switcher folder, as well as the folder it was installed to, and download a fresh copy. I can only think that either a folder is missing from the installed program files directory, or something else is afoot.


EDIT: This being said, I've added your code to the Platforms.json file, and it pops up just fine. I'll be downloading and installing Genshin later to test and work on it:

image

yofukashino commented 2 years ago

nice

yofukashino commented 2 years ago

let me reinstall it and update the issue

yofukashino commented 2 years ago

no it didnt work, yeah and this is the error it is showing when i open the app itself. image

yofukashino commented 2 years ago

yeah buddy as for your commit, the genhin folder would be "%Platform_Folder%\Genshin Impact game\GenshinImpact_Data\webCaches" not "%Platform_Folder%\GenshinImpact_Data\webCaches"

yofukashino commented 2 years ago

well about the genshin I found out those folders mean nothing but it's only this registry HKEY_CURRENT_USER\SOFTWARE\miHoYo\Genshin Impact. would tell you the keys later here in this issue only

TCNOco commented 2 years ago

Yes, I'm launching the game directly, so it's not starting the launcher as they can be installed in 2 different places.

I haven't yet got a handler for exporting an entire key from the registry with all the subkeys, but doing it manually, yes, it seems everything required is in that registry folder.

With that being said the folder location isn't so important now if everything is in the registry, so I'll swap it out for the launcher exe now.


For a fix:

Go to the install folder (where the .exes are) and copy the originalwwwroot to %AppData%\TcNo Account Switcher\originalwwwroot, then rename it to just wwwroot. This should restore functionality.

yofukashino commented 2 years ago
"Genshin Impact": {
      "Identifiers": [ "gi", "genshin", "genshinimpact" ],
      "ExeLocationDefault": "%Platform_Folder%\Genshin Impact game\GenshinImpact.exe",
      "ExesToEnd": [ "GenshinImpact.exe"],
      "PathListToClear": [ "SAME_AS_LOGIN_FILES" ],
      "LoginFiles": {        
        "REG:HKCU\\Software\\miHoYo\\Genshin Impact:MIHOYOSDK_ADL_PROD_OVERSEA_h1158948810": "UNIQUE_ID"
      },
      "ExitBeforeInteract": true,
      "UniqueIdFile": "HKCU\\SOFTWARE\\miHoYo\\Genshin Impact:MIHOYOSDK_ADL_PROD_OVERSEA_h1158948810",
      "UniqueIdMethod": "REGKEY"
    }

the things that matter is here edit: I actually checked the reg and this is the only registry key that matters. because I have it exported and merging it changes my account.

TCNOco commented 2 years ago

Awesome, good to know it's the same for you. I assumed that h1158948810 was different for everyone, and hence copying the entire registry key with all its subkeys would be better.

I do hope we can figure out what the issue with it not launching is...

yofukashino commented 2 years ago

Awesome, good to know it's the same for you. I assumed that h1158948810 was different for everyone, and hence copying the entire registry key with all its subkeys would be better.

check it on your pc if it is different for everyone then just make it wildcard in name

yofukashino commented 2 years ago

Awesome, good to know it's the same for you. I assumed that h1158948810 was different for everyone, and hence copying the entire registry key with all its subkeys would be better.

I do hope we can figure out what the issue with it not launching is...

well did you installed the whole game like from the launcher?

TCNOco commented 2 years ago

Sorry, I meant your account switcher not launching.

The name isn't hardcoded as I expected anywhere, which is the issue... Here is a screenshot of a freshly installed (latest release) version working with the WDAGUtilityAccount username on the system. The name isn't hardcoded anywhere.

image

For a fix:

  • Try running the account switcher as Admin?

Go to the install folder (where the .exes are) and copy the originalwwwroot to %AppData%\TcNo Account Switcher\originalwwwroot, then rename it to just wwwroot. This should restore functionality.

  • Does doing this not help? Does the folder exist?
  • If you hit Ctrl+Shift+I and go to the Console tab, is there error text? That would be a lot of help.
  • Do earlier versions of the program work while the latest doesn't?
  • And finally, you haven't moved the user data using the setting in-app, have you?

Did any of these fixes work?

yofukashino commented 2 years ago

For a fix:

  • Try running the account switcher as Admin?

Go to the install folder (where the .exes are) and copy the originalwwwroot to %AppData%\TcNo Account Switcher\originalwwwroot, then rename it to just wwwroot. This should restore functionality.

  • Does doing this not help? Does the folder exist?
  • If you hit Ctrl+Shift+I and go to the Console tab, is there error text? That would be a lot of help.
  • Do earlier versions of the program work while the latest doesn't?
  • And finally, you haven't moved the user data using the setting in-app, have you? I did a fresh install on a Windows 11 and Windows 10 virtual machine where I can't get the same issue...

Am already an admin, and did try it manually too, the folder exists and I did it nothing changed. and there is nothing in the console in developer mode, already tried it before, didn't use earlier versions yet. and no I haven't changed user data in-app.

TCNOco commented 2 years ago

Very odd... The exception it's throwing says the error, and then the place where the error is being thrown manually, rather than the actual error location itself. I need to quickly improve how the error is handled to get more accurate information of what's going on here... Give me a few.

yofukashino commented 2 years ago

Very odd... The exception it's throwing says the error, and then the place where the error is being thrown manually, rather than the actual error location itself. I need to quickly improve how the error is handled to get more accurate information of what's going on here... Give me a few.

funny

yofukashino commented 2 years ago

image This is the actual error am getting, and when i set it to developer, it gives me the error in log file

TCNOco commented 2 years ago

Never mind, I was able to recreate this issue exactly.

  1. Pause the program right before the server is started, here
  2. Delete or rename the %AppData%\TcNo Account Switcher\wwwroot folder to make it inaccessible.
  3. System.IO.DirectoryNotFoundException: 'C:\Users\TCNO\AppData\Roaming\TcNo Account Switcher\wwwroot\' is thrown, as you have, and this is the part of the code that shows as an error: here

The working directory is being set to Globals.UserDataFolder, which is in my case: C:\Users\TCNO\AppData\Roaming\TcNo Account Switcher\. Why yours is set to this makes no sense.

This is defined in code here. If your install folder (where TcNo-Acc-Switcher.exe is) contains userdata_path.txt it will use the path inside (By default this file does not exist), or, it uses %AppData%\\TcNo Account Switcher.


If you do not have this file in your install folder, then I'm completely clueless as to why it's looking for this folder as it's not hardcoded anywhere.

yofukashino commented 2 years ago

image there is no file like tha here

TCNOco commented 2 years ago

The only place I can find it referenced with the distributed program is in the first line of TcNo-Acc-Switcher-Server.staticwebassets.runtime.json, which is generated on the build. Why it isn't being programmatically set on your computer I have no idea...

The program runs fine with that file deleted. Try delete it and run the program to see if you get a different result. (It's in the install folder)

yofukashino commented 2 years ago

image still this