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

Add option to take Main from primary script file #68

Closed
rconde01 opened this issue Jun 15, 2017 · 5 comments
Closed

Add option to take Main from primary script file #68

rconde01 opened this issue Jun 15, 2017 · 5 comments

Comments

@rconde01
Copy link

Sometime in the last few versions you started detecting multiple Main methods and throwing an error one was detected. This broke our scripting system. We worked around it, but it might be nice to add an option which takes the Main from the primary script file instead of throwing an error.

@oleg-shilo
Copy link
Owner

You can use //css_import instead of //css_include. The difference - import renames "Main"

@rconde01
Copy link
Author

In my case I'm using newincludes in the precompiler....is there a newimports?

@oleg-shilo
Copy link
Owner

No there is none.

I changed your post into an "enhancement". To allow this feature in future but for now you will need to:

  • Manually change "Main" into "main" (or something similar) in your imported script
  • Save new content into a temp file
  • Add this temp file to the new includes.

@rconde01
Copy link
Author

Yeah - that's the approach I took.

oleg-shilo added a commit that referenced this issue Jun 17, 2017
- Script engine assembly (e.g. cscs.exe) has been exposed to the precompiler routines.
- Added ScriptParser.ProcessImportedScript to be used from precompilers.
@oleg-shilo
Copy link
Owner

Implemented. The script engine is now exposed to the precompiler and now it can use CS-Script API. And for the cases like yours I have added a new method to the ScriptParser class for importing the scripts:

var includes = (List<string>)context["NewIncludes"];
includes.Add(CSScriptLibrary.ScriptParser.ProcessImportedScript("<your script to import>"));

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

No branches or pull requests

2 participants