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

Can electron cgi work with an already built and obfuscated C# executable? #15

Closed
mxswat opened this issue Jun 22, 2020 · 10 comments
Closed

Comments

@mxswat
Copy link

mxswat commented Jun 22, 2020

Hello, I'm working with a friend on making a modding tool for games.

My friend makes the entire pointer system and game modding code in C# and I need to take care of the UI;

I want to make clear that both the c# .exe and electron will run on the same machine and I cannot just add the C# project source to the electron project because It needs to be closed source and obfuscated to avoid misuse of our code.
So, can electron-cgi work with an already built and obfuscated C# executable?

@ruidfigueiredo
Copy link
Owner

Hi @mxswat

If you can make a C# console application that uses the C# code you already have, then yes, and that can be obfuscated too, really doesn't matter.

@mxswat
Copy link
Author

mxswat commented Jun 22, 2020

Hi @ruidfigueiredo Thanks for the quick answer I have another question
this means that I can just do
const connection = new ConnectionBuilder() .connectTo('dotnet', 'run','Editor.exe')
Without having to load the project?

@ruidfigueiredo
Copy link
Owner

ruidfigueiredo commented Jun 22, 2020

@mxswat Actually, less than that:

const connection = new ConnectionBuilder() .connectTo('Editor.exe')

Don't really know what you mean by loading the project. The thing is, Editor must be be using with the ElectronCgi.DotNet nuget package and have the appropriate configuration for receiving the type of requests you need from node

@mxswat
Copy link
Author

mxswat commented Jun 22, 2020

Oh, this is amazing, also is there any docs for the entire electron-cgi project?

@ruidfigueiredo
Copy link
Owner

Hi @mxswat thanks!

There are a few blog posts:

https://www.blinkingcaret.com/2020/03/25/electroncgi-1-0-cross-platform-guis-for-net-core/

https://www.blinkingcaret.com/2019/11/27/electroncgi-a-solution-to-cross-platform-guis-for-net-core/

And there are a few examples apps, the latest one I built was this: https://github.com/ruidfigueiredo/MemorizeADeck

There's also a podcast episode about ElectronCgi if you are interested in the story behind it: https://www.automator.show/18

@mxswat
Copy link
Author

mxswat commented Jun 22, 2020

@ruidfigueiredo thank you so much for the time you are using to help me

@mxswat
Copy link
Author

mxswat commented Jun 22, 2020

I was able to make electron cgi launch the .exe

When I added connection.Send("greetingx", "hello from c#"); on the C# file
and on the the .ts file i added the on
connection.on('greetingx', (request) => { console.log(request); });
But I got this error

image

What can be the cause of the problem?

@ruidfigueiredo
Copy link
Owner

"Hello World from MessageService!" that was written to the stdout stream (there's a Console.WriteLine with that somewhere in C#).

ElectronCGI uses the stdout and stdin streams to build a communication channel between the two processes, if you write to those yourself you'll get those errors.

@mxswat
Copy link
Author

mxswat commented Jun 22, 2020

So, I went in Debug inside the file tab-separated-input-stream-parser.js and I noticed it just now!

My brain completely ignored "Hello World from MessageService!"
This is what happens when I keep coding at 2AM lol

I guess I should attach a custom console to have console logs in the C# project, not a big deal

@mxswat
Copy link
Author

mxswat commented Jun 22, 2020

It works perfectly now

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