918博天堂

Server : Microsoft-IIS/10.0
System : Windows NT EBS-6136 10.0 build 17763 (Windows Server 2016) i586
User : jxgj ( 0)
PHP Version : 7.0.33
Disable Function : passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server
Directory :  D:/tmp_aspnet/root/2591dbd7/c1451959/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : D:/tmp_aspnet/root/2591dbd7/c1451959/App_Code.ftjrc5o7.15.cs
?#pragma checksum "D:\wwwroot\heiyu1153\wwwroot\App_Code\wxpay\CommonUtil.cs" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2C1BAB077B4B239F9A2DC3DC9AC062AB34301015"

#line 1 "D:\wwwroot\heiyu1153\wwwroot\App_Code\wxpay\CommonUtil.cs"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
namespace WxV3.Helper
{
    public class CommonUtil
    {
        public static bool IsNumeric(String str)
        {
            try
            {
                int.Parse(str);
                return true;
            }
            catch
            {
                return false;
            }
        }
        public static string ArrayToXml(Dictionary<string, string> arr)
        {
            String xml = "<xml>";

            foreach (KeyValuePair<string, string> pair in arr)
            {
                String key = pair.Key;
                String val = pair.Value;
                //if (IsNumeric(val))
                //{
                //    xml += "<" + key + ">" + val + "</" + key + ">";

                //}
                //else
                    xml += "<" + key + "><![CDATA[" + val + "]]></" + key + ">";
            }

            xml += "</xml>";
            return xml;
        }
        public static Dictionary<string,string> ReceivePostXmlData(string xmlData)
        {
            if (!string.IsNullOrEmpty(xmlData))
            {                
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xmlData);
                //得到XML文档根节点
                XmlElement root = doc.DocumentElement;
                XmlNodeList nodeList = root.ChildNodes;
                Dictionary<string, string> dic = new Dictionary<string, string>();
                foreach (XmlNode node in nodeList)
                {
                    dic.Add(node.Name, node.InnerText);                   
                }
                return dic;
            }
            return null;
        }

        public static string BuildRandomStr(int length)
        {
            Random rand = new Random();

            int num = rand.Next();

            string str = num.ToString();

            if (str.Length > length)
            {
                str = str.Substring(0, length);
            }
            else if (str.Length < length)
            {
                int n = length - str.Length;
                while (n > 0)
                {
                    str.Insert(0, "0");
                    n--;
                }
            }

            return str;
        }
    }
}


#line default
#line hidden