diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/ClientBin/SilverlightApplication1.xap b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/ClientBin/SilverlightApplication1.xap new file mode 100644 index 0000000..42cacc9 Binary files /dev/null and b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/ClientBin/SilverlightApplication1.xap differ diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Default.aspx b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Default.aspx new file mode 100644 index 0000000..2f0df39 --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Default.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SilverlightApplication1.Web._Default" %> + + + + + + + + +
+
+ +
+
+ + diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Default.aspx.cs b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Default.aspx.cs new file mode 100644 index 0000000..504f1f6 --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Default.aspx.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace SilverlightApplication1.Web +{ + public partial class _Default : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + } +} diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Default.aspx.designer.cs b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Default.aspx.designer.cs new file mode 100644 index 0000000..ec7f9fd --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Default.aspx.designer.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SilverlightApplication1.Web +{ + + + public partial class _Default + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + } +} diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Properties/AssemblyInfo.cs b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6876565 --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SilverlightApplication1.Web")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SilverlightApplication1.Web")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Silverlight.js b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Silverlight.js new file mode 100644 index 0000000..15e0409 --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Silverlight.js @@ -0,0 +1,2 @@ +//v2.0.30511.0 +if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.__onSilverlightInstalledCalled=false;Silverlight.fwlinkRoot="http://go2.microsoft.com/fwlink/?LinkID=";Silverlight.__installationEventFired=false;Silverlight.onGetSilverlight=null;Silverlight.onSilverlightInstalled=function(){window.location.reload(false)};Silverlight.isInstalled=function(b){if(b==undefined)b=null;var a=false,m=null;try{var i=null,j=false;if(window.ActiveXObject)try{i=new ActiveXObject("AgControl.AgControl");if(b===null)a=true;else if(i.IsVersionSupported(b))a=true;i=null}catch(l){j=true}else j=true;if(j){var k=navigator.plugins["Silverlight Plug-In"];if(k)if(b===null)a=true;else{var h=k.description;if(h==="1.0.30226.2")h="2.0.30226.2";var c=h.split(".");while(c.length>3)c.pop();while(c.length<4)c.push(0);var e=b.split(".");while(e.length>4)e.pop();var d,g,f=0;do{d=parseInt(e[f]);g=parseInt(c[f]);f++}while(f");delete a.id;delete a.width;delete a.height;for(var c in a)if(a[c])b.push('');b.push("");return b.join("")};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(b){var a="",d=Silverlight.fwlinkRoot,c=b.version;if(b.alt)a=b.alt;else{if(!c)c="";a="Get Microsoft Silverlight";a=a.replace("{1}",c);a=a.replace("{2}",d+"108181")}return a};Silverlight.getSilverlight=function(e){if(Silverlight.onGetSilverlight)Silverlight.onGetSilverlight();var b="",a=String(e).split(".");if(a.length>1){var c=parseInt(a[0]);if(isNaN(c)||c<2)b="1.0";else b=a[0]+"."+a[1]}var d="";if(b.match(/^\d+\056\d+$/))d="&v="+b;Silverlight.followFWLink("149156"+d)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b="";if(c==null)return null;for(var d=0;d96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+"&#"+a+";"}return b};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a="\nSilverlight error message \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+" \n";a+="Message: "+b.ErrorMessage+" \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+" \n";a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}a+="MethodName: "+b.methodName+" \n"}alert(a)};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a--)window["__slEvent"+a]=null;Silverlight._silverlightCount=0;if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};Silverlight.__getHandlerName=function(b){var a="";if(typeof b=="string")a=b;else if(typeof b=="function"){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var c=Silverlight._silverlightCount++;a="__slEvent"+c;window[a]=b}else a=null;return a};Silverlight.onRequiredVersionAvailable=function(){};Silverlight.onRestartRequired=function(){};Silverlight.onUpgradeRequired=function(){};Silverlight.onInstallRequired=function(){};Silverlight.IsVersionAvailableOnError=function(d,a){var b=false;try{if(a.ErrorCode==8001&&!Silverlight.__installationEventFired){Silverlight.onUpgradeRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==8002&&!Silverlight.__installationEventFired){Silverlight.onRestartRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==5014||a.ErrorCode==2106){if(Silverlight.__verifySilverlight2UpgradeSuccess(a.getHost()))b=true}else b=true}catch(c){}return b};Silverlight.IsVersionAvailableOnLoad=function(b){var a=false;try{if(Silverlight.__verifySilverlight2UpgradeSuccess(b.getHost()))a=true}catch(c){}return a};Silverlight.__verifySilverlight2UpgradeSuccess=function(d){var c=false,b="2.0.31005",a=null;try{if(d.IsVersionSupported(b+".99")){a=Silverlight.onRequiredVersionAvailable;c=true}else if(d.IsVersionSupported(b+".0"))a=Silverlight.onRestartRequired;else a=Silverlight.onUpgradeRequired;if(a&&!Silverlight.__installationEventFired){a();Silverlight.__installationEventFired=true}}catch(e){}return c} \ No newline at end of file diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1.Web.csproj b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1.Web.csproj new file mode 100644 index 0000000..4ee294a --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1.Web.csproj @@ -0,0 +1,105 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {66FC416D-ADB5-4479-B731-EA0260086BCA} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + SilverlightApplication1.Web + SilverlightApplication1.Web + v3.5 + {07C38CED-F1AC-4CA3-803F-22C22FD0AEF1}|..\SilverlightApplication1\SilverlightApplication1.csproj|ClientBin|False + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + + 3.5 + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + + + + + + ASPXCodeBehind + Default.aspx + + + Default.aspx + + + + + + + + + + + + + + False + True + 1063 + / + + + False + False + + + False + + + + + \ No newline at end of file diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1.Web.csproj.user b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1.Web.csproj.user new file mode 100644 index 0000000..80bce9c --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1.Web.csproj.user @@ -0,0 +1,35 @@ + + + + + + SilverlightApplication1TestPage.aspx + SpecificPage + True + True + False + False + RunFiles + + + False + True + + + + + + + + + False + True + False + + SilverlightApplication1.xap + + + + + + \ No newline at end of file diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1TestPage.aspx b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1TestPage.aspx new file mode 100644 index 0000000..40cc2ac --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1TestPage.aspx @@ -0,0 +1,74 @@ +<%@ Page Language="C#" AutoEventWireup="true" %> + + + + + SilverlightApplication1 + + + + + +
+
+ + + + + + + + Get Microsoft Silverlight + +
+
+ + diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1TestPage.html b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1TestPage.html new file mode 100644 index 0000000..2d40a0e --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/SilverlightApplication1TestPage.html @@ -0,0 +1,73 @@ + + + + + SilverlightApplication1 + + + + + +
+
+ + + + + + + + Get Microsoft Silverlight + +
+
+ + diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Web.config b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Web.config new file mode 100644 index 0000000..5ee1ccb --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1.Web/Web.config @@ -0,0 +1,107 @@ + + + + + +
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/App.xaml b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/App.xaml new file mode 100644 index 0000000..4b2ecc5 --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/App.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/App.xaml.cs b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/App.xaml.cs new file mode 100644 index 0000000..4db796b --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/App.xaml.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; +using System.Windows.Resources; +using System.IO; + +namespace SilverlightApplication1 +{ + public partial class App : Application + { + VbscriptHost _vbscript; + + public App() + { + this.Startup += this.Application_Startup; + this.Exit += this.Application_Exit; + this.UnhandledException += this.Application_UnhandledException; + + InitializeComponent(); + + _vbscript = new VbscriptHost(); + } + + public VbscriptHost VBScript + { + get { return _vbscript; } + } + + private void Application_Startup(object sender, StartupEventArgs e) + { + this.RootVisual = new MainPage(); + } + + private void Application_Exit(object sender, EventArgs e) + { + + } + private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) + { + // If the app is running outside of the debugger then report the exception using + // the browser's exception mechanism. On IE this will display it a yellow alert + // icon in the status bar and Firefox will display a script error. + if (!System.Diagnostics.Debugger.IsAttached) + { + + // NOTE: This will allow the application to continue running after an exception has been thrown + // but not handled. + // For production applications this error handling should be replaced with something that will + // report the error to the website and stop the application. + e.Handled = true; + Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); + } + } + private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) + { + try + { + string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; + errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); + + System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); + } + catch (Exception) + { + } + } + } +} diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/MainPage.xaml b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/MainPage.xaml new file mode 100644 index 0000000..891cc2c --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/MainPage.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/MainPage.xaml.cs b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/MainPage.xaml.cs new file mode 100644 index 0000000..e6aae9f --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/MainPage.xaml.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; +using Microsoft.Scripting.Hosting; +using Dlrsoft.VBScript.Hosting; + +namespace SilverlightApplication1 +{ + public partial class MainPage : UserControl + { + public MainPage() + { + InitializeComponent(); + + } + + private void MyButton_Click(object sender, RoutedEventArgs e) + { + VbscriptHost vbscript = ((App)Application.Current).VBScript; + ScriptScope scope = vbscript.CreateScope(); + scope.SetVariable("page", this); + //this.MyButton.Content = "Clicked"; + string code = "page.MyButton.Content = \"Clicked\""; + CompiledCode compiled = vbscript.Compile(code); + compiled.Execute(scope); + } + } +} diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/Properties/AppManifest.xml b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/Properties/AppManifest.xml new file mode 100644 index 0000000..151cfa5 --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/Properties/AppManifest.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/Properties/AssemblyInfo.cs b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4a2ab94 --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SilverlightApplication1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SilverlightApplication1")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fe694c1e-a21a-498a-9420-a2cd04ba88b6")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/SilverlightApplication1.csproj b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/SilverlightApplication1.csproj new file mode 100644 index 0000000..797a3d4 --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/SilverlightApplication1.csproj @@ -0,0 +1,120 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {07C38CED-F1AC-4CA3-803F-22C22FD0AEF1} + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + SilverlightApplication1 + SilverlightApplication1 + v3.5 + true + + + true + true + SilverlightApplication1.xap + Properties\AppManifest.xml + SilverlightApplication1.App + TestPage.html + true + true + false + Properties\OutOfBrowserSettings.xml + false + true + + + + + true + full + false + Bin\Debug + DEBUG;TRACE;SILVERLIGHT + true + true + prompt + 4 + + + pdbonly + true + Bin\Release + TRACE;SILVERLIGHT + true + true + prompt + 4 + + + + False + ..\..\bin\Silverlight Release\Dlrsoft.VBScript.dll + + + False + ..\..\bin\Silverlight Release\Microsoft.Dynamic.dll + + + False + ..\..\bin\Silverlight Release\Microsoft.Scripting.dll + + + False + ..\..\bin\Silverlight Release\Microsoft.Scripting.Core.dll + + + False + ..\..\bin\Silverlight Release\Microsoft.Scripting.Silverlight.dll + + + + + + + + + + + + App.xaml + + + MainPage.xaml + + + + + + + Designer + MSBuild:MarkupCompilePass1 + + + Designer + MSBuild:MarkupCompilePass1 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/SilverlightApplication1.csproj.user b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/SilverlightApplication1.csproj.user new file mode 100644 index 0000000..00b6274 --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/SilverlightApplication1.csproj.user @@ -0,0 +1,28 @@ + + + + + + + + DynamicPage + True + False + False + + + + + + + + + True + + + True + + + + + \ No newline at end of file diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/VbscriptHost.cs b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/VbscriptHost.cs new file mode 100644 index 0000000..3115cc9 --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightApplication1/VbscriptHost.cs @@ -0,0 +1,47 @@ +using System; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Ink; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; +using Microsoft.Scripting; +using Microsoft.Scripting.Hosting; +using Microsoft.Scripting.Silverlight; +using Dlrsoft.VBScript.Hosting; + +namespace SilverlightApplication1 +{ + public class VbscriptHost + { + private ScriptRuntime _runtime = null; + private ScriptEngine _engine; + + public VbscriptHost() + { + var setup = new ScriptRuntimeSetup(); + string qualifiedname = typeof(VBScriptContext).AssemblyQualifiedName; + setup.LanguageSetups.Add(new LanguageSetup( + qualifiedname, "vbscript", new[] { "vbscript" }, new[] { ".vbs" })); + setup.HostType = typeof(BrowserScriptHost); + _runtime = new ScriptRuntime(setup); + _engine = _runtime.GetEngine("vbscript"); + + _runtime.LoadAssembly(typeof(VBScriptContext).Assembly); + } + + public ScriptScope CreateScope() + { + return _engine.CreateScope(); + } + + public CompiledCode Compile(string code) + { + ScriptSource src = _engine.CreateScriptSourceFromString(code, SourceCodeKind.File); + return src.Compile(); + } + } +} diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightVBScriptSample.sln b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightVBScriptSample.sln new file mode 100644 index 0000000..bde4aca --- /dev/null +++ b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightVBScriptSample.sln @@ -0,0 +1,35 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightApplication1", "SilverlightApplication1\SilverlightApplication1.csproj", "{07C38CED-F1AC-4CA3-803F-22C22FD0AEF1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightApplication1.Web", "SilverlightApplication1.Web\SilverlightApplication1.Web.csproj", "{66FC416D-ADB5-4479-B731-EA0260086BCA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + Silverlight Debug|Any CPU = Silverlight Debug|Any CPU + Silverlight Release|Any CPU = Silverlight Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {07C38CED-F1AC-4CA3-803F-22C22FD0AEF1}.Debug|Any CPU.ActiveCfg = Silverlight Debug|Any CPU + {07C38CED-F1AC-4CA3-803F-22C22FD0AEF1}.Debug|Any CPU.Build.0 = Silverlight Debug|Any CPU + {07C38CED-F1AC-4CA3-803F-22C22FD0AEF1}.Release|Any CPU.ActiveCfg = Silverlight Debug|Any CPU + {07C38CED-F1AC-4CA3-803F-22C22FD0AEF1}.Silverlight Debug|Any CPU.ActiveCfg = Silverlight Release|Any CPU + {07C38CED-F1AC-4CA3-803F-22C22FD0AEF1}.Silverlight Debug|Any CPU.Build.0 = Silverlight Release|Any CPU + {07C38CED-F1AC-4CA3-803F-22C22FD0AEF1}.Silverlight Release|Any CPU.ActiveCfg = Silverlight Release|Any CPU + {07C38CED-F1AC-4CA3-803F-22C22FD0AEF1}.Silverlight Release|Any CPU.Build.0 = Silverlight Release|Any CPU + {66FC416D-ADB5-4479-B731-EA0260086BCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66FC416D-ADB5-4479-B731-EA0260086BCA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66FC416D-ADB5-4479-B731-EA0260086BCA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66FC416D-ADB5-4479-B731-EA0260086BCA}.Release|Any CPU.Build.0 = Release|Any CPU + {66FC416D-ADB5-4479-B731-EA0260086BCA}.Silverlight Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66FC416D-ADB5-4479-B731-EA0260086BCA}.Silverlight Debug|Any CPU.Build.0 = Debug|Any CPU + {66FC416D-ADB5-4479-B731-EA0260086BCA}.Silverlight Release|Any CPU.ActiveCfg = Debug|Any CPU + {66FC416D-ADB5-4479-B731-EA0260086BCA}.Silverlight Release|Any CPU.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/aspclassiccompiler/SilverlightVBScriptSample/SilverlightVBScriptSample.suo b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightVBScriptSample.suo new file mode 100644 index 0000000..c5f631b Binary files /dev/null and b/aspclassiccompiler/SilverlightVBScriptSample/SilverlightVBScriptSample.suo differ