static public string Transpile(string text, __Scope __scope) { ICodeTranspiler _transpiler = __scope.get <ICodeTranspiler>("_transpiler"); return(_transpiler.Transpile(text)); }
public static string compile(string code, __Scope __scope) { ICodeTranspiler _transpiler = __scope.get<ICodeTranspiler>("_transpiler"); return _transpiler.Transpile(code); }
public static void Start( string url, __Scope scope, string identityUrl = null, int threads = 4, string staticFiles = null, int nodes = 0, IEnumerable <Assembly> assemblies = null, IEnumerable <string> except = null, IEnumerable <FilterFunction> filters = null) { var instantiator = scope.get <IInstantiator>() ?? new DefaultInstantiator(); using (WebApp.Start(url, (builder) => { if (!string.IsNullOrWhiteSpace(staticFiles)) { if (!Directory.Exists(staticFiles)) { throw new ArgumentException(staticFiles); } staticFiles = Path.GetFullPath(staticFiles); var physicalFileSystem = new PhysicalFileSystem(staticFiles); var options = new FileServerOptions { EnableDefaultFiles = true, FileSystem = physicalFileSystem }; options.StaticFileOptions.FileSystem = physicalFileSystem; options.StaticFileOptions.ServeUnknownFileTypes = true; options.DefaultFilesOptions.DefaultFileNames = new[] { "index.html" }; builder.UseFileServer(options); } var functionTypes = assemblies .SelectMany(assembly => assembly .ExportedTypes .Where(type => type.Name == "Functions")); builder.UseExcess( scope, initializeApp: server => { Loader.FromAssemblies(server, assemblies, instantiator, except); if (nodes > 0) { throw new NotImplementedException(); //start the identity server if we have any nodes var error = null as Exception; var waiter = new ManualResetEvent(false); NetMQFunctions.StartServer(server, identityUrl, expectedClients: nodes, connected: ex => { error = ex; waiter.Set(); }); waiter.WaitOne(); //td: timeout if (error != null) { throw error; } } }, functional: functionTypes, filters: filters); })) { Console.WriteLine($"Excess server running @{url}..."); Console.ReadLine(); } }