proletariatgames / CUDLR

⛔️ [DEPRECATED] Console for Unity Debugging and Logging Remotely

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

handling very long parameters

tenpn opened this issue · comments

I'm still using this in all our spryfox projects. QA love it!

I tried making a command that took a dump of our save file and sent it to the game. However this save file is longish (about 1.7k), and between the html console and reaching my CUDLR.Command(), the string gets truncated. I've tried digging around both in the javascript and the C# server, looking for some constant that truncated input, but to no avail.

Any ideas what could be causing this, and if so, any ideas on a workaround?

No, wait, ignore me.

I was sending json, and it wasn't escaped. If I encode my parameter with Uri.EncodeDataString then the command gets it fine.

Would be great to do this automatically.

...fwiw for others, here's the full command I used to dump json in a cudlr-friendly format:

Uri.EscapeDataString(Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(json)));

Just escaping the data string seemed to lose spaces from DateTime strings, making them unparsable.

That gives you an alphanumeric mess that will go through cudlr. In your command you decode with:

System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(string.Join("", cmdParams)));

...where cmdParams is the string[] passed into the command. You don't need Uri.UnescapeDataString because that's done for you.

I'd really like to add a generic 'upload' facility to CUDLR. We want to do something similar in our game to upload large binary player state to the server.

Currently the server does not accept POST requests - It will be useful to have it and have a way to upload files.