Exemple #1
0
        public static IApplicationBuilder UseWasmStaticFiles(this IApplicationBuilder builder)
        {
            const string wasmWorkbookAppId = "webassembly-monowebassembly";
            var          wasmWorkbookApp   = WorkbookAppInstallation.LookupById(wasmWorkbookAppId);

            if (wasmWorkbookApp != null)
            {
                var provider = new FileExtensionContentTypeProvider();
                provider.Mappings.Add(".wasm", "application/wasm");

                builder.UseStaticFiles(new StaticFileOptions {
                    FileProvider          = new PhysicalFileProvider(wasmWorkbookApp.AppPath),
                    RequestPath           = "/wasm",
                    ContentTypeProvider   = provider,
                    ServeUnknownFileTypes = true
                });
            }
            else
            {
                Logging.Log.Warning(
                    nameof(WasmStaticFileMiddleware),
                    "Could not find WASM workbook app to register static file serving.");
            }

            return(builder);
        }
Exemple #2
0
        public WebAssemblyEvaluationContextManager()
        {
            var workbookApp = WorkbookAppInstallation.LookupById(workbookAppId);

            appPath                  = workbookApp.AppPath;
            webAssemblySdk           = workbookApp.Sdk;
            this.assemblySearchPaths = webAssemblySdk.AssemblySearchPaths;
        }
        public Task <AgentIdentity> GetAgentIdentityAsync(CancellationToken cancellationToken = default)
        {
            var wasmWorkbookApp = WorkbookAppInstallation.LookupById("webassembly-monowebassembly");

            return(Task.FromResult(
                       new AgentIdentity(
                           AgentType.Console,
                           wasmWorkbookApp.Sdk,
                           "Xamarin Workbooks (WASM)")));
        }