Skip to main content
GameDev.net gamedev.net
🔒 Locked

Replacing mscorlib in C#.

Started by Holy Fuzz Jun 24, 2004 at 3:22 PM 1 replies 1k views
Original Post
Holy Fuzz
Holy Fuzz
Here's the scoop: I'm considering writing an adventure game. Thus, it needs to read in a script of sorts from some sort of file and turn it into the logic of the game. This way I can write the engine seperately from the "story". Now, I was thinking, wouldn't it make sense to simply let the user write the script in C# (or VB.Net, whatever) (yes, I realize it wouldn't technically be a script then)? I could read the plain-text script file into my engine, compile it on-the-fly with the C# compiler built into the .Net framework, and then dynamically load the assembly into my engine. It would save a heck of a lot of time writing my own scripting language. The problem is, I don't really want the user to be able use all of the classes from mscorlib - they could screw around with the system and do much more than a mere "script" should be able to do. I realize that I can disable mscorlib, but I have to then supply my own versions of all the basic data types, in addition to whatever class/namespaces from mscorlib that I *DO* want the user to be able to access. So, my question is: Can I exclude mscorlib but still manually include the classes that I desire? Thanks for any help! - Fuzz
darrylsh
darrylsh
You could always just create a preprocessor that excludes the ones you don't want.

D
Anti-Sig: Do Not Read This Signature
Arild Fines
Arild Fines
.NET comes with a fairly extensive permissions system. I haven't looked into it much myself, but if you look in the documentation you'll see that a lot of the functionality requires special permissions in order to execute. For example, if you look at the docs for the constructor to the FileStream class, you'll see the following:


.NET Framework Security:

FileIOPermission for reading, writing, and appending to files. Associated enumerations: FileIOPermissionAccess.Read, FileIOPermissionAccess.Write, and FileIOPermissionAccess.Append.


Those are the permissions the code requires in order to execute that constructor. There are similar permissions on pretty much anything that interacts with the operating system.

You might also want to take a look at Terrarium. It is a distributed game in which programmers program their own creatures using a .NET language, which are compiled to assemblies and distributed to users all over the world. Obviously the creature code needs to be restricted from messing with the host system.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.