public void IfReturnType(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { var operation = arguments?.FirstOrDefault() as OpenApiOperation; if (operation != null) { string type = null; if (arguments.Count > 1) { type = arguments[1] as string; } var rt = GetReturnType(operation, "void"); if (type == "any" && rt != "void") { fn(null); } else if (string.Equals(type, rt.ToLower(), StringComparison.OrdinalIgnoreCase)) { fn(null); } else if (type == "obj" && rt != "void" && rt != "Stream") { fn(null); } } }
public static void EachHelper(RenderContext context, IList<object> arguments, IDictionary<string, object> options, RenderBlock fn, RenderBlock inverse) { foreach (var item in (IEnumerable) arguments[0]) { fn(item); } }
public static void IfParamDoesNotContain(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { var operation = arguments?.FirstOrDefault() as OpenApiOperation; if (operation != null) { string name = null; if (arguments.Count > 1) { name = arguments[1] as string; } var found = false; foreach (var param in operation.Parameters) { if (param.Name == name) { found = true; break; } } if (!found) { fn(null); } } }
private static void ToXmlDoc(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is string) { bool first = true; using (StringReader reader = new StringReader(arguments[0] as string)) { string line = null; while ((line = reader.ReadLine()) != null) { if (!first) { context.Write("\n"); context.Write(" /// "); } else { first = false; } context.Write(line); } } } }
private void ToXmlDoc(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is string) { var first = true; using (var reader = new StringReader(arguments[0] as string)) { string line = null; while ((line = reader.ReadLine()) != null) { foreach (var wline in WordWrap(line, 80)) { if (!first) { context.Write("\n"); context.Write(" /// "); } else { first = false; } context.Write(SecurityElement.Escape(wline)); } } } } }
public void Render(RenderBlock rb) { foreach (var batch in batches.Values) { if (batch.Ranges.Count > 0) { RenderBatchRange newRange; newRange.Start = (ushort)gb.NumIndices; foreach (var range in batch.Ranges) { var vertexIndex = (ushort)range; gb.AddIndex(vertexIndex++); gb.AddIndex(vertexIndex++); gb.AddIndex(vertexIndex++); gb.AddIndex(vertexIndex); } newRange.End = (ushort)gb.NumIndices; batch.Batch.Range = newRange; var state = new RenderState(batch.Batch); rb.AddState(state); } } }
/// <summary> /// if_eq this compare=that /// </summary> internal static void IfEqHelper(RenderContext ctx, IList<object> args, IDictionary<string, object> options, RenderBlock fn, RenderBlock inverse) { if (Object.Equals(args[0], options["compare"])) fn(args[0]); else inverse(args[0]); }
private static void GetApiVersion(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is JsonSchema4) { context.Write(GetApiVersion(arguments[0] as JsonSchema4)); } }
public void GetInterfaceName(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is JsonSchema) { context.Write(GetInterfaceName(arguments[0] as JsonSchema)); } }
internal static void Nl2BrHelper(RenderContext ctx, IList <object> args, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { var text = args[0].ToString(); var nl2br = Regex.Replace(text, "([^>\r\n]?)(\r\n|\n\r|\r|\n)", "$1<br>$2"); ctx.Write(nl2br); }
private static void GetMethodName(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is SwaggerOperation) { context.Write(GetMethodName(arguments[0] as SwaggerOperation)); } }
private static void FullName(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments?.Count >= 2) { context.Write($"{arguments[0]} {arguments[1]}"); } }
public void Setup(IGame game) { // Renderer Block renderBlock = new RenderBlock(game, () => { game.onRender(); }); game.engine.Renderer.AddBlock(new Vector(0, 0), renderBlock); // Handler Block game.engine.Renderer.AddBlock(new Vector(0, 0), new HandlerBlock(game)); }
private static void GetPathExpression(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is SwaggerOperationDescription) { var operation = arguments[0] as SwaggerOperationDescription; context.Write(GetPathExpression(operation)); } }
public void ToInterpolationPathString(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { var p = arguments?.FirstOrDefault() as string; if (p != null) { context.Write(Regex.Replace(p, "{(.+?)}", (m) => "{" + generalNameHelper.GetDotNetName(m.Groups[1].Value) + "}")); } }
public void IfGroupPathParamContainsGroup(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { var p = arguments?.FirstOrDefault() as string; if (p?.StartsWith("apis/{group}") == true) { fn(null); } }
public void GetClassName(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is OpenApiOperation) { context.Write(GetClassName(arguments[0] as OpenApiOperation)); } else if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is JsonSchema) { context.Write(GetClassNameForSchemaDefinition(arguments[0] as JsonSchema)); } }
static void GetClassName(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is SwaggerOperation) { context.Write(GetClassName(arguments[0] as SwaggerOperation)); } else if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is JsonSchema4) { context.Write(GetClassName(arguments[0] as JsonSchema4)); } }
private RenderBlock GetRenderBlock() { if (_renderPool.Count > 0) { return(_renderPool.Dequeue()); } var block = new RenderBlock(); block.Material = new Material(_material); block.MaterialPropertyBlock = new MaterialPropertyBlock(); return(block); }
/// <summary> /// if_eq this compare=that /// </summary> internal static void IfEqHelper(RenderContext ctx, IList <object> args, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (Object.Equals(args[0], options["compare"])) { fn(args[0]); } else { inverse(args[0]); } }
/// <summary> /// unless_lteq this compare=that /// </summary> internal static void UnlessLtEqHelper(RenderContext ctx, IList <object> args, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (Compare(args[0], options["compare"]) <= 0) { inverse(args[0]); } else { fn(args[0]); } }
public static void IfHelper(RenderContext context, IList<object> arguments, IDictionary<string, object> options, RenderBlock fn, RenderBlock inverse) { var value = arguments[0]; if (context.IsTruthy(value)) { fn(null); } else { inverse(null); } }
public void GetMethodName(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is OpenApiOperation) { string suffix = null; if (arguments.Count > 1) { suffix = arguments[1] as string; } context.Write(GetMethodName(arguments[0] as OpenApiOperation, suffix)); } }
private static void GetDotNetName(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is SwaggerParameter) { var parameter = arguments[0] as SwaggerParameter; context.Write(GetDotNetName(parameter.Name)); } else if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is string) { var parameter = arguments[0] as SwaggerParameter; context.Write(GetDotNetName((string)arguments[0])); } }
public static void FormatHelper( RenderContext ctx, IList<object> args, IDictionary<string, object> options, RenderBlock fn, RenderBlock inverse) { try { ctx.Write(FormatValue(args.FirstArg(), args.SecondStringArg())); } catch (Exception exception) { ctx.Write(exception.ToString()); } }
internal void Render() { var rb = new RenderBlock(); foreach (var appRenderable in renderables) appRenderable.Render(rb); RenderContext.MakeCurrent(nativeWindow); device.ActiveView = view; device.ClearView(); device.Render(rb); nativeWindow.Update(); }
public static void ReplaceHelper( RenderContext ctx, IList<object> args, IDictionary<string, object> options, RenderBlock fn, RenderBlock inverse) { try { ctx.Write(ReplaceValues(args)); } catch (Exception exception) { ctx.Write(exception.ToString()); } }
private static void GetPlural(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is JsonSchema4) { var plural = GetPlural(arguments[0] as JsonSchema4); if (plural != null) { context.Write($"\"{plural}\""); } else { context.Write("null"); } } }
public void GetReturnType(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { var operation = arguments?.FirstOrDefault() as OpenApiOperation; if (operation != null) { string style = null; if (arguments.Count > 1) { style = arguments[1] as string; } context.Write(GetReturnType(operation, style)); } }
public void GetDotNetType(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is OpenApiParameter) { var parameter = arguments[0] as OpenApiParameter; if (parameter.Schema?.Reference != null) { context.Write(classNameHelper.GetClassNameForSchemaDefinition(parameter.Schema.Reference)); } else if (parameter.Schema != null) { context.Write(GetDotNetType(parameter.Schema.Type, parameter.Name, parameter.IsRequired, parameter.Schema.Format)); } else { context.Write(GetDotNetType(parameter.Type, parameter.Name, parameter.IsRequired, parameter.Format)); } } else if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is JsonSchemaProperty) { var property = arguments[0] as JsonSchemaProperty; context.Write(GetDotNetType(property)); } else if (arguments != null && arguments.Count > 2 && arguments[0] != null && arguments[1] != null && arguments[2] != null && arguments[0] is JsonObjectType && arguments[1] is string && arguments[2] is bool) { context.Write(GetDotNetType((JsonObjectType)arguments[0], (string)arguments[1], (bool)arguments[2], (string)arguments[3])); } else if (arguments != null && arguments.Count > 0 && arguments[0] != null) { context.Write($"ERROR: Expected OpenApiParameter but got {arguments[0].GetType().FullName}"); } else { context.Write("ERROR: Expected a OpenApiParameter argument but got none."); } }
/// <summary> /// if_eq_zero this /// </summary> internal static void IfEqZeroHelper(RenderContext ctx, IList<object> args, IDictionary<string, object> options, RenderBlock fn, RenderBlock inverse) { bool isZero = false; double decArg = 0; if (args[0] != null && Double.TryParse(args[0].ToString(), out decArg)) { isZero = decArg.Equals(0D); } if (isZero) { fn(args[0]); } else { inverse(args[0]); } }
/// <summary> /// if_eq_zero this /// </summary> internal static void IfEqZeroHelper(RenderContext ctx, IList <object> args, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { bool isZero = false; double decArg = 0; if (args[0] != null && Double.TryParse(args[0].ToString(), out decArg)) { isZero = decArg.Equals(0D); } if (isZero) { fn(args[0]); } else { inverse(args[0]); } }
private static void GetDotNetType(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is SwaggerParameter) { var parameter = arguments[0] as SwaggerParameter; context.Write(GetDotNetType(parameter.Type, parameter.Name, parameter.IsRequired)); } else if (arguments != null && arguments.Count > 2 && arguments[0] != null && arguments[1] != null && arguments[2] != null && arguments[0] is JsonObjectType && arguments[1] is string && arguments[2] is bool) { context.Write(GetDotNetType((JsonObjectType)arguments[0], (string)arguments[1], (bool)arguments[2])); } else if (arguments != null && arguments.Count > 0 && arguments[0] != null) { context.Write($"ERROR: Expected SwaggerParameter but got {arguments[0].GetType().FullName}"); } else { context.Write($"ERROR: Expected a SwaggerParameter argument but got none."); } }
public static void IfKindIs(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { var parameter = arguments?.FirstOrDefault() as OpenApiParameter; if (parameter != null) { string kind = null; if (arguments.Count > 1) { kind = arguments[1] as string; } if (kind == "query" && parameter.Kind == OpenApiParameterKind.Query) { fn(null); } else if (kind == "path" && parameter.Kind == OpenApiParameterKind.Path) { fn(null); } } }
public static void IfType(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { var property = arguments?.FirstOrDefault() as JsonSchemaProperty; if (property != null) { string type = null; if (arguments.Count > 1) { type = arguments[1] as string; } if (type == "object" && property.Reference != null && !property.IsArray && property.AdditionalPropertiesSchema == null) { fn(null); } else if (type == "objectarray" && property.IsArray && property.Item?.Reference != null) { fn(null); } } }
public void GetModelCtorParam(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { var schema = arguments[0] as JsonSchema; if (schema != null) { context.Write(string.Join(", ", schema.Properties.Values .OrderBy(p => !p.IsRequired) .Select(p => { var sp = $"{typeHelper.GetDotNetType(p)} {generalNameHelper.GetDotNetName(p.Name, "fieldctor")}"; if (!p.IsRequired) { sp = $"{sp} = null"; } return(sp); }))); } }
public void GetDotNetName(RenderContext context, IList <object> arguments, IDictionary <string, object> options, RenderBlock fn, RenderBlock inverse) { if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is OpenApiParameter) { var parameter = arguments[0] as OpenApiParameter; context.Write(GetDotNetName(parameter.Name)); if (arguments.Count > 1 && arguments[1] as string == "true" && !parameter.IsRequired) { context.Write(" = null"); } } else if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is string) { var style = "parameter"; if (arguments.Count > 1) { style = arguments[1] as string; } context.Write(GetDotNetName((string)arguments[0], style)); } }
public static void UnlessHelper(RenderContext context, IList<object> arguments, IDictionary<string, object> options, RenderBlock fn, RenderBlock inverse) { IfHelper(context, arguments, options, inverse, fn); }
private void Render(Canvas canvas, string outputPath) { canvas.RenderCanvas(); var width = 0; var height = 0; foreach (var control in canvas.Children) RenderBounds(control, ref width, ref height); var imageSettings = new Settings { Height = (ushort)height, Width = (ushort)width }; var renderBuffer = RenderDevice.Backend.CreateRenderBuffer(imageSettings); renderBuffer.CreateRenderBuffer(RenderBufferType.Color); renderBuffer.CreateRenderBuffer(RenderBufferType.Depth); renderBuffer.Context = MainWindow.Context; MainView.RenderTarget = renderBuffer; MainView.Size = new Vector2i(width, height); canvas.SetSize(width, height); RenderDevice.ActiveView = MainView; if (!renderBuffer.Check()) throw new Exception("Error creating render buffer"); renderBuffer.Bind(); var rb = new RenderBlock(); Renderer.Render(rb); RenderDevice.ClearView(); RenderDevice.Render(rb); Engine.StepFrame(); var image = renderBuffer.ReadImage(1); var imageWriter = new ImageWriter(); imageWriter.Save(image, outputPath); renderBuffer.Unbind(); }
void Render(RenderBlock rb) { buffer.Render(rb); }
public static void WithHelper(RenderContext context, IList<object> arguments, IDictionary<string, object> options, RenderBlock fn, RenderBlock inverse) { fn(arguments[0]); }
/// <summary> /// unless_lt this compare=that /// </summary> internal static void UnlessLtHelper(RenderContext ctx, IList<object> args, IDictionary<string, object> options, RenderBlock fn, RenderBlock inverse) { if (Compare(args[0], options["compare"]) < 0) inverse(args[0]); else fn(args[0]); }
public void Render(RenderBlock rb) { GuiRenderer.Clear(); Canvas.RenderCanvas(); GuiRenderer.Render(rb); }
public override void Render(RenderBlock renderBlock) { GuiRenderer.Clear(); Canvas.RenderCanvas(); GuiRenderer.Render(renderBlock); }
public void Render(RenderBlock rb) { foreach (var batch in batches.Values) { if (batch.Ranges.Count > 0) { var newRange = new RenderBatchRange(); newRange.Start = (ushort)gb.NumIndices; foreach (var range in batch.Ranges) { var vertexIndex = (ushort)range; gb.AddIndex(vertexIndex++); gb.AddIndex(vertexIndex++); gb.AddIndex(vertexIndex++); gb.AddIndex(vertexIndex); } newRange.End = (ushort)gb.NumIndices; batch.Batch.Range = newRange; var state = new RenderState(batch.Batch); rb.AddState(state); } } }
public void Render(RenderBlock rb) { _guiBuffer.Render(rb); }
public virtual void Render(RenderBlock renderBlock) { }
public void Render() { var rb = new RenderBlock(); EditorWindow.Render(rb); RenderDevice.ActiveView = MainView; RenderDevice.ClearView(); RenderDevice.Render(rb); Engine.StepFrame(); }