Exemplo n.º 1
0
        /// <summary>
        /// 获取模板
        /// </summary>
        /// <returns>模板</returns>
        private static string GetScriptTemplete()
        {
            Type         typeFromHandle         = typeof(WebAjaxHandler);
            AssemblyName assemblyName           = new AssemblyName(typeFromHandle.Assembly.FullName);
            Stream       manifestResourceStream = typeFromHandle.Assembly.GetManifestResourceStream(assemblyName.Name + ".net.js");

            if (manifestResourceStream == null)
            {
                throw new ApplicationException("模板未找到");
            }
            return(HttpRequestUtility.GetMessage(manifestResourceStream, "utf-8"));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 解析参数
        /// </summary>
        /// <returns>参数</returns>
        public override Dictionary <string, object> Deserialize()
        {
            string bodyName = this.m_context.Request.ContentEncoding.BodyName;
            string message  = HttpRequestUtility.GetMessage(this.m_context.Request.InputStream, bodyName);
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
            object obj = javaScriptSerializer.DeserializeObject(message);
            Dictionary <string, object> dictionary = obj as Dictionary <string, object>;

            string[] allKeys = this.m_nvc.AllKeys;
            for (int i = 0; i < allKeys.Length; i++)
            {
                string text = allKeys[i];
                dictionary.Add(text, this.m_nvc[text]);
            }
            return(dictionary);
        }