Skip to content

CSharpWasm support JS side#120

Merged
Oliver-Quail merged 19 commits intothoth-tech:mainfrom
daosgava:wasm-csharp-js
Jul 11, 2025
Merged

CSharpWasm support JS side#120
Oliver-Quail merged 19 commits intothoth-tech:mainfrom
daosgava:wasm-csharp-js

Conversation

@daosgava
Copy link
Contributor

Description

This PR is a follow up of the #106 pull request.

This change modifies Browser_IDE/CSharpWasm/main.js to read methods from splashKitMethods.generated.js, which is generated by the splashkit-translator as introduced in PR #24. It also includes CSharpWasm/SplashKitBindings.Generated.cs, likewise generated by the translator.

Process to replace generated files

  1. Generate SplashKit.Generated.cs and splashKitMethods.generated.js using the translator.
  2. Copy splashKitMethods.generated.js into Browser_IDE/CSharpWasm/.
  3. Copy SplashKit.Generated.cs into CSharpWasm/.
  4. Change directory to CSharpWasm/ and run ./buildAndCopy.sh.
  5. Change directory to Browser_IDE and run npm run server
Screenshot 2025-05-11 at 11 04 07 PM

Note: Files were already added to this PR.

@github-actions
Copy link

github-actions bot commented May 11, 2025

🐋 PR Preview!
Preview at https://thoth-tech.github.io/SplashkitOnline/pr-previews/120
for commit 1551b4c

Copy link
Collaborator

@Oliver-Quail Oliver-Quail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Daniel,
Firstly great commit. I've made some comments mainly regarding adding some more documentation and other minor tweaks. Then I'll be happy to approve.
Also can confirm that this works and runs on Linux :)


### Running the Build and Copy Script

To build the project and copy the necessary files into the `Browser_IDE/CSharpWasm` directory, run the following shell script:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is hard to tell what files I need to build the project, please can you add clarification for this step regarding the following:

  • What files do I need to copy?
  • Do I need any build tools (e.g. dotnet framework)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. You don’t need to copy the files manually here, as this process is automated by CSharpWasm/buildAndCopy.sh. See the command below.
./buildAndCopy.sh
  1. Regarding the build tools, you need to have .NET installed. You can find more information in the research findings document.

https://github.com/thoth-tech/SplashkitOnline/blob/main/Documentation/Research%20and%20Findings/splashkit-online-c-sharp-support-research.md

Note: We discussed in the last weekly meeting that all of these scripts and copy/paste steps will be added to a pipeline, so that everything is in place when the project is built.

Let me create a card to document all of this. 🙂

splashkit/
generated/
__pycache__/
_framework/ No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed when running the buildAndCopy.sh script.
It created files in Browser_IDE/CSharpWasm/bin
Is this supposed to be ignored two
Screenshot from 2025-05-16 10-01-40

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, those are the actual libraries that allow compiling C# in the browser :)

Comment on lines +9 to +10
"applicationUrl": "https://localhost:7281;http://localhost:5178",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to get some documentation on these two lines and how they relate to the execution of C#?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of the boilerplate generated with the project. This template allows running a server with the C# part, but we don’t actually use that feature since we’re only compiling and generating the .dll files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have time would it be possible to convert this to a python script so people who use windows can also install this. If there is no time please add a card to the planner board :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a great catch! I’ll add a card for it. 😊

Copy link
Contributor

@cameronhum cameronhum May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this need may need to be discussed whether its needed. I tested on windows and due to MSYS, it runs successfully. I believe people working with splashkit on windows will most definitely have this, however it may need confirmation further than my thoughts
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nice! Thank you for checking that out. Let me add it to the document I'm preparing. :)

Copy link
Collaborator

@Oliver-Quail Oliver-Quail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve this PR, good job Daniel

Copy link
Contributor

@cameronhum cameronhum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that one broken change I suggested. This is very easy to understand with the documentation you put together and I was able to use the build script and test easily. This code does its functionality and I will be happy to approve it once that small change is adjusted.


// Example 3: Print combination of explicit string and value of string variable
string hello = "Hello";
SplashKit.WriteLine(hello + " World!\nDon't forget spaces between words when printing to the terminal!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the \n causes syntax errors on first new project load as its interpreted to be a newline in the code editor rather than '\n'. it may need to be escaped somehow so that it does the intended task

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking into it :)

@daosgava daosgava requested a review from cameronhum May 25, 2025 13:58
Copy link
Contributor

@cameronhum cameronhum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only issue I had with the pull request has now been resolved and I am happy to approve this to go onto next review. Thank You!

@Oliver-Quail Oliver-Quail merged commit 66dec2f into thoth-tech:main Jul 11, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants

Comments