Case Insensitive

Dec 3, 2009 at 5:53 PM

We used the old Microsoft COM-Based JScript in the current version of our system. Our libraries were developed in VB6 and there is a lot os scripts running in it. Our system allows users to utilize lots of different COM objects inside the script, setting properties, calling methods, etc.

We are migrating our libraries to VB.NET, because we need our system to run as 64 bit processes. We tried to migrate from the old COM-Based Jscript engine to JScript.NET, but we stuck on one big problem: we couldn't guarantee 100% compatibility with the old scripting system.

Thats because the old engine allows methods and properties to be used in a case insensitive way (object.THIS() == object.this()). Then we have a real lot of scripts scattered around customers servers that use scripts where the methods are called without the care for the case of the method name.

We are looking for a way of using JavaScript in our new library where all the methods or properties would be called in a case insensitive way. This way the old scripts will work in the new library version.

I was wondering if using the Jint project and changing the CachedMethodInvoker is the best way to acchieve this. Ex:

_Cache[type].Add(key, methodInfo = type.GetMethod(method, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static, null, types, null));

Any suggestion?

Dec 4, 2009 at 2:24 PM

For this you have to change the clas you cite, but also the two other classes like this one for properties. Then you also need to change the JsDictionaryObject to use lower or uppercase indexes of properties. And maybe the "this" and "null" constants where they are used.

Give it a try, but be careful because I'm changing many things currently, you could have to change it again sooner or later. A good solution would be to create a private branch from our public svn repository.