├── .gitignore ├── LICENSE ├── README.md ├── ScriptSharp.sln └── src ├── Repl ├── App.config ├── CodeController.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── ScriptSharp.Repl.csproj ├── Startup.cs └── packages.config ├── ScriptEditor ├── App.config ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── ScriptEditor.Designer.cs ├── ScriptEditor.cs ├── ScriptEditor.resx ├── ScriptSharp.ScriptEditor.csproj └── packages.config ├── ScriptEngine ├── CSharpScriptEngine.cs ├── Properties │ └── AssemblyInfo.cs ├── ScriptSharp.ScriptEngine.csproj └── packages.config └── ScriptSharpElectric ├── index.html ├── index.js ├── main.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opensdf 78 | *.sdf 79 | *.cachefile 80 | 81 | # Visual Studio profiler 82 | *.psess 83 | *.vsp 84 | *.vspx 85 | 86 | # TFS 2012 Local Workspace 87 | $tf/ 88 | 89 | # Guidance Automation Toolkit 90 | *.gpState 91 | 92 | # ReSharper is a .NET coding add-in 93 | _ReSharper*/ 94 | *.[Rr]e[Ss]harper 95 | *.DotSettings.user 96 | 97 | # JustCode is a .NET coding addin-in 98 | .JustCode 99 | 100 | # TeamCity is a build add-in 101 | _TeamCity* 102 | 103 | # DotCover is a Code Coverage Tool 104 | *.dotCover 105 | 106 | # NCrunch 107 | _NCrunch_* 108 | .*crunch*.local.xml 109 | 110 | # MightyMoose 111 | *.mm.* 112 | AutoTest.Net/ 113 | 114 | # Web workbench (sass) 115 | .sass-cache/ 116 | 117 | # Installshield output folder 118 | [Ee]xpress/ 119 | 120 | # DocProject is a documentation generator add-in 121 | DocProject/buildhelp/ 122 | DocProject/Help/*.HxT 123 | DocProject/Help/*.HxC 124 | DocProject/Help/*.hhc 125 | DocProject/Help/*.hhk 126 | DocProject/Help/*.hhp 127 | DocProject/Help/Html2 128 | DocProject/Help/html 129 | 130 | # Click-Once directory 131 | publish/ 132 | 133 | # Publish Web Output 134 | *.[Pp]ublish.xml 135 | *.azurePubxml 136 | # TODO: Comment the next line if you want to checkin your web deploy settings 137 | # but database connection strings (with potential passwords) will be unencrypted 138 | *.pubxml 139 | *.publishproj 140 | 141 | # NuGet Packages 142 | *.nupkg 143 | # The packages folder can be ignored because of Package Restore 144 | **/packages/* 145 | # except build/, which is used as an MSBuild target. 146 | !**/packages/build/ 147 | # Uncomment if necessary however generally it will be regenerated when needed 148 | #!**/packages/repositories.config 149 | 150 | # Windows Azure Build Output 151 | csx/ 152 | *.build.csdef 153 | 154 | # Windows Store app package directory 155 | AppPackages/ 156 | 157 | # Visual Studio cache files 158 | # files ending in .cache can be ignored 159 | *.[Cc]ache 160 | # but keep track of directories ending in .cache 161 | !*.[Cc]ache/ 162 | 163 | # Others 164 | ClientBin/ 165 | [Ss]tyle[Cc]op.* 166 | ~$* 167 | *~ 168 | *.dbmdl 169 | *.dbproj.schemaview 170 | *.pfx 171 | *.publishsettings 172 | node_modules/ 173 | bower_components/ 174 | 175 | # RIA/Silverlight projects 176 | Generated_Code/ 177 | 178 | # Backup & report files from converting an old project file 179 | # to a newer Visual Studio version. Backup files are not needed, 180 | # because we have git ;-) 181 | _UpgradeReport_Files/ 182 | Backup*/ 183 | UpgradeLog*.XML 184 | UpgradeLog*.htm 185 | 186 | # SQL Server files 187 | *.mdf 188 | *.ldf 189 | 190 | # Business Intelligence projects 191 | *.rdl.data 192 | *.bim.layout 193 | *.bim_*.settings 194 | 195 | # Microsoft Fakes 196 | FakesAssemblies/ 197 | 198 | # Node.js Tools for Visual Studio 199 | .ntvs_analysis.dat 200 | 201 | # Visual Studio 6 build log 202 | *.plg 203 | 204 | # Visual Studio 6 workspace options file 205 | *.opt -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Christian Jacobsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ScriptSharp 2 | This is a cross platform application which lets the user do the following: 3 | * Write C# expressions in a REPL and evalutate them. 4 | * Write scritps in a code editor and submit them to the REPL. 5 | * Add references to Nuget packages (either remotely or locally) 6 | -------------------------------------------------------------------------------- /ScriptSharp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30723.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptSharp.ScriptEngine", "src\ScriptEngine\ScriptSharp.ScriptEngine.csproj", "{2AC60740-DB95-40CD-A4FE-A46C35098C4C}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptSharp.ScriptEditor", "src\ScriptEditor\ScriptSharp.ScriptEditor.csproj", "{3E7F7340-72BB-459F-B562-C796E1045DB4}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptSharp.Repl", "src\Repl\ScriptSharp.Repl.csproj", "{E9C92903-8168-43E7-82E5-3ED2B614A9D0}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {2AC60740-DB95-40CD-A4FE-A46C35098C4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {2AC60740-DB95-40CD-A4FE-A46C35098C4C}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {2AC60740-DB95-40CD-A4FE-A46C35098C4C}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {2AC60740-DB95-40CD-A4FE-A46C35098C4C}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {3E7F7340-72BB-459F-B562-C796E1045DB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {3E7F7340-72BB-459F-B562-C796E1045DB4}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {3E7F7340-72BB-459F-B562-C796E1045DB4}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {3E7F7340-72BB-459F-B562-C796E1045DB4}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {E9C92903-8168-43E7-82E5-3ED2B614A9D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {E9C92903-8168-43E7-82E5-3ED2B614A9D0}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {E9C92903-8168-43E7-82E5-3ED2B614A9D0}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {E9C92903-8168-43E7-82E5-3ED2B614A9D0}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /src/Repl/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/Repl/CodeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Http; 3 | using ScriptSharp.ScriptEngine; 4 | 5 | namespace ScriptSharp.Repl 6 | { 7 | public class CodeController : ApiController 8 | { 9 | // POST api/code 10 | public void Post([FromBody]string code) 11 | { 12 | Console.WriteLine(CSharpScriptEngine.Execute(code)); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Repl/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ScriptSharp.ScriptEngine; 3 | using Microsoft.Owin.Hosting; 4 | 5 | namespace ScriptSharp.Repl 6 | { 7 | class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | string baseAddress = "http://localhost:9000/"; 12 | 13 | // Start OWIN host 14 | using (WebApp.Start(url: baseAddress)) 15 | { 16 | while (true) 17 | { 18 | var str = Console.ReadLine(); 19 | Console.WriteLine(CSharpScriptEngine.Execute(str)); 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Repl/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Repl")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Repl")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f8d5d8e9-fe09-4948-8458-4633b15024c9")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Repl/ScriptSharp.Repl.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E9C92903-8168-43E7-82E5-3ED2B614A9D0} 8 | Exe 9 | Properties 10 | ScriptSharp.Repl 11 | ScriptSharp.Repl 12 | v4.6.1 13 | 512 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | ..\..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll 39 | True 40 | 41 | 42 | ..\..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll 43 | True 44 | 45 | 46 | ..\..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll 47 | True 48 | 49 | 50 | ..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll 51 | True 52 | 53 | 54 | ..\..\packages\Owin.1.0\lib\net40\Owin.dll 55 | 56 | 57 | 58 | 59 | 60 | ..\..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.dll 61 | True 62 | 63 | 64 | ..\..\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Extensions.dll 65 | True 66 | 67 | 68 | ..\..\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Formatting.dll 69 | True 70 | 71 | 72 | ..\..\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Primitives.dll 73 | True 74 | 75 | 76 | ..\..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.WebRequest.dll 77 | True 78 | 79 | 80 | False 81 | ..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll 82 | 83 | 84 | ..\..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll 85 | True 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | {2ac60740-db95-40cd-a4fe-a46c35098c4c} 106 | ScriptSharp.ScriptEngine 107 | 108 | 109 | 110 | 117 | -------------------------------------------------------------------------------- /src/Repl/Startup.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using Owin; 3 | using Microsoft.Owin.Builder; 4 | 5 | namespace ScriptSharp.Repl 6 | { 7 | public class Startup 8 | { 9 | // This code configures Web API. The Startup class is specified as a type 10 | // parameter in the WebApp.Start method. 11 | public void Configuration(IAppBuilder appBuilder) 12 | { 13 | // Configure Web API for self-host. 14 | var config = new HttpConfiguration(); 15 | config.Routes.MapHttpRoute( 16 | name: "DefaultApi", 17 | routeTemplate: "api/{controller}/{id}", 18 | defaults: new { id = RouteParameter.Optional } 19 | ); 20 | 21 | appBuilder.UseWebApi(config); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Repl/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/ScriptEditor/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/ScriptEditor/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace ScriptSharp.ScriptEditor 5 | { 6 | static class Program 7 | { 8 | /// 9 | /// The main entry point for the application. 10 | /// 11 | [STAThread] 12 | static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new ScriptEditor()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ScriptEditor/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ScriptEditor")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ScriptEditor")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f8131b1b-9a19-4c4e-ba0b-78650064f62b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/ScriptEditor/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ScriptSharp.ScriptEditor.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ScriptSharp.ScriptEditor.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/ScriptEditor/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /src/ScriptEditor/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ScriptSharp.ScriptEditor.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ScriptEditor/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/ScriptEditor/ScriptEditor.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ScriptSharp.ScriptEditor 2 | { 3 | partial class ScriptEditor 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.CodeEdit = new System.Windows.Forms.TextBox(); 32 | this.SuspendLayout(); 33 | // 34 | // CodeEdit 35 | // 36 | this.CodeEdit.Dock = System.Windows.Forms.DockStyle.Fill; 37 | this.CodeEdit.Location = new System.Drawing.Point(0, 0); 38 | this.CodeEdit.Multiline = true; 39 | this.CodeEdit.Name = "CodeEdit"; 40 | this.CodeEdit.Size = new System.Drawing.Size(839, 626); 41 | this.CodeEdit.TabIndex = 0; 42 | this.CodeEdit.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CodeEdit_KeyDown); 43 | // 44 | // ScriptEditor 45 | // 46 | this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); 47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 48 | this.ClientSize = new System.Drawing.Size(839, 626); 49 | this.Controls.Add(this.CodeEdit); 50 | this.Name = "ScriptEditor"; 51 | this.Text = "Script Editor"; 52 | this.ResumeLayout(false); 53 | this.PerformLayout(); 54 | 55 | } 56 | 57 | #endregion 58 | 59 | private System.Windows.Forms.TextBox CodeEdit; 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/ScriptEditor/ScriptEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using System.Windows.Forms; 3 | 4 | namespace ScriptSharp.ScriptEditor 5 | { 6 | public partial class ScriptEditor : Form 7 | { 8 | public ScriptEditor() 9 | { 10 | InitializeComponent(); 11 | } 12 | 13 | private void CodeEdit_KeyDown(object sender, KeyEventArgs e) 14 | { 15 | if (CodeEdit.SelectedText.Length > 0 && e.KeyCode == Keys.Enter && e.Alt) 16 | { 17 | const string baseAddress = "http://localhost:9000/"; 18 | using (var client = new HttpClient()) 19 | { 20 | var response = client.PostAsJsonAsync(baseAddress + "api/code", CodeEdit.SelectedText).Result; 21 | } 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ScriptEditor/ScriptEditor.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /src/ScriptEditor/ScriptSharp.ScriptEditor.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {3E7F7340-72BB-459F-B562-C796E1045DB4} 8 | WinExe 9 | Properties 10 | ScriptSharp.ScriptEditor 11 | ScriptSharp.ScriptEditor 12 | v4.6.1 13 | 512 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | ..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll 39 | True 40 | 41 | 42 | 43 | 44 | 45 | ..\..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.dll 46 | True 47 | 48 | 49 | ..\..\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Extensions.dll 50 | True 51 | 52 | 53 | ..\..\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Formatting.dll 54 | True 55 | 56 | 57 | ..\..\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Primitives.dll 58 | True 59 | 60 | 61 | ..\..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.WebRequest.dll 62 | True 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Form 76 | 77 | 78 | ScriptEditor.cs 79 | 80 | 81 | 82 | 83 | ScriptEditor.cs 84 | 85 | 86 | ResXFileCodeGenerator 87 | Resources.Designer.cs 88 | Designer 89 | 90 | 91 | True 92 | Resources.resx 93 | True 94 | 95 | 96 | 97 | SettingsSingleFileGenerator 98 | Settings.Designer.cs 99 | 100 | 101 | True 102 | Settings.settings 103 | True 104 | 105 | 106 | 107 | 108 | 109 | 110 | 117 | -------------------------------------------------------------------------------- /src/ScriptEditor/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/ScriptEngine/CSharpScriptEngine.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.CodeAnalysis.Scripting; 3 | using Microsoft.CodeAnalysis.CSharp.Scripting; 4 | 5 | namespace ScriptSharp.ScriptEngine 6 | { 7 | public class CSharpScriptEngine 8 | { 9 | private static ScriptState scriptState = null; 10 | public static object Execute(string code) 11 | { 12 | scriptState = scriptState == null ? CSharpScript.RunAsync(code).Result : scriptState.ContinueWithAsync(code).Result; 13 | if (scriptState.ReturnValue != null && !string.IsNullOrEmpty(scriptState.ReturnValue.ToString())) 14 | return scriptState.ReturnValue; 15 | return null; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ScriptEngine/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ScriptEngine")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ScriptEngine")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7fb851c6-63aa-4b37-8c1c-96cba77c651f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/ScriptEngine/ScriptSharp.ScriptEngine.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2AC60740-DB95-40CD-A4FE-A46C35098C4C} 8 | Library 9 | Properties 10 | ScriptSharp.ScriptEngine 11 | ScriptSharp.ScriptEngine 12 | v4.6.1 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\..\packages\Microsoft.CodeAnalysis.Common.1.1.1\lib\net45\Microsoft.CodeAnalysis.dll 36 | True 37 | 38 | 39 | ..\..\packages\Microsoft.CodeAnalysis.CSharp.1.1.1\lib\net45\Microsoft.CodeAnalysis.CSharp.dll 40 | True 41 | 42 | 43 | ..\..\packages\Microsoft.CodeAnalysis.CSharp.Scripting.1.1.1\lib\dotnet\Microsoft.CodeAnalysis.CSharp.Scripting.dll 44 | True 45 | 46 | 47 | ..\..\packages\Microsoft.CodeAnalysis.Scripting.Common.1.1.1\lib\dotnet\Microsoft.CodeAnalysis.Scripting.dll 48 | True 49 | 50 | 51 | 52 | ..\..\packages\System.AppContext.4.0.0\lib\net46\System.AppContext.dll 53 | True 54 | 55 | 56 | ..\..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll 57 | True 58 | 59 | 60 | 61 | ..\..\packages\System.Diagnostics.StackTrace.4.0.0\lib\net46\System.Diagnostics.StackTrace.dll 62 | True 63 | 64 | 65 | ..\..\packages\System.IO.FileSystem.4.0.0\lib\net46\System.IO.FileSystem.dll 66 | True 67 | 68 | 69 | ..\..\packages\System.IO.FileSystem.Primitives.4.0.0\lib\net46\System.IO.FileSystem.Primitives.dll 70 | True 71 | 72 | 73 | ..\..\packages\System.Reflection.Metadata.1.1.0\lib\dotnet5.2\System.Reflection.Metadata.dll 74 | True 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 101 | -------------------------------------------------------------------------------- /src/ScriptEngine/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/ScriptSharpElectric/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /src/ScriptSharpElectric/index.js: -------------------------------------------------------------------------------- 1 | var edge = require('electron-edge') 2 | 3 | var hello = edge.func(function () {/* 4 | async (input) => { 5 | return ".NET welcomes " + input.ToString(); 6 | } 7 | */}); 8 | 9 | hello('Node.js', function (error, result) { 10 | if (error) throw error; 11 | console.log(result); 12 | }); 13 | 14 | var ta = document.getElementById('ta'); 15 | ta.onkeydown = function (event) { 16 | if (event.defaultPrevented) { 17 | return; 18 | } 19 | var handled = false; 20 | if (event.key !== undefined) { 21 | if (event.key === 'Enter' && event.altKey) { 22 | sendCode(getSelectedText()); 23 | } 24 | } else if (event.keyIdentifier !== undefined) { 25 | if (event.keyIdentifier === "Enter" && event.altKey) { 26 | sendCode(getSelectedText()); 27 | } 28 | 29 | } else if (event.keyCode !== undefined) { 30 | if (event.keyCode === 13 && event.altKey) { 31 | sendCode(getSelectedText()); 32 | } 33 | } 34 | if (handled) { 35 | event.preventDefault(); 36 | }; 37 | }; 38 | 39 | function sendCode(code) 40 | { 41 | // var xmlhttp = new XMLHttpRequest(); 42 | // xmlhttp.open("POST", "http://localhost:9000/api/code", true); 43 | // xmlhttp.setRequestHeader("Content-type","application/json"); 44 | // xmlhttp.send("'" + code + "'"); 45 | // alert('Code sent: ' + code); 46 | alert('Selected code: ' + code); 47 | } 48 | function getSelectedText() { 49 | var ta = document.getElementById('ta'); 50 | var selectedText; 51 | // IE version 52 | if (document.selection != undefined) { 53 | ta.focus(); 54 | var sel = document.selection.createRange(); 55 | selectedText = sel.text; 56 | } 57 | // Mozilla version 58 | else if (ta.selectionStart != undefined) { 59 | var startPos = ta.selectionStart; 60 | var endPos = ta.selectionEnd; 61 | selectedText = ta.value.substring(startPos, endPos) 62 | } 63 | return selectedText; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/ScriptSharpElectric/main.js: -------------------------------------------------------------------------------- 1 | var app = require('app'); // Module to control application life. 2 | var BrowserWindow = require('browser-window'); // Module to create native browser window. 3 | 4 | // Report crashes to our server. 5 | require('crash-reporter').start(); 6 | 7 | // Keep a global reference of the window object, if you don't, the window will 8 | // be closed automatically when the javascript object is GCed. 9 | var mainWindow = null; 10 | 11 | // Quit when all windows are closed. 12 | app.on('window-all-closed', function() { 13 | if (process.platform != 'darwin') 14 | app.quit(); 15 | }); 16 | 17 | // This method will be called when Electron has done everything 18 | // initialization and ready for creating browser windows. 19 | app.on('ready', function() { 20 | // Create the browser window. 21 | mainWindow = new BrowserWindow({width: 800, height: 600}); 22 | mainWindow.openDevTools(); 23 | // and load the index.html of the app. 24 | mainWindow.loadUrl('file://' + __dirname + '/index.html'); 25 | 26 | // Emitted when the window is closed. 27 | mainWindow.on('closed', function() { 28 | // Dereference the window object, usually you would store windows 29 | // in an array if your app supports multi windows, this is the time 30 | // when you should delete the corresponding element. 31 | mainWindow = null; 32 | }); 33 | }); -------------------------------------------------------------------------------- /src/ScriptSharpElectric/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "your-app", 3 | "version": "0.1.0", 4 | "main": "main.js", 5 | "scripts": { 6 | "start": "electron main.js" 7 | }, 8 | "dependencies": { 9 | "edge": "^5.0.0" 10 | } 11 | } 12 | --------------------------------------------------------------------------------