コード例 #1
0
        public override void Start(ArgumentDescription[] args)
        {
            _value = new PositionBuffer();

            _value.Append(
                @"using System;
using System.Text;
using System.Web;
using BlogServer;
using BlogServer.Model;

public class Template
{
    private static string HtmlEncode(string val)
    {
        return System.Web.HttpUtility.HtmlEncode(val);
    }

    private static string HtmlAttributeEncode(string val)
    {
        return System.Web.HttpUtility.HtmlAttributeEncode(val);
    }

    private static string HtmlDecode(string val)
    {
        return System.Web.HttpUtility.HtmlDecode(val);
    }

    private static string UrlEncode(string val)
    {
        return System.Web.HttpUtility.UrlEncode(val);
    }

    private static string UrlPathEncode(string val)
    {
        return System.Web.HttpUtility.UrlPathEncode(val);
    }

    private static string UrlDecode(string val)
    {
        return System.Web.HttpUtility.UrlDecode(val);
    }

    public static string Process(object[] parameters)
    {
        StringBuilder ___output = new StringBuilder();
");
            for (int ___i = 0; ___i < args.Length; ___i++)
            {
                ArgumentDescription arg = args[___i];

                string argType = arg.Type.FullName;

                _value.AppendFormat("{0} {1} = ({0})parameters[{2}];", argType, arg.Identifier, ___i);
            }
        }
コード例 #2
0
        public override void Start(ArgumentDescription[] args)
        {
            _value = new PositionBuffer();

            _value.Append(
@"using System;
using System.Text;
using System.Web;
using BlogServer;
using BlogServer.Model;

public class Template
{
    private static string HtmlEncode(string val)
    {
        return System.Web.HttpUtility.HtmlEncode(val);
    }

    private static string HtmlAttributeEncode(string val)
    {
        return System.Web.HttpUtility.HtmlAttributeEncode(val);
    }

    private static string HtmlDecode(string val)
    {
        return System.Web.HttpUtility.HtmlDecode(val);
    }

    private static string UrlEncode(string val)
    {
        return System.Web.HttpUtility.UrlEncode(val);
    }

    private static string UrlPathEncode(string val)
    {
        return System.Web.HttpUtility.UrlPathEncode(val);
    }

    private static string UrlDecode(string val)
    {
        return System.Web.HttpUtility.UrlDecode(val);
    }

    public static string Process(object[] parameters)
    {
        StringBuilder ___output = new StringBuilder();
");
            for (int ___i = 0; ___i < args.Length; ___i++)
            {
                ArgumentDescription arg = args[___i];

                string argType = arg.Type.FullName;

                _value.AppendFormat("{0} {1} = ({0})parameters[{2}];", argType, arg.Identifier, ___i);
            }
        }
コード例 #3
0
        public override void Start(ArgumentDescription[] args)
        {
            _value = new PositionBuffer();

            _value.Append(
                @"using System;
using System.Text;
using System.Web;

//[assembly: System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.RequestMinimum, Flags = System.Security.Permissions.SecurityPermissionFlag.Execution, Unrestricted = true)]
//[assembly: System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.RequestOptional, Flags = System.Security.Permissions.SecurityPermissionFlag.Execution, Unrestricted = true)]

public class Template
{
    private static string HtmlEncode(string val)
    {
        return System.Web.HttpUtility.HtmlEncode(val);
    }

    private static string HtmlAttributeEncode(string val)
    {
        return System.Web.HttpUtility.HtmlAttributeEncode(val);
    }

    private static string HtmlDecode(string val)
    {
        return System.Web.HttpUtility.HtmlDecode(val);
    }

    private static string UrlEncode(string val)
    {
        return System.Web.HttpUtility.UrlEncode(val);
    }

    private static string UrlPathEncode(string val)
    {
        return System.Web.HttpUtility.UrlPathEncode(val);
    }

    private static string UrlDecode(string val)
    {
        return System.Web.HttpUtility.UrlDecode(val);
    }

    public static string Process(object state, object[] parameters)
    {
        StringBuilder ___output = new StringBuilder();
        string _selection = state as string;
");
            for (int ___i = 0; ___i < args.Length; ___i++)
            {
                ArgumentDescription arg = args[___i];

                string argType;
                switch (arg.Type)
                {
                case ArgumentType.TextString:
                case ArgumentType.TextStringExtended:
                case ArgumentType.HtmlString:
                case ArgumentType.HtmlStringExtended:
                    argType = "string";
                    break;

                case ArgumentType.Double:
                    argType = "double";
                    break;

                case ArgumentType.Integer:
                    argType = "int";
                    break;

                case ArgumentType.Boolean:
                    argType = "bool";
                    break;

                case ArgumentType.DateTime:
                    argType = "System.DateTime";
                    break;

                default:
                    throw new ArgumentException("Unexpected argument type: " + arg.Type);
                }

                _value.AppendFormat("{0} {1} = ({0})parameters[{2}];", argType, arg.Identifier, ___i);
            }
        }