private void GenerateArtifacts(IList <SyntaxTree> trees, Compilation c) { IArtifacts artifacts = ArtifactsFactory.Create(_options.ArtifactsType, _outputDir, _outputScript); artifacts.WriteWaterMark = _options.WriteWaterMark; artifacts.GenerateSourceMap = _options.GenerateSourceMap; artifacts.WaterMark = string.Format("//+++ This file is compiled by {0} {1} from C#. +++", Constants.SharpJs, Constants.GetVersion()); foreach (SyntaxTree sourceTree in trees) { string relPath = sourceTree.FilePath.RemoveBegin(_startPath); artifacts.SwitchSource(relPath); SemanticModel model = c.GetSemanticModel(sourceTree); Rewriter w = new Rewriter(model, _template, artifacts.Output, _aggregator); SyntaxNode newSource = w.Visit(sourceTree.GetRoot()); } artifacts.Dispose(); }
/// <summary> /// Create secret.key.json in web root path unless it exists. Then get signing credentials and bearer options into the output parameter. /// </summary> public static string InitializeKeyArtifacts(string WebRootPath, /*out:*/ IArtifacts output) { var secretFileName = WebRootPath + "\\" + output.getSecretKeyFile(); if (!File.Exists(secretFileName)) { RSAKeyUtils.GenerateKeyAndSave(secretFileName); } var param = RSAKeyUtils.GetKeyParameters(secretFileName); var key = new RsaSecurityKey(param); output.setKey(key); var signingCredentials = _CreateSigningCredentials(key); output.setSigningCredentials(signingCredentials); var jwtBearerOptions = _CreateJwtBearerOption(key, output.getTokenIssuer(), output.getTokenAudience()); output.setJwtBearerOptions(jwtBearerOptions); return(secretFileName); }