private void GenerateContextHeader(UnitDeclaration unitDeclaration) { if (!String.IsNullOrEmpty(options.ContextHeaderFileName)) { using (StreamWriter writer = File.CreateText(options.ContextHeaderFileName)) { string header = HeaderGenerator.Generate(unitDeclaration); string guardString = Path.GetFileName(options.ContextHeaderFileName).ToUpper().Replace(".", "_"); StringBuilder sb = new StringBuilder(); sb .AppendLine("// -----------------------------------------------------------------------") .AppendLine("// Generated by FsmCompiler v1.1") .AppendLine("// Finite state machine compiler tool") .AppendLine("// Copyright 2015-2020 Rafael Serrano ([email protected])") .AppendLine("//") .AppendLine("// Warning. Don't touch. Changes will be overwritten!") .AppendLine("//") .AppendLine("// -----------------------------------------------------------------------") .AppendLine() .AppendFormat("#ifndef __{0}", guardString).AppendLine() .AppendFormat("#define __{0}", guardString).AppendLine() .AppendLine() .AppendLine() .AppendFormat("#include \"{0}\"", options.ConfigHeaderFileName).AppendLine() .AppendLine() .AppendLine() .AppendLine(header) .AppendLine() .AppendFormat("#endif // __{0}", guardString).AppendLine(); writer.Write(sb.ToString()); } } }
public XXssMiddleware(RequestDelegate next, XXssProtectionOptions options) : base(next) { _config = options; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateXXssProtectionResult(_config); }
public ReferrerPolicyMiddleware(AppFunc next, ReferrerPolicyOptions options) : base(next) { _config = options; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateReferrerPolicyResult(_config); }
public XfoMiddleware(RequestDelegate next, XFrameOptions options) : base(next) { _config = options; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateXfoResult(_config); }
public HpkpMiddleware(RequestDelegate next, HpkpOptions options, bool reportOnly) : base(next) { _config = options.Config; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateHpkpResult(_config, reportOnly); }
public HstsMiddleware(AppFunc next, HstsOptions options) : base(next) { _config = options; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateHstsResult(_config); }
public XRobotsTagMiddleware(AppFunc next, XRobotsTagOptions options) : base(next) { _config = options.Config; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateXRobotsTagResult(_config); }
public XDownloadOptionsMiddleware(RequestDelegate next) : base(next) { _config = new SimpleBooleanConfiguration { Enabled = true }; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateXDownloadOptionsResult(_config); }
public CspMiddleware(AppFunc next, ICspConfiguration options, bool reportOnly) { _next = next; _config = options; _reportOnly = reportOnly; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateCspResult(_config, reportOnly); }
public XContentTypeOptionsMiddleware(AppFunc next) : base(next) { _config = new SimpleBooleanConfiguration { Enabled = true }; var headerGenerator = new HeaderGenerator(); _headerResult = headerGenerator.CreateXContentTypeOptionsResult(_config); }
public void MatchesGoldenCanonWithMerkles(byte[] expected, byte[] n1, ushort n2sz, ulong nonce2, string jobid, byte[] prevHash, byte[] trie, byte[] coinhead, byte[] cointail, byte[] version, byte[] nbits, byte[] ntime, bool clean, params byte[][] merkles) { var uut = new HeaderGenerator(PoolOps.Merkles.SingleSha); var pack = new NewJob(jobid, version, trie, coinhead, cointail, nbits, ntime, clean); Array.Copy(prevHash, pack.prevBlock.blob, pack.prevBlock.blob.Length); pack.merkles.AddRange(merkles.Select(el => AsMerkle(el))); uut.NextNonce(nonce2); uut.NonceSettings(n1, n2sz); uut.NewJob(pack); Assert.Equal(expected, uut.Header.ToArray()); }
public void GenerateTest( BookModel book, string expected) { // Arrange var generator = new HeaderGenerator(new StringHelper()); // Act var actual = generator.Generate(book); // Assert actual.Should().BeEquivalentTo(expected); }
public override void Generate(Machine machine) { UnitDeclaration unit = MachineUnitGenerator.Generate(machine, options); if (String.IsNullOrEmpty(options.OutputType) || (options.OutputType == "MachineHeader")) { string header = HeaderGenerator.Generate(unit); GenerateMachineHeader(header); } if (String.IsNullOrEmpty(options.OutputType) || (options.OutputType == "MachineCode")) { string code = CodeGenerator.Generate(unit); GenerateMachineCode(code); } }
public static IList<string[]> Generate(GeneratorType type, IList<NodeFeature> features) { IGenerate generator; switch (type) { case GeneratorType.HeaderGenerator: generator = new HeaderGenerator(); break; case GeneratorType.CodeBehindGenerator: generator = new CodeBehindGenerator(); break; case GeneratorType.StepDefinitionGenerator: generator = new StepDefinitionGenerator(); break; default: throw new NotImplementedException(); } return generator.Generate(new MSCppUnitTestLanguageConfig(), features); }
static public IList <string[]> Generate(GeneratorType type, IList <NodeFeature> features) { IGenerate generator; switch (type) { case GeneratorType.HeaderGenerator: generator = new HeaderGenerator(); break; case GeneratorType.CodeBehindGenerator: generator = new CodeBehindGenerator(); break; case GeneratorType.StepDefinitionGenerator: generator = new StepDefinitionGenerator(); break; default: throw new NotImplementedException(); } return(generator.Generate(new MSCppUnitTestLanguageConfig(), features)); }
private void UploadXMLClicked(object sender, RoutedEventArgs e) { ErrorBannerUpdater(""); //uploads an xml file foreach (var doc in new UploadXML().doc) { //generates the header only once if (Count - DeletedColumnCount < 1) { try { Header = new HeaderGenerator(doc).HeaderToString; } catch (Exception exception) { Console.WriteLine(exception); ErrorBannerUpdater("Did you upload the CBECC XML? The takeoff XML is invalid!"); return; } } // gets usefull values then returns those in an array. var currentColumnArr = new List <string>(); try { currentColumnArr = new CurrentColumnValues(doc).currentColumnValuesArr; } catch (Exception exception) { string corruptedFileName = Convert.ToString(doc) .Split(new [] { "<ModelFile>" }, StringSplitOptions.None)[1] .Split(new [] { "</ModelFile>" }, StringSplitOptions.None)[0]; ErrorBannerUpdater($"Cannot Upload File {corruptedFileName}, Please send it to IT. "); Console.WriteLine("Invalid XML --- " + exception); continue; } //Adds current xml to an array containing all of them [currentColumnArr][Values] AllColumnsArr.Add(currentColumnArr); //WPF App - Adds a column as xml uploaded for visual representation WPFColumnUpdater(currentColumnArr); //this.Count++ Count++; if (Count - DeletedColumnCount >= 10) { Console.WriteLine("Limit reached - " + Count); ErrorBannerUpdater("Limit reached (10) - Will increase to 15 in the future"); Upload.IsEnabled = false; break; } } }
public HeaderGeneratorCspTests() { _generator = new HeaderGenerator(); }
public void Setup() { _generator = new HeaderGenerator(); }