Esempio n. 1
0
        protected override void call(int callIndex, AutoCSer.Net.Http.SocketBase socket)
        {
            switch (callIndex)
            {
            case 0:
                AutoCSer.TestCase.WebPerformance.AjaxLoader loader = AutoCSer.TestCase.WebPerformance.AjaxLoader /**/.Pop() ?? new AutoCSer.TestCase.WebPerformance.AjaxLoader();
                ajaxLoader(loader, socket);
                loader.Load();
                return;

            case 1:
                load(socket, AutoCSer.TestCase.WebPerformance.WebCall /**/.Pop() ?? new AutoCSer.TestCase.WebPerformance.WebCall(), _i1);
                return;

            case 2:
                loadAsynchronous(socket, AutoCSer.TestCase.WebPerformance.WebCallAsynchronous /**/.Pop() ?? new AutoCSer.TestCase.WebPerformance.WebCallAsynchronous(), _i2);
                return;
            }
        }
Esempio n. 2
0
        protected override void call(int callIndex, AutoCSer.Net.Http.SocketBase socket)
        {
            switch (callIndex)
            {
            case 0:
                AutoCSer.TestCase.WebPerformance.AjaxLoader loader = AutoCSer.TestCase.WebPerformance.AjaxLoader /**/.Pop() ?? new AutoCSer.TestCase.WebPerformance.AjaxLoader();
                ajaxLoader(loader, socket);
                loader.Load();
                return;

            case 1:
                load(socket, AutoCSer.TestCase.WebPerformance.WebCall /**/.Pop() ?? new AutoCSer.TestCase.WebPerformance.WebCall(), _i1);
                return;

            case 2:
                loadAsynchronous(socket, AutoCSer.TestCase.WebPerformance.WebCallAsynchronous /**/.Pop() ?? new AutoCSer.TestCase.WebPerformance.WebCallAsynchronous(), _i2);
                return;
            }
        }

        protected override bool call(AutoCSer.WebView.CallBase call, ref AutoCSer.Memory.UnmanagedStream responseStream)
        {
            switch (call.CallMethodIndex)
            {
            case 1:
            {
                _p1 parameter = new _p1();
                if (call.ParseParameter(ref parameter))
                {
                    AutoCSer.TestCase.WebPerformance.WebCall value = (AutoCSer.TestCase.WebPerformance.WebCall)call;
                    value.Add(parameter.left, parameter.right);
                    repsonseCall(value, ref responseStream);
                    return(true);
                }
            }
                return(false);

            default: return(false);
            }
        }

        protected override bool call(AutoCSer.WebView.CallBase call)
        {
            switch (call.CallMethodIndex)
            {
            case 2:
            {
                _p1 parameter = new _p1();
                if (call.ParseParameter(ref parameter))
                {
                    ((AutoCSer.TestCase.WebPerformance.WebCallAsynchronous)call).Xor(parameter.left, parameter.right);
                    return(true);
                }
            }
                return(false);

            default: return(false);
            }
        }

        [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Auto)]
        struct _p1
        {
            public int left;
            public int right;
        }
    }
} namespace AutoCSer.TestCase.WebPerformance
{
    internal partial class WebView
    {
        protected override bool page(ref AutoCSer.WebView.Response _html_)
        {
            byte[][] htmls;
            htmls = loadHtml(@"WebView.html", 2);
            if (htmls != null)
            {
                _html_.WriteNotNull(htmls[0]);
                _html_.Write(Return);
                _html_.WriteNotNull(htmls[1]);
                return(true);
            }
            return(false);
        }

        protected override void ajax(AutoCSer.Memory.CharStream _js_)
        {
            _js_.Write(@"{Return:");
            {
                int _value1_ = Return;
                _js_.WriteWebViewJson((int)_value1_);
            }
            _js_.Write(@"}");
        }

        [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Auto)]
        internal struct WebViewQuery
        {
            [AutoCSer.JsonDeSerializeMember(IsDefault = true)]
            public int left;
            public int right;
        }
        /// <summary>
        /// 查询参数
        /// </summary>
        private WebViewQuery query;
        /// <summary>
        /// WEB视图加载
        /// </summary>
        /// <returns>是否成功</returns>
        protected override bool loadView()
        {
            if (base.loadView())
            {
                query = default(WebViewQuery);
                if (ParseParameter(ref query))
                {
                    return(loadView(query.left, query.right));
                }
            }
            return(false);
        }
    }
} namespace AutoCSer.TestCase.WebPerformance
{
    internal partial class WebViewAsynchronous
    {
        protected override bool page(ref AutoCSer.WebView.Response _html_)
        {
            byte[][] htmls;
            htmls = loadHtml(@"WebViewAsynchronous.html", 2);
            if (htmls != null)
            {
                _html_.WriteNotNull(htmls[0]);
                _html_.Write(Return);
                _html_.WriteNotNull(htmls[1]);
                return(true);
            }
            return(false);
        }

        protected override void ajax(AutoCSer.Memory.CharStream _js_)
        {
            _js_.Write(@"{Return:");
            {
                int _value1_ = Return;
                _js_.WriteWebViewJson((int)_value1_);
            }
            _js_.Write(@"}");
        }

        [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Auto)]
        internal struct WebViewQuery
        {
            [AutoCSer.JsonDeSerializeMember(IsDefault = true)]
            public int left;
            public int right;
        }
        /// <summary>
        /// 查询参数
        /// </summary>
        private WebViewQuery query;
        /// <summary>
        /// WEB视图加载
        /// </summary>
        /// <returns>是否成功</returns>
        protected override bool loadView()
        {
            if (base.loadView())
            {
                query = default(WebViewQuery);
                if (ParseParameter(ref query))
                {
                    return(loadView(query.left, query.right));
                }
            }
            return(false);
        }
    }
}
namespace AutoCSer.TestCase.WebPerformance
{
    /// <summary>
    /// WEB服务器
    /// </summary>
    public partial class WebServer : AutoCSer.Net.HttpDomainServer.ViewServer <int>
    {
        protected override KeyValue <string[], string[]> rewrites
        {
            get
            {
                int      count = 2 + 0 * 2;
                string[] names = new string[count];
                string[] views = new string[count];
                names[--count] = "/WebView";
                views[count]   = "/WebView.html";
                names[--count] = "/WebViewAsynchronous";
                views[count]   = "/WebViewAsynchronous.html";
                return(new KeyValue <string[], string[]>(names, views));
            }
        }
        protected override string[] viewRewrites
        {
            get
            {
                string[] names = new string[2];
                names[0] = "/WebView";
                names[1] = "/WebViewAsynchronous";
                return(names);
            }
        }
        protected override string[] views
        {
            get
            {
                string[] names = new string[2];
                names[0] = "/WebView.html";
                names[1] = "/WebViewAsynchronous.html";
                return(names);
            }
        }
        protected override void request(int viewIndex, AutoCSer.Net.Http.SocketBase socket)
        {
            switch (viewIndex)
            {
            case 0:
                loadPage(socket, AutoCSer.TestCase.WebPerformance.WebView /**/.Pop() ?? new AutoCSer.TestCase.WebPerformance.WebView());
                return;

            case 1:
                AutoCSer.TestCase.WebPerformance.WebViewAsynchronous _p1 = AutoCSer.TestCase.WebPerformance.WebViewAsynchronous /**/.Pop();
                if (_p1 == null)
                {
                    setPage(_p1 = new AutoCSer.TestCase.WebPerformance.WebViewAsynchronous(), true, false);
                }
                loadPage(socket, _p1);
                return;
            }
        }

        /// <summary>
        /// 网站生成配置
        /// </summary>
        internal new static readonly AutoCSer.TestCase.WebPerformance.WebViewConfig WebConfig = new AutoCSer.TestCase.WebPerformance.WebViewConfig();
        /// <summary>
        /// 网站生成配置
        /// </summary>
        /// <returns>网站生成配置</returns>
        protected override AutoCSer.WebView.Config getWebConfig()
        {
            return(WebConfig);
        }

        static WebServer()
        {
            CompileQueryParse(new System.Type[] { typeof(AutoCSer.TestCase.WebPerformance.WebView /**/.WebViewQuery), typeof(AutoCSer.TestCase.WebPerformance.WebViewAsynchronous /**/.WebViewQuery), null }, new System.Type[] { typeof(_p1), null });
        }
    }
} namespace AutoCSer.TestCase.WebPerformance
{
    /// <summary>
    /// AJAX函数调用
    /// </summary>
    [AutoCSer.WebView.Call]
    [AutoCSer.WebView.ClearMember(IsIgnoreCurrent = true)]
    public sealed class AjaxLoader : AutoCSer.WebView.AjaxLoader <AjaxLoader>
    {
        [AutoCSer.WebView.CallMethod(FullName = "/Ajax")]
        [System.Runtime.CompilerServices.MethodImpl(AutoCSer.MethodImpl.AggressiveInlining)]
        public void Load()
        {
            load();
        }

        protected override void loadView(AutoCSer.WebView.AjaxMethodInfo ajaxInfo)
        {
            switch (ajaxInfo.MethodIndex)
            {
            case 2:
                loadView(AutoCSer.TestCase.WebPerformance.WebView /**/.Pop() ?? new AutoCSer.TestCase.WebPerformance.WebView(), ajaxInfo);
                return;

            case 3:
                AutoCSer.TestCase.WebPerformance.WebViewAsynchronous _p3 = AutoCSer.TestCase.WebPerformance.WebViewAsynchronous /**/.Pop();
                if (_p3 == null)
                {
                    setPage(_p3 = new AutoCSer.TestCase.WebPerformance.WebViewAsynchronous(), true, false);
                }
                loadView(_p3, ajaxInfo);
                return;

            default: return;
            }
        }

        protected override void loadAjax(AutoCSer.WebView.AjaxMethodInfo ajaxInfo)
        {
            switch (ajaxInfo.MethodIndex)
            {
            case 0: loadAjax(AutoCSer.TestCase.WebPerformance.Ajax.Call /**/.Pop() ?? new AutoCSer.TestCase.WebPerformance.Ajax.Call(), ajaxInfo); return;

            case 1: loadAjax(AutoCSer.TestCase.WebPerformance.Ajax.Call /**/.Pop() ?? new AutoCSer.TestCase.WebPerformance.Ajax.Call(), ajaxInfo); return;

            case 5 - 1: pubError(); return;

            default: return;
            }
        }