示例#1
0
        public string Render()
        {
            TextDocumentCanvas canvas = new TextDocumentCanvas();

            Render(canvas);
            return(canvas.ToString());
        }
示例#2
0
        public void Render(TextDocumentCanvas canvas)
        {
            GetTyonType().Render(canvas);

            if (GetTyonAddress() != null)
            {
                canvas.AppendToLine("&");
                GetTyonAddress().Render(canvas);
            }

            if (GetTyonValueList() != null)
            {
                canvas.AppendToLine("(");
                GetTyonValueList().Render(canvas, false);
                canvas.AppendToLine(")");
            }

            if (GetTyonVariables().IsNotEmpty())
            {
                canvas.AppendToLine(" {");
                canvas.Indent();
                GetTyonVariables().Process(v => v.Render(canvas));
                canvas.Dedent();
                canvas.AppendToNewline("}");
            }
        }
示例#3
0
        static public string Regurgitate(this object item, int max_depth, bool verbose_exceptions)
        {
            TextDocumentCanvas canvas = new TextDocumentCanvas();

            item.Regurgitate(canvas, max_depth, verbose_exceptions);
            return(canvas.ToString());
        }
示例#4
0
 public void Render(TextDocumentCanvas canvas)
 {
     canvas.AppendToNewline(GetId());
     canvas.AppendToLine(" = ");
     GetTyonValue().Render(canvas);
     canvas.AppendToLine(";");
 }
示例#5
0
 public override void Render(TextDocumentCanvas canvas)
 {
     canvas.AppendToLine(GetId());
     canvas.AppendToLine("<");
     GetTyonTypes().ProcessWithInterleaving(t => t.Render(canvas), () => canvas.AppendToLine(","));
     canvas.AppendToLine(">");
 }
示例#6
0
 public override void Render(TextDocumentCanvas canvas)
 {
     canvas.AppendToNewline(text);
     canvas.AppendToNewline("{");
     base.Render(canvas);
     canvas.AppendToNewline("}");
     canvas.AppendNewline();
 }
示例#7
0
        public override string RenderDocument()
        {
            TextDocumentCanvas canvas = new TextDocumentCanvas();

            canvas.AppendLines(GenerateHeader());
            canvas.AppendNewline();

            Render(canvas);
            return(canvas.ToString());
        }
示例#8
0
 public void Render(TextDocumentCanvas canvas)
 {
     GetTyonType().IfNotNull(t => t.Render(canvas));
     canvas.AppendToLine(" [");
     canvas.Indent();
     canvas.AppendNewline();
     GetTyonValueList().IfNotNull(l => l.Render(canvas, true));
     canvas.Dedent();
     canvas.AppendToNewline("]");
 }
示例#9
0
        public void Render(TextDocumentCanvas canvas, bool multiline)
        {
            GetTyonValues().ProcessWithInterleaving(
                v => v.Render(canvas),
                () => {
                canvas.AppendToLine(", ");

                if (multiline)
                {
                    canvas.AppendNewline();
                }
            }
                );
        }
示例#10
0
        static private void Regurgitate_IEnumerable(IEnumerable item, TextDocumentCanvas canvas, int max_depth, bool verbose_exceptions)
        {
            canvas.AppendToLine("[");
            canvas.Indent();

            foreach (object sub_item in item)
            {
                canvas.AppendNewline();
                sub_item.Regurgitate(canvas, max_depth - 1, verbose_exceptions);
                canvas.AppendToLine(";");
            }

            canvas.Dedent();
            canvas.AppendToNewline("]");
        }
示例#11
0
        static public void Regurgitate(this object item, TextDocumentCanvas canvas, int max_depth, bool verbose_exceptions)
        {
            try
            {
                if (max_depth >= 1)
                {
                    if (item == null)
                    {
                        Regurgitate_Null(item, canvas, max_depth, verbose_exceptions);
                    }
                    else
                    {
                        Type type = item.GetTypeEX();

                        if (type.IsPrimitive())
                        {
                            Regurgitate_Primitive(item, canvas, max_depth, verbose_exceptions);
                        }
                        else if (type.IsTypicalIEnumerable())
                        {
                            Regurgitate_IEnumerable((IEnumerable)item, canvas, max_depth, verbose_exceptions);
                        }
                        else
                        {
                            Regurgitate_Object(item, canvas, max_depth, verbose_exceptions);
                        }
                    }
                }
                else
                {
                    canvas.AppendToLine("(Exceeded Depth)");
                }
            }
            catch (Exception ex)
            {
                if (verbose_exceptions)
                {
                    canvas.AppendToLine(ex.Message);
                }
                else
                {
                    canvas.AppendToLine("(Exception)");
                }
            }
        }
示例#12
0
        static private void Regurgitate_Object(object item, TextDocumentCanvas canvas, int max_depth, bool verbose_exceptions)
        {
            canvas.AppendToLine(item.GetType().ToString());
            canvas.AppendToLine("{");
            canvas.Indent();

            foreach (FieldInfoEX field in item.GetAllInstanceFields())
            {
                canvas.AppendNewline();
                canvas.AppendToLine(field.Name);
                canvas.AppendToLine(": ");
                field.GetValue(item).Regurgitate(canvas, max_depth - 1, verbose_exceptions);
                canvas.AppendToLine(";");
            }

            canvas.Dedent();
            canvas.AppendToNewline("}");
        }
示例#13
0
 public override void Render(TextDocumentCanvas canvas)
 {
     canvas.AppendToLine(GetId());
 }
示例#14
0
 static private void Regurgitate_Primitive(object item, TextDocumentCanvas canvas, int max_depth, bool verbose_exceptions)
 {
     canvas.AppendToLine(item.ToString());
 }
示例#15
0
 public override void Render(TextDocumentCanvas canvas)
 {
     canvas.AppendToLine("null");
 }
示例#16
0
 public override void Render(TextDocumentCanvas canvas)
 {
     canvas.AppendToLine("&");
     GetTyonAddress().Render(canvas);
 }
示例#17
0
 static private void Regurgitate_Null(object item, TextDocumentCanvas canvas, int max_depth, bool verbose_exceptions)
 {
     canvas.AppendToLine("null");
 }
示例#18
0
 public override void Render(TextDocumentCanvas canvas)
 {
     GetTyonArray().Render(canvas);
 }
示例#19
0
 public void Render(TextDocumentCanvas canvas)
 {
     GetTyonType().Render(canvas);
     canvas.AppendToLine(":");
     GetTyonValue().Render(canvas);
 }
示例#20
0
 public abstract void Render(TextDocumentCanvas canvas);
示例#21
0
 public override void Render(TextDocumentCanvas canvas)
 {
     GetTyonSurrogate().Render(canvas);
 }
示例#22
0
 public override void Render(TextDocumentCanvas canvas)
 {
     canvas.AppendToLine("typeof(");
     GetTyonType().Render(canvas);
     canvas.AppendToLine(")");
 }
示例#23
0
 public override void Render(TextDocumentCanvas canvas)
 {
     canvas.AppendToLine(GetInt().StyleAsLiteral());
 }
示例#24
0
 public override void Render(TextDocumentCanvas canvas)
 {
     canvas.AppendToLine(GetString().StyleAsDoubleQuoteLiteral());
 }